Cancel APM events from userspace ?

From: David Balazic (david.balazic@uni-mb.si)
Date: Mon Jan 31 2000 - 11:50:55 EST


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@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@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jan 31 2000 - 21:00:28 EST