Re: kernel apm code

David Balazic (david.balazic@uni-mb.si)
Wed, 28 Mar 2001 12:59:18 +0200


John Fremlin wrote:
>
> David Balazic <david.balazic@uni-mb.si> writes:
>
> > The newer version has among other things support for
> > the APM_IOC_REJECT ioctl which is useful for example
> > when implementing "run /sbin/shutdown -h when the power
> > button is pressed".
> >
> > While isn't this merged into the official kernel ?
>
> The maintainer hasn't the time to do it. He promised me he would in
> February, when I telephone, but hasn't bothered to do anything
> AFAICS. I hacked together the following patch for it a while ago,
> which updated APM_IOC_REJECT for slightly more recent kernels (be
> warned, I think I made some mistakes)

It uses the same version number ( 1.15 ) as the "official" apm.c
( at linuxcare.com.au/apm ). I don't think that is a good idea.
Maybe 1.14b ?

>------------------------------------------------------------
>
> I made a (IMHO) better version called pmpolicy, based on different
> principles. More information is available at
>
> http://john.snoop.dk/programs/linux/offbutton/

To implement off-button you only need the APM_IOC_REJECT ioctl and apmd 3.0
and a slight change to the apm_proxy script.
It must be changed to execute "poweroff" and return a value of 1 ( so that
the apmd/kernel/apm-driver reject the event ) in case of "system suspend" event.
The only problem might be synchronization ( "poweroff" might kill apmd
before is sends the REJECT call to kernel ).

-- 
David Balazic
--------------
"Be excellent to each other." - Bill & Ted
- - - - - - - - - - - - - - - - - - - - - -
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/