USB Keyboard puzzle

Rohit Grover rgrover1 at gmail.com
Fri Apr 9 14:54:40 UTC 2010


Hello Dear Hackers,

This is about a puzzling behaviour which has affected me for quite
some time now and has caused far too many unwanted reboots on my
Macbook (running FreeBSD).

The problem appeared around when I transitioned from using 8.0/Release
8.0/STABLE; although I am not a 100% sure of that. If I were to switch
back to 8.0/Release, things would work normally; but then many
significant and necessary changes have gone into 8.0/STABLE and I do
not have the option of reverting to 8.0/Release.

It has to do with the software around the USB keyboard. When booting a
derivative of 8.0/Stable, about half the time my laptop boots into a
state where the keyboard is unresponsive; i.e. keystrokes have no
effect; and thus this condition forces me into a wasteful reboot. This
state is very likely to reproduce if I do a cold boot.
I have also discovered that if I boot the laptop with MacOSX, and then
subsequently reboot into FreeBSD, I have a high chance of getting a
usable keyboard.

I had previously suspected changes to code in the ukbd driver. But now
I have confirmed for myself that ukbd is sane--I did this by adding
printfs to the data-flow path, and ensured that the read_char()
device-switch handler within ukbd is correctly able to return key
scan-codes even when my keyboard appears to be dead.

I have also noticed that in the cases where my keyboard appears to be
unresponsive, ukbd attaches as two separate instances: ukbd0 and
ukbd1:

<verbatim>
Apr  9 19:20:35 macbook kernel: ugen0.2: <vendor 0x05ac> at usbus0
Apr  9 19:20:35 macbook kernel: ukbd0: <vendor 0x05ac product 0x1000,
class 0/0, rev 2.00/19.65, addr 2> on usbus0
Apr  9 19:20:35 macbook kernel: kbd0 at ukbd0
Apr  9 19:20:35 macbook kernel: Root mount waiting for: usbus6
Apr  9 19:20:35 macbook kernel: Trying to mount root from ufs:/dev/ad6p3a
Apr  9 19:20:35 macbook kernel: ugen5.2: <Apple Computer, Inc.> at usbus5
Apr  9 19:20:35 macbook kernel: GEOM_PART: Partition 'ad6p3' not
suitable for kernel dumps (wrong type?)
Apr  9 19:20:35 macbook kernel: ugen5.3: <Apple Computer> at usbus5
Apr  9 19:20:35 macbook kernel: ukbd1: <Apple Internal Keyboard> on usbus5
Apr  9 19:20:35 macbook kernel: kbd1 at ukbd1
</verbatim>

whereas when the keyboard boots in an OK state, I see the following
during boot--there is only ukbd0 and no ukbd1:

<verbatim>
Apr  9 19:23:21 macbook kernel: ugen5.3: <Apple Computer> at usbus5
Apr  9 19:23:21 macbook kernel: ukbd0: <Apple Internal Keyboard> on usbus5
Apr  9 19:23:21 macbook kernel: kbd0 at ukbd0
</verbatim>

I have attached my config file, and the dmesg dump from the good and bad cases.

Could you please help me figure out what's going on with my keyboard?

thanks,
Rohit.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MACBOOK
Type: application/octet-stream
Size: 12783 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-usb/attachments/20100409/cb05e60c/MACBOOK-0001.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dmesg.good
Type: application/octet-stream
Size: 17147 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-usb/attachments/20100409/cb05e60c/dmesg-0002.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dmesg.bad
Type: application/octet-stream
Size: 16414 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-usb/attachments/20100409/cb05e60c/dmesg-0003.obj


More information about the freebsd-usb mailing list