Subject: port-alpha/8422: Zs keyboard driver does not get initialized at boot
To: None <gnats-bugs@gnats.netbsd.org>
From: None <perseant@netbsd.org>
List: netbsd-bugs
Date: 09/16/1999 10:35:59
>Number:         8422
>Category:       port-alpha
>Synopsis:       keyboard is initialized before serial baud rate set
>Confidential:   No
>Severity:       serious
>Priority:       medium
>Responsible:    port-alpha-maintainer (NetBSD/alpha Portmaster)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 16 10:35:01 1999
>Last-Modified:
>Originator:     Konrad Schroder
>Organization:
						Konrad Schroder
						perseant@hhhh.org
>Release:        ~10 September 1999
>Environment:
	
System: NetBSD bitter 1.4K NetBSD 1.4K (BITTER) #12: Wed Sep 15 10:54:16 PDT 1999     perseant@bitter:/usr/src/sys/arch/alpha/compile/BITTER alpha

>Description:
	When hacking on an sfb X server for alpha, I discovered that the
	zs keyboard is not actually initialized the way it's supposed to be
	in lk201_init, at boot time...because lk201_init is called before
	the serial baud rate is set.
>How-To-Repeat:
	Read data from the keyboard, note that the keys only ever generate
	KEY_DOWN events.  Unplug the keyboard, plug it back in, lk201_init
	gets rerun, and viola! the keyboard works properly.

	(If you want the actual test code, preliminary diffs to the sfb
	driver and Xserver are at ftp://gro.hhhh.org/pub/perseant/sfb.)
>Fix:

Index: dec/zskbd.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/dec/zskbd.c,v
retrieving revision 1.4
diff -u -r1.4 zskbd.c
--- zskbd.c	1999/02/03 20:22:28	1.4
+++ zskbd.c	1999/09/15 19:19:10
@@ -207,7 +207,6 @@
 				       M_DEVBUF, M_NOWAIT);
 		zsi->zsi_ks.attmt.sendchar = zskbd_sendchar;
 		zsi->zsi_ks.attmt.cookie = cs;
-		lk201_init(&zsi->zsi_ks);
 		zsi->zsi_cs = cs;
 	}
 	zskbd->sc_itl = zsi;
@@ -224,6 +223,9 @@
 	(void) zs_set_speed(cs, ZSKBD_BPS);
 	zs_loadchannelregs(cs);
 	splx(s);
+
+	if(!isconsole)
+		lk201_init(&zsi->zsi_ks);
 
 	/* XXX should identify keyboard ID here XXX */
 	/* XXX layout and the number of LED is varying XXX */
>Audit-Trail:
>Unformatted: