> On 22-Apr-99 Jim DiFronzo wrote:
> >> I'm looking to trap the signal from the power button on many modern
> > ATX/NLX
> >> motherboards (I think they might call it 'soft power' or something),
and
> > use it
> >> to do something useful.
>
> *snip*
>
> > The power button is an APM function of the BIOS and chipset.  When the
user
> > presses the power button the chipset senses that trigger, enters SMM. In
SMM
> > the processor jumps to a memory location in BIOS and start executing the
> > Interrupt handler for that function.  Some BIOS's use an interrupt
rather
> > than SMM, but the results are the same. On most BIOS's the function
sends an
> > APM_USER_SUSPEND or APM_SYSTEM_SUSPEND signal to the OS.
>
> I had guessed it was something like that, but wasn't sure.  I'm not clear
on
> one thing though - if you press power to get an APM_USER_SUSPEND or
> APM_SYSTEM_SUSPEND, what happens when you press the suspend button that
comes
> with some machines (not this one, but some).

There are several APM events that are defined for this type of
functionality.  It seems like every BIOS/chipset/Motherboard combination
executes different events each user input. The best way to determine which
your motherboard uses is to test it out.  As a general rule though -
APM_SYSTEM_SUSPEND comes from pressing the power button or through a timer
and APM_USER_SUSPEND comes from a user pressing a suspend button.

Something else to consider -- VIA and many others chipsets combine
USER_SUSPEND and the power swtich into one button.  Pressing the button
momentarly executes a SUSPEND call (USER vs SYSTEM depends on the BIOS).
Pressing the button for more than 4 seconds performs a hard power off, just
like pulling the power cable. You may want to rethink the second function of
the power button.  I easily see a user holding it for 4 seconds (2 seconds
longer than you wanted) and unintentionally powering off your server.
However, if you dig through the documentation of the chipset you use, you
may be able to disable that function.  You would either need to have access
to BIOS code to disable it during boot or write a kernel module that
accesses the chipset registers and disables it by writing to specific
register.


Hope this helps too.

Jim DiFronzo

Reply via email to