kern/80383: [PATCH] Add quirk for uhid to ignore certain usb devices (blacklist)

Lonnie Mendez lmendez19 at austin.rr.com
Tue Apr 26 18:00:44 PDT 2005


>Number:         80383
>Category:       kern
>Synopsis:       [PATCH] Add quirk for uhid to ignore certain usb devices (blacklist)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 27 01:00:42 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Lonnie Mendez
>Release:        FreeBSD 5.3-RELEASE-p10 i386
>Organization:
>Environment:
System: FreeBSD twind.austin.rr.com 5.3-RELEASE-p10 FreeBSD 5.3-RELEASE-p10 #3: Tue Apr 26 07:46:25 CDT 2005 root at twind.austin.rr.com:/usr/src/sys/i386/compile/MINIME i386


	
>Description:

	This patch allows uhid to leave alone devices that identify themselves as hid based, but are indeed
used via another interface.  This is very simliar in concept to the hid blacklist table found in hid-core.c
in the linux kernel.
	
>How-To-Repeat:
	
	Applies to 5.3/FreeBSD-CURRENT kernel.  Runtime tested.
	
>Fix:

	

--- hid_blacklist.patch begins here ---
diff -u -r ./uhid.c hidpatch/uhid.c
--- ./uhid.c	Tue Oct 12 19:51:01 2004
+++ hidpatch/uhid.c	Tue Apr 26 07:40:07 2005
@@ -91,6 +91,9 @@
 /* Report descriptor for broken Wacom Graphire */
 #include <dev/usb/ugraphire_rdesc.h>
 
+/* For hid blacklist quirk */
+#include <dev/usb/usb_quirks.h>
+
 #ifdef USB_DEBUG
 #define DPRINTF(x)	if (uhiddebug) logprintf x
 #define DPRINTFN(n,x)	if (uhiddebug>(n)) logprintf x
@@ -190,6 +193,8 @@
 		return (UMATCH_NONE);
 	id = usbd_get_interface_descriptor(uaa->iface);
 	if (id == NULL || id->bInterfaceClass != UICLASS_HID)
+		return (UMATCH_NONE);
+	if (usbd_get_quirks(uaa->device)->uq_flags & UQ_HID_IGNORE)
 		return (UMATCH_NONE);
 #if 0
 	if (uaa->matchlvl)
diff -u -r ./usb_quirks.c hidpatch/usb_quirks.c
--- ./usb_quirks.c	Mon Sep 20 00:18:04 2004
+++ hidpatch/usb_quirks.c	Tue Apr 26 03:24:12 2005
@@ -101,6 +101,9 @@
 	ANY, { UQ_ASSUME_CM_OVER_DATA }},
  { USB_VENDOR_SUNTAC, USB_PRODUCT_SUNTAC_AS64LX,
 	0x100, { UQ_ASSUME_CM_OVER_DATA }},
+ /* Devices which should be ignored by uhid */
+ { USB_VENDOR_DELORME, USB_PRODUCT_DELORME_EARTHMATE,
+	ANY, { UQ_HID_IGNORE }},
  { 0, 0, 0, { 0 } }
 };
 
diff -u -r ./usb_quirks.h hidpatch/usb_quirks.h
--- ./usb_quirks.h	Thu Jul  5 05:12:59 2001
+++ hidpatch/usb_quirks.h	Tue Apr 26 07:41:18 2005
@@ -54,6 +54,7 @@
 #define UQ_AU_INP_ASYNC	0x0800	/* input is async despite claim of adaptive */
 #define UQ_ASSUME_CM_OVER_DATA 0x1000 /* modem device breaks on cm over data */
 #define UQ_BROKEN_BIDIR	0x2000	/* printer has broken bidir mode */
+#define UQ_HID_IGNORE   0x4000  /* device should be ignored by hid class */
 };
 
 extern const struct usbd_quirks usbd_no_quirk;
--- hid_blacklist.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list