How to trap a power button press?

I’m sorry if this is a repost - My original message didn’t appear.

I have a need to trap a power button event when user hits the power button on the case. Normally when this occurs Windows XP will show a popup, enter standby, or shutdown depending what the user selected.

We would like to trap the event and power our device down (or not) in a very controlled manner as this is a deply embedded device.

I have searched on this forum for a solution, and didn’t see much of a definitive answer. I also used IRPTracker to see if I could see the event. That too wasn’t very successful.

Regardless of our need, is this possible? Is there an IRP associated with a power button? I would have thought this would be an ACPI driver?

If there is a driver handling the event, I would like to create a filter around it to reprocess it.

Hopefully that is clear. Thank you for any responses.

How are power buttons reported in windows?
http://blogs.msdn.com/doronh/archive/2006/09/08/746834.aspx

how do keyboard power buttons work?
http://blogs.msdn.com/doronh/archive/2006/09/08/746961.aspx

I don’t know which ACPI device supports these IOCTLs, but one of them does ;). You can enumerate instances of the device interface GUID_DEVICE_SYS_BUTTON in user mode and from there find out the device instance of each device. Once you have the instance, you can look at its hw IDs so that you can target the device in your INF

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of perry.lea@hp.com
Sent: Tuesday, March 11, 2008 2:25 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to trap a power button press?

I’m sorry if this is a repost - My original message didn’t appear.

I have a need to trap a power button event when user hits the power button on the case. Normally when this occurs Windows XP will show a popup, enter standby, or shutdown depending what the user selected.

We would like to trap the event and power our device down (or not) in a very controlled manner as this is a deply embedded device.

I have searched on this forum for a solution, and didn’t see much of a definitive answer. I also used IRPTracker to see if I could see the event. That too wasn’t very successful.

Regardless of our need, is this possible? Is there an IRP associated with a power button? I would have thought this would be an ACPI driver?

If there is a driver handling the event, I would like to create a filter around it to reprocess it.

Hopefully that is clear. Thank you for any responses.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer