Cancel APM events from userspace ?

David Balazic david.balazic en uni-mb.si
Lun Ene 31 18:46:08 CST 2000


Hi!

( kernel 2.2.14 )

I noticed that user-space APM clients ( receivers of APM events ),
usually apmd, can not cancel a pending standby or suspend request.
This would be usefull in some cases and the in-kernel clients
( apm.c/send_event() ) can do it.

What I want to do is to start a script ( by apmd ) when the power button
is pressed ( it sends a an APM_USER_SUSPEND event to the OS and when
the OS acknowledges it , the system goes into suspend ), which then executes
"shutdown -r|-h now" and signals apmd to reject the suspend mode
( maybe like "exit 1" -> cancel the event ; "exit 0" -> execute event ).

This way I can do a clean shutdown when the console locks next time :-)


BTW, some weird things I noticed on my Abit BH6 board :
When the power-button  is pressed , an APM_USER_SUSPEND event
is sent to the OS. When the OS replys with 
apm_set_power_state(APM_STATE_SUSPEND);
, the machine is powered off !

If I change the BIOS option "power button override" from Disabled
to Enabled , then it works as expected; it only goes to suspend,
to turn it off the button has to held for a few seconds.

The big problem is that even if no APM software is running ( like in DOS ),
the button has to by depressed for a longer period ( ~5 secs ) to turn the machine
off, so I wonder if this option can be switched by the APM driver in the OS ?
So it would be "instant off" unless changed by the OS to "only suspend".


-- 
David Balazic , student
E-mail   : 1stein en writeme.com     |     living in  sLOVEnija
home page: http://surf.to/stein
Computer: Amiga 1200 + Quantum LPS-340AT
--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo en vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



Más información sobre la lista de distribución Ayuda