svn commit: r194067 - head/sys/dev/usb/input
Andrew Thompson
thompsa at FreeBSD.org
Fri Jun 12 16:03:39 UTC 2009
Author: thompsa
Date: Fri Jun 12 16:03:38 2009
New Revision: 194067
URL: http://svn.freebsd.org/changeset/base/194067
Log:
Check for a keyboard HID report in addition to the interface class so devices
such as the Yubikey attach.
Submitted by: Hans Petter Selasky
Reported by: Jeremy Faulkner
Modified:
head/sys/dev/usb/input/ukbd.c
Modified: head/sys/dev/usb/input/ukbd.c
==============================================================================
--- head/sys/dev/usb/input/ukbd.c Fri Jun 12 16:00:42 2009 (r194066)
+++ head/sys/dev/usb/input/ukbd.c Fri Jun 12 16:03:38 2009 (r194067)
@@ -659,6 +659,9 @@ ukbd_probe(device_t dev)
{
keyboard_switch_t *sw = kbd_get_switch(UKBD_DRIVER_NAME);
struct usb_attach_arg *uaa = device_get_ivars(dev);
+ void *d_ptr;
+ int error;
+ uint16_t d_len;
DPRINTFN(11, "\n");
@@ -668,16 +671,35 @@ ukbd_probe(device_t dev)
if (uaa->usb_mode != USB_MODE_HOST) {
return (ENXIO);
}
- /* check that the keyboard speaks the boot protocol: */
- if ((uaa->info.bInterfaceClass == UICLASS_HID)
- && (uaa->info.bInterfaceSubClass == UISUBCLASS_BOOT)
- && (uaa->info.bInterfaceProtocol == UPROTO_BOOT_KEYBOARD)) {
+
+ if (uaa->info.bInterfaceClass != UICLASS_HID)
+ return (ENXIO);
+
+ if ((uaa->info.bInterfaceSubClass == UISUBCLASS_BOOT) &&
+ (uaa->info.bInterfaceProtocol == UPROTO_BOOT_KEYBOARD)) {
if (usb2_test_quirk(uaa, UQ_KBD_IGNORE))
return (ENXIO);
else
return (0);
}
- return (ENXIO);
+
+ error = usb2_req_get_hid_desc(uaa->device, NULL,
+ &d_ptr, &d_len, M_TEMP, uaa->info.bIfaceIndex);
+
+ if (error)
+ return (ENXIO);
+
+ if (hid_is_collection(d_ptr, d_len,
+ HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_KEYBOARD))) {
+ if (usb2_test_quirk(uaa, UQ_KBD_IGNORE))
+ error = ENXIO;
+ else
+ error = 0;
+ } else
+ error = ENXIO;
+
+ free(d_ptr, M_TEMP);
+ return (error);
}
static int
More information about the svn-src-head
mailing list