Subject: Huh? Why does wscons say I have an XT keyboard?
To: None <tech-kern@netbsd.org>
From: None <kpneal@pobox.com>
List: tech-kern
Date: 11/08/2001 22:36:13
So, I'm digging through a core dump of XalphaNetBSD trying to
figure out why it crashes on startup. I'm on an AXPpci33 with an
IBM PS/2-style keyboard going through a low end Belkin switchbox.

I narrowed the crash down to the server trying to use the pointer at
alphaModMaps[alphaKbdPriv.type]. Now, alphaModMaps is a table
of pointers to scancode tables. The pointers in the array correspond
to the keyboard types in /usr/include/dev/wsconsio.h. 

The variable alphaKbdPriv.type is set by ioctl WSKBDIO_GTYPE
and the value returned is 3. 

Uh:

/usr/include/dev/wscons/wsconsio.h:#define		WSKBD_TYPE_PC_XT	3	/* PC-ish, XT scancode */
/usr/include/dev/wscons/wsconsio.h:#define		WSKBD_TYPE_PC_AT	4	/* PC-ish, AT scancode */

In sys/dev/pckbc/pckbd.c's pckbd_ioctl we find:

	switch (cmd) {
	    case WSKBDIO_GTYPE:
		*(int *)data = WSKBD_TYPE_PC_XT;
		return 0;

Yet alphaModMaps looks like this:

AlphaModmapRec *alphaModMaps[] = {
    NULL,
    lk201modmap,
    lk201modmap,
    NULL,        /* 3 */
    xf86modmap,  /* 4 */
    NULL,
};

Why does the keyboard driver claim to have an XT keyboard attached?
Or is XalphaNetBSD wrong to assume there is no XT keyboard?

Is the correct fix to change what pckbd.c returns or is it correct
to change XalphaNetBSD's table? 
-- 
Kevin P. Neal                                http://www.pobox.com/~kpn/

"It sounded pretty good, but it's hard to tell how it will work out
in practice." -- Dennis Ritchie, ~1977, "Summary of a DEC 32-bit machine"