Subject: Adding an usb quirk flag for some hid devices (was: prototype in GENERIC for APC UPS?)
To: None <tech-kern@NetBSD.org>
From: Bernd Ernesti <veego@NetBSD.org>
List: tech-kern
Date: 06/24/2007 12:22:02
--BXVAT5kNtrzKuDFl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Comming back to an 'older' thread.

[I added some people from the old thread as a cc to get more attention]

On Sun, May 13, 2007 at 04:22:28PM +0200, Bernd Ernesti wrote:
> On Mon, Apr 23, 2007 at 09:20:30PM +0000, Christos Zoulas wrote:
> [..]
> 
> > >kern/31884
> > >
> > >Attached is an updated patch for -current (don't forget to regen usbdevs_data.h
> > >and usbdevs.h), which I use now for several months.
> > >
> > >ugen0 at uhub0 port 2
> > >ugen0: American Power Conversion Back-UPS RS 1500 FW:8.g8 .I USB FW:g8,
> > >rev 1.10/1.06, addr 3
> > 
> > I like it, but is there a better way to achieve the same effect?
> 
> I don't know, but I would really like to see this problem solved in the NetBSD
> src tree (so I don't end up with the conflicts every time someone changes
> something in sys/dev/usb/usbdevs).
> 
> Bernd

I would like to commit the missing changes from kern/31884 on July the 1st if
there are no objections by that. An updated patch of the missing parts
is attached to this mail.
The usbdevs changes where just commited by me.

Bernd


--BXVAT5kNtrzKuDFl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="31884.patch"

Index: uhidev.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/uhidev.c,v
retrieving revision 1.35
diff -b -u -r1.35 uhidev.c
--- uhidev.c	15 Mar 2007 15:11:54 -0000	1.35
+++ uhidev.c	24 Jun 2007 10:12:13 -0000
@@ -91,6 +91,8 @@
 
 	if (uaa->class != UICLASS_HID)
 		return (UMATCH_NONE);
+	if (usbd_get_quirks(uaa->device)->uq_flags & UQ_HID_IGNORE)
+		return (UMATCH_NONE);
 	return (UMATCH_IFACECLASS_GENERIC);
 }
 
Index: usb_quirks.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usb_quirks.c,v
retrieving revision 1.56
diff -b -u -r1.56 usb_quirks.c
--- usb_quirks.c	10 Feb 2007 14:28:55 -0000	1.56
+++ usb_quirks.c	24 Jun 2007 10:12:13 -0000
@@ -61,6 +61,11 @@
 	u_int16_t bcdDevice;
 	struct usbd_quirks quirks;
 } usb_quirks[] = {
+ /* Devices which should be ignored by uhid */
+ { USB_VENDOR_APC, USB_PRODUCT_APC_UPS,		    ANY,   { UQ_HID_IGNORE }},
+ { USB_VENDOR_MGE, USB_PRODUCT_MGE_UPS1,	    ANY,   { UQ_HID_IGNORE }},
+ { USB_VENDOR_MGE, USB_PRODUCT_MGE_UPS2,	    ANY,   { UQ_HID_IGNORE }},
+
  { USB_VENDOR_KYE, USB_PRODUCT_KYE_NICHE,	    0x100, { UQ_NO_SET_PROTO}},
  { USB_VENDOR_INSIDEOUT, USB_PRODUCT_INSIDEOUT_EDGEPORT4,
    						    0x094, { UQ_SWAP_UNICODE}},
Index: usb_quirks.h
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usb_quirks.h,v
retrieving revision 1.21
diff -b -u -r1.21 usb_quirks.h
--- usb_quirks.h	19 Jan 2007 22:42:05 -0000	1.21
+++ usb_quirks.h	24 Jun 2007 10:12:13 -0000
@@ -52,6 +52,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;

--BXVAT5kNtrzKuDFl--