From owner-freebsd-questions@FreeBSD.ORG Tue Sep 7 02:45:39 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 48B451065679 for ; Tue, 7 Sep 2010 02:45:39 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from sola.nimnet.asn.au (paqi.nimnet.asn.au [115.70.110.159]) by mx1.freebsd.org (Postfix) with ESMTP id BFBFA8FC13 for ; Tue, 7 Sep 2010 02:45:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by sola.nimnet.asn.au (8.14.2/8.14.2) with ESMTP id o872jb96076861; Tue, 7 Sep 2010 12:45:37 +1000 (EST) (envelope-from smithi@nimnet.asn.au) Date: Tue, 7 Sep 2010 12:45:36 +1000 (EST) From: Ian Smith To: dave jones In-Reply-To: <20100905120024.A5AD31065732@hub.freebsd.org> Message-ID: <20100907122428.J32216@sola.nimnet.asn.au> References: <20100905120024.A5AD31065732@hub.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: freebsd-questions@freebsd.org Subject: Re: ACPI questions about press power button 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, 07 Sep 2010 02:45:39 -0000 Re: freebsd-questions Digest, Vol 326, Issue 11, Message: 19 On Sun, 5 Sep 2010 19:04:51 +0800 dave jones 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