Problems trying wireless keyboard/mouse

Steve O'Hara-Smith steve at
Wed Apr 30 09:27:44 PDT 2008


	I'm trying out a wireless keyboard/mouse device (actually the mouse
is a trackball - device is this one:

	I'm running a recent preview and out of the box the keyboard is
recognised and works but the trackball shows up as uhid0 - A little
searching led me to the patch below (adapted from a FreeBSD PR) which makes
hid_is_collection loop looking for a match instead of just checking the
first device.

	With this in place I get ukbd and ums devices recognised and moused
accepts the device and runs. All is well right up until the moment I touch
the trackball - no mouse pointer movement and the keyboard stops working
too! I'm guessing that uhidev isn't routing the data correctly and messing
up the keyboard driver by feeding it mouse data.

	So questions - 

	Where is the uhidev code hiding ?
	Is there an useful debug I can turn on ? 
	Is the only way to unjam it really a reboot ?
	NetBSD has a more sophisticated variant of the code below - should
we import it ?

	Oh yes - I don't consider this patch complete - it doesn't handle
error returns from hid_get_item.

RCS file: /home/dcvs/src/sys/bus/usb/hid.c,v
retrieving revision 1.13
diff -u -r1.13 hid.c
--- sys/bus/usb/hid.c   28 Jun 2007 13:55:12 -0000      1.13
+++ sys/bus/usb/hid.c   30 Apr 2008 15:07:21 -0000
@@ -453,9 +453,13 @@
        if (hd == NULL)
                return (0);
-       err = hid_get_item(hd, &hi) &&
-           hi.kind == hid_collection &&
-           hi.usage == usage;
+       err = 0;
+       while (0 < hid_get_item(hd, &hi)) {
+               if (hi.kind == hid_collection && hi.usage == usage) {
+                       err = 1;
+                       break;
+               }
+       }
        return (err);

C:>WIN                                      |   Directable Mirror Arrays
The computer obeys and wins.                | A better way to focus the sun
You lose and Bill collects.                 |    licences available see

More information about the Users mailing list