usb/172458: Make uhid(4) attach to mice and keyboards with UQ_{UMS,
KBD}_IGNORE quirks
Vitaly Magerya
vmagerya at gmail.com
Sun Oct 7 18:10:16 UTC 2012
>Number: 172458
>Category: usb
>Synopsis: Make uhid(4) attach to mice and keyboards with UQ_{UMS,KBD}_IGNORE quirks
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-usb
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sun Oct 07 18:10:15 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Vitaly Magerya
>Release: FreeBSD 9.1-RC1 amd64
>Organization:
>Environment:
>Description:
The uhid(4) driver that can attach to the same devices that
ums(4) and ukbd(4) can. Since uhid should generally be used as
a fallback, it performs this check:
/*
* Don't attach to mouse and keyboard devices, hence then no
* "nomatch" event is generated and then ums and ukbd won't
* attach properly when loaded.
*/
if ((uaa->info.bInterfaceClass == UICLASS_HID) &&
(uaa->info.bInterfaceSubClass == UISUBCLASS_BOOT) &&
((uaa->info.bInterfaceProtocol == UIPROTO_BOOT_KEYBOARD) ||
(uaa->info.bInterfaceProtocol == UIPROTO_MOUSE))) {
return (ENXIO);
}
The problem here is that we have UQ_KBD_IGNORE and UQ_UMS_IGNORE
quirks that prevent ukbd and ums from attaching -- if such a
quirk is set, it may be the case that because of this check no
driver will attach to the device, while uhid should take over
in such a case.
>How-To-Repeat:
>Fix:
The proper fix would be to remove the above check altogether and
somehow ensure that uhid is given lower priority than ukbd and
ums. Since I don't really know how to do that, I propose just
testing for UQ_KBD_IGNORE and UQ_UMS_IGNORE quirks in uhid too.
Patch attached with submission follows:
Index: sys/dev/usb/input/uhid.c
===================================================================
--- sys/dev/usb/input/uhid.c (revision 241311)
+++ sys/dev/usb/input/uhid.c (working copy)
@@ -691,8 +691,10 @@
*/
if ((uaa->info.bInterfaceClass == UICLASS_HID) &&
(uaa->info.bInterfaceSubClass == UISUBCLASS_BOOT) &&
- ((uaa->info.bInterfaceProtocol == UIPROTO_BOOT_KEYBOARD) ||
- (uaa->info.bInterfaceProtocol == UIPROTO_MOUSE))) {
+ (((uaa->info.bInterfaceProtocol == UIPROTO_BOOT_KEYBOARD) &&
+ !usb_test_quirk(uaa, UQ_KBD_IGNORE)) ||
+ ((uaa->info.bInterfaceProtocol == UIPROTO_MOUSE) &&
+ !usb_test_quirk(uaa, UQ_UMS_IGNORE)))) {
return (ENXIO);
}
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-usb
mailing list