Subject: XT/AT keyboard and wskbd protocol
To: None <>
From: Arto Huusko <>
List: tech-x11
Date: 10/18/2007 16:29:22

I've been trying to get X11 working on a TP T61p laptop, and the latest
problem I have is with keyboard configuration.

The keyboard is attached like this:

pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard
wskbd0 at pckbd0: console keyboard, using wsdisplay0

And "wsconsctl type" has this to say:


I initially configured the keyboard like this:

Section "InputDevice"
         Identifier  "Keyboard0"
         Driver      "kbd"
         Option "Protocol" "wskbd"
         Option "Device" "/dev/wskbd"
         Option      "XkbLayout" "fi"

This led to the bizarre result that cursor keys, among other special
keys, simply did not work at all. I bashed my head against the wall
for a few days, until I finally figured it out.

As far as I can see, wskbd protocol and AT/XT keyboard has no chance
of working correctly.

The problem is this: when wskbd protocol is used, X's BSD kbd driver reads
wskbd_events, and passes the scancode to system independent X kbd
event handler. This event handler then maps the scancode to X11 scancode
using procedure provided by the BSD kbd driver. With wskbd protocol and
AT/XT keyboard, BSD driver provides the default ATScancode converter that
maps AT/XT scancodes to X11 scancodes.

However, the scancodes X reads from wskbd, which gets them from pckbd,
are *not* AT/XT scancodes. (See pckbd_decode() in sys/dev/pckbport/pckbd.c)

I think the wskbd protocol of BSD kbd driver needs similar mapping tables
for XT/AT keyboards as it has for USB keyboards. At least the driver should,
for the time being, error out if trying to use wskbd and AT/XT keyboard.

Another option is for the kernel to provide raw event mode: data read
from keyboard is events, but the scancodes in events are raw scancodes.

Of course BSD kbd driver works just fine without the wskbd protocol, reading
raw data from console. (Configuration just wihtouth Protocol and Device