ACPI questions about press power button

Ian Smith smithi at nimnet.asn.au
Tue Sep 7 02:45:39 UTC 2010


Re: freebsd-questions Digest, Vol 326, Issue 11, Message: 19
On Sun, 5 Sep 2010 19:04:51 +0800 dave jones <s.dave.jones at 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


More information about the freebsd-questions mailing list