From owner-freebsd-usb@FreeBSD.ORG Sun Oct 7 18:10:16 2012 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3ACC11065673 for ; Sun, 7 Oct 2012 18:10:16 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 140FC8FC22 for ; Sun, 7 Oct 2012 18:10:16 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q97IAFfX083064 for ; Sun, 7 Oct 2012 18:10:15 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q97IAFHb083063; Sun, 7 Oct 2012 18:10:15 GMT (envelope-from gnats) Resent-Date: Sun, 7 Oct 2012 18:10:15 GMT Resent-Message-Id: <201210071810.q97IAFHb083063@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-usb@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Vitaly Magerya Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6393B1065670 for ; Sun, 7 Oct 2012 18:04:06 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 34CB08FC08 for ; Sun, 7 Oct 2012 18:04:06 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.5/8.14.5) with ESMTP id q97I46S6077421 for ; Sun, 7 Oct 2012 18:04:06 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.5/8.14.5/Submit) id q97I45Ru077420; Sun, 7 Oct 2012 18:04:05 GMT (envelope-from nobody) Message-Id: <201210071804.q97I45Ru077420@red.freebsd.org> Date: Sun, 7 Oct 2012 18:04:05 GMT From: Vitaly Magerya To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: usb/172458: Make uhid(4) attach to mice and keyboards with UQ_{UMS, KBD}_IGNORE quirks X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 18:10:16 -0000 >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: