Subject: port-i386/12067: wrong apm error messages on thinkpads
To: None <gnats-bugs@gnats.netbsd.org>
From: None <takashi.yamamoto@bigfoot.com>
List: netbsd-bugs
Date: 01/28/2001 07:40:17
>Number:         12067
>Category:       port-i386
>Synopsis:       wrong apm error messages on IBM thinkpads
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 28 07:43:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     YAMAMOTO Takashi
>Release:        2001-01-28
>Organization:
>Environment:
	
System: NetBSD capybara 1.5R NetBSD 1.5R (535) #13: Sun Jan 28 23:46:09 JST 2001 takashi@capybara:/usr/src/sys/arch/i386/compile/535 i386
Architecture: i386
Machine: i386
>Description:
	sometimes, apm shows unnecessary errors like:

APM get event: unknown error code (0x530b)

	0x530b is not an actual error code.
	it's trash register value of previous apm call.
	(0x530b just means 'get power management event')

>How-To-Repeat:
>Fix:
	below is patch.

Index: apm.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/i386/i386/apm.c,v
retrieving revision 1.58
diff -u -r1.58 apm.c
--- apm.c       2001/01/21 03:23:31     1.58
+++ apm.c       2001/01/28 15:22:40
@@ -758,12 +758,13 @@
                if (!apm_event_handle(sc, & regs)) {
                        DPRINTF(APMDEBUG_EVENTS | APMDEBUG_ANOM,
                          ("apm_periodic_check: duplicate event (break)\n"));
-                       break;
+                       goto event_duplicated;
                }
        }
 
        if (APM_ERR_CODE(&regs) != APM_ERR_NOEVENTS)
                apm_perror("get event", &regs);
+event_duplicated:
        if (apm_suspend_now) {
                apm_suspend_pending = 0;
                apm_suspend(sc);

>Release-Note:
>Audit-Trail:
>Unformatted: