Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Sep 2010 12:45:36 +1000 (EST)
From:      Ian Smith <smithi@nimnet.asn.au>
To:        dave jones <s.dave.jones@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: ACPI questions about press power button
Message-ID:  <20100907122428.J32216@sola.nimnet.asn.au>
In-Reply-To: <20100905120024.A5AD31065732@hub.freebsd.org>
References:  <20100905120024.A5AD31065732@hub.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Re: freebsd-questions Digest, Vol 326, Issue 11, Message: 19
On Sun, 5 Sep 2010 19:04:51 +0800 dave jones <s.dave.jones@gmail.com> wrote:

 > I'm running FreeBSD 8 on my desktop. I want to write a file or do something
 > when I or someone presses power button. In devd.conf, I added the
 > following lines
 > for testing:
 > 
 >   notify 10 {
 >             match "system"          "ACPI";
 >             match "subsystem"      "Button";
 >             matcho "notify"            "0x00"
 >             action "echo hello world";
 >     };
 > 
 > But it doesn't work. Would anyone tell me how to do? Thanks.

I'm not sure this will do what you want anyway; devd will handle the 
notify but won't replace the normal action itself, ie it might power 
down (hopefully running shutdown actions, synching disks etc), however 
'matcho' won't match 'match' :) and that line needs a trailing ';'.

Whether or not it powers down (perhaps depending on BIOS setting, ie 
instant-off or 4-second-delay), it may be more useful logging it, say:

	action "logger -p kern.emerg 'power button pressed!'";

cheers, Ian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100907122428.J32216>