From owner-freebsd-questions@FreeBSD.ORG Tue Jun 1 08:55:10 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35470106566B for ; Tue, 1 Jun 2010 08:55:10 +0000 (UTC) (envelope-from demelier.david@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id C09B38FC19 for ; Tue, 1 Jun 2010 08:55:09 +0000 (UTC) Received: by fxm5 with SMTP id 5so3351043fxm.13 for ; Tue, 01 Jun 2010 01:55:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=EEFWCz1KttQ419NYOP5MyntMW9E/6e/RaV9TZCSwh54=; b=nM2aqcVEqt85yRu14LSW3Qgl2Abh/UEX9FeRhyoEXbsHNzcw6d20Pd4S6Q8vRQ7HgB ffL3drNmrQaoHjy2aov3WKTkyAlTgV7bKT6U0jYusaTsztU/3/4HK60SmYkbHWPDXlyZ GD34CVMPAyAIN4wnzX2d+Tfcc8EijFZ6zyol0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=wLKCWqje9N0DE+DIoI+nWeE7F3jDk4cqd5J1f0wQjDazbMVyN6KIIQ+be+8tThKkv6 +GU96X7cmfw2cTfFvTlGFOc1LCWzuGpMHYCj4OE+VboYZDFEVnaNQrjgM76onXIxOgkd 2QEB7T7YyRd9oMCDNjXd5tS5+jliw63SYvqx8= MIME-Version: 1.0 Received: by 10.204.3.65 with SMTP id 1mr426919bkm.210.1275382508841; Tue, 01 Jun 2010 01:55:08 -0700 (PDT) Received: by 10.204.123.202 with HTTP; Tue, 1 Jun 2010 01:55:08 -0700 (PDT) Date: Tue, 1 Jun 2010 10:55:08 +0200 Message-ID: From: David DEMELIER To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=UTF-8 Subject: Automatic shutdown with devd. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2010 08:55:10 -0000 Hi, I recently asked to make an automatic shutdown when I excess a specific percent. I ran devd with -Dd flags to run in background and when the battery was at a critical state it said : Processing event '!system=ACPI subsystem=CMBAT type=\_SB_.BAT0 notify=0x80' Pushing table setting system=ACPI setting subsystem=CMBAT setting type=\_SB_.BAT0 setting notify=0x80 Then I tried (for testing) something like this in my /etc/devd.conf notify 10 { match "system" "ACPI"; match "subsystem" "CMBAT"; match "notify" "0x80"; action "logger LETGOSHUTDOWN"; }; And then I can see the following output in /var/log/messages : Jun 1 10:48:54 Melon power_profile: changed to 'performance' Jun 1 10:48:56 Melon root: LETGOSHUTDOWN Jun 1 10:49:12 Melon root: LETGOSHUTDOWN Jun 1 10:51:06 Melon last message repeated 2 times It works, but the problem is that it makes this even the cable is plugged ! i.e : the computer was not powered on so with 3% of remaining time but AC plugged in after booting it (always with the AC plugged in) these messages appears too. I guess the ACPI/CMBAT do not care if there is an AC plugged in or not. Is there a way to make this conditional to do only if the laptop is not charging, AC plugged in ? With king regards. -- Demelier David