PERFORCE change 164141 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Thu Jun 11 20:04:40 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=164141
Change 164141 by hselasky at hselasky_laptop001 on 2009/06/11 20:03:57
USB input:
- add support for Yubikey
- reported by Jeremy Faulkner
- improve mouse probe routine
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb/input/ukbd.c#18 edit
.. //depot/projects/usb/src/sys/dev/usb/input/ums.c#16 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb/input/ukbd.c#18 (text+ko) ====
@@ -659,6 +659,9 @@
{
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 @@
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
==== //depot/projects/usb/src/sys/dev/usb/input/ums.c#16 (text+ko) ====
@@ -332,7 +332,6 @@
ums_probe(device_t dev)
{
struct usb_attach_arg *uaa = device_get_ivars(dev);
- struct usb_interface_descriptor *id;
void *d_ptr;
int error;
uint16_t d_len;
@@ -342,11 +341,12 @@
if (uaa->usb_mode != USB_MODE_HOST)
return (ENXIO);
- id = usb2_get_interface_descriptor(uaa->iface);
+ if (uaa->info.bInterfaceClass != UICLASS_HID)
+ return (ENXIO);
- if ((id == NULL) ||
- (id->bInterfaceClass != UICLASS_HID))
- return (ENXIO);
+ if ((uaa->info.bInterfaceSubClass == UISUBCLASS_BOOT) &&
+ (uaa->info.bInterfaceProtocol == UIPROTO_MOUSE))
+ return (0);
error = usb2_req_get_hid_desc(uaa->device, NULL,
&d_ptr, &d_len, M_TEMP, uaa->info.bIfaceIndex);
@@ -357,9 +357,6 @@
if (hid_is_collection(d_ptr, d_len,
HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_MOUSE)))
error = 0;
- else if ((id->bInterfaceSubClass == UISUBCLASS_BOOT) &&
- (id->bInterfaceProtocol == UIPROTO_MOUSE))
- error = 0;
else
error = ENXIO;
More information about the p4-projects
mailing list