Subject: kern/18394: APM bug on IBM Thinkpad i1200 laptops (loops forever)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <elendir@inf.enst.fr>
List: netbsd-bugs
Date: 09/24/2002 02:18:36
>Number:         18394
>Category:       kern
>Synopsis:       APM bug on IBM Thinkpad i1200 laptops (loops forever)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 24 02:19:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Vincent Habchi
>Release:        1.6
>Organization:
(Has been :)) ENST
>Environment:
1.6 NetBSD 1.6 (THINKPAD) #9: Sat Sep 21 21:31:59 UTC 2002     vincent@imladris.jautomatise.com:/usr/src/sys/arch/i386/compile/THINKPAD i386
>Description:
There is a bug in the APM code whereby if an unknown event is received
from the BIOS, the return code of the function apm_event_handle is 1. In
turn causes apm_periodic_check to loop forever, since my Thinkpad APM,
this unknown event will be kept posted by the BIOS.
The same problem repeats when I switch the AC plug ON/OFF (APM_POWER_CHANGE)

>How-To-Repeat:
Easy. Boot on a THINKPAD i1200 with the "standard" LAPTOP kernel,
and it fails as soon as APM is run (with "reserved event" printf
messages)
>Fix:
I wrote a modified version of apm.c with a better handling of duplicate
events (the last event is stored in a static variable, to be
compared with the next event occuring. If both are the same, the
apm_event_handle call exits with a 0 return status). It works fine.
However, since I have no APM docs nor other laptops available, I have
no means to know if it will work on other models.
>Release-Note:
>Audit-Trail:
>Unformatted: