On 09:01 Sat 18 Dec, Jacob Meuser wrote:
Agree. I've tweaked the diff to hook into usbd_probe_and_attach().
By the way, if we'll be checking for quirks and such an early stage,
we could add the quirks field to usb_attach_arg to avoid calling
usbd_get_quirks() in future, right?
Index: usb_subr.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/usb_subr.c,v
retrieving revision 1.77
diff -u -p -r1.77 usb_subr.c
--- usb_subr.c 17 Dec 2010 22:38:54 -0000 1.77
+++ usb_subr.c 18 Dec 2010 09:29:49 -0000
@@ -878,7 +905,6 @@ usbd_probe_and_attach(struct device *par
uaa.iface = NULL;
uaa.ifaces = NULL;
uaa.nifaces = 0;
- uaa.usegeneric = 0;
uaa.port = port;
uaa.configno = UHUB_UNK_CONFIGURATION;
uaa.ifaceno = UHUB_UNK_INTERFACE;
@@ -886,6 +912,11 @@ usbd_probe_and_attach(struct device *par
uaa.product = UGETW(dd->idProduct);
uaa.release = UGETW(dd->bcdDevice);
+ /* test for generic quirk early */
+ uaa.usegeneric = usbd_get_quirks(dev)->uq_flags & UQ_SHOULD_UGEN;
+ if (uaa.usegeneric)
+ goto trygeneric;
+
/* First try with device specific drivers. */
DPRINTF(("usbd_probe_and_attach trying device specific drivers\n"));
dv = config_found_sm(parent, &uaa, usbd_print, usbd_submatch);
@@ -972,8 +1003,9 @@ usbd_probe_and_attach(struct device *par
DPRINTF(("usbd_probe_and_attach: no interface drivers found\n"));
/* Finally try the generic driver. */
- uaa.iface = NULL;
uaa.usegeneric = 1;
+trygeneric:
+ uaa.iface = NULL;
uaa.configno = UHUB_UNK_CONFIGURATION;
uaa.ifaceno = UHUB_UNK_INTERFACE;
dv = config_found_sm(parent, &uaa, usbd_print, usbd_submatch);
Index: usb_quirks.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/usb_quirks.c,v
retrieving revision 1.63
diff -u -p -r1.63 usb_quirks.c
--- usb_quirks.c 2 Dec 2010 06:39:09 -0000 1.63
+++ usb_quirks.c 18 Dec 2010 09:29:48 -0000
@@ -104,6 +104,7 @@ const struct usbd_quirk_entry {
{ USB_VENDOR_HP, USB_PRODUCT_HP_816C, ANY, { UQ_BROKEN_BIDIR }},
{ USB_VENDOR_HP, USB_PRODUCT_HP_959C, ANY, { UQ_BROKEN_BIDIR }},
{ USB_VENDOR_HP, USB_PRODUCT_HP_1220C, ANY, { UQ_BROKEN_BIDIR }},
+ { USB_VENDOR_HP, USB_PRODUCT_HP_LJ1010, ANY, { UQ_SHOULD_UGEN }},
{ USB_VENDOR_NEC, USB_PRODUCT_NEC_PICTY900, ANY, { UQ_BROKEN_BIDIR }},
{ USB_VENDOR_NEC, USB_PRODUCT_NEC_PICTY760, ANY, { UQ_BROKEN_BIDIR }},
{ USB_VENDOR_NEC, USB_PRODUCT_NEC_PICTY920, ANY, { UQ_BROKEN_BIDIR }},
Index: usb_quirks.h
===================================================================
RCS file: /cvs/src/sys/dev/usb/usb_quirks.h,v
retrieving revision 1.16
diff -u -p -r1.16 usb_quirks.h
--- usb_quirks.h 19 Jul 2010 05:08:37 -0000 1.16
+++ usb_quirks.h 18 Dec 2010 09:29:48 -0000
@@ -49,6 +49,8 @@ struct usbd_quirks {
#define UQ_MS_LEADING_BYTE 0x00010000 /* mouse sends unknown leading byte */
#define UQ_EHCI_NEEDTO_DISOWN 0x00020000 /* must hand device over to USB 1.1
if attached to EHCI */
+#define UQ_SHOULD_UGEN 0x00040000 /* device should not be matched by any
+ specific driver */
};
extern const struct usbd_quirks usbd_no_quirk;
Index: usbdevs
===================================================================
RCS file: /cvs/src/sys/dev/usb/usbdevs,v
retrieving revision 1.533
diff -u -p -r1.533 usbdevs
--- usbdevs 17 Dec 2010 21:00:13 -0000 1.533
+++ usbdevs 18 Dec 2010 09:29:49 -0000
@@ -1913,6 +1913,7 @@ product HP 840C 0x0604 DeskJet 840c
product HP 2200C 0x0605 ScanJet 2200C
product HP 5300C 0x0701 Scanjet 5300C
product HP 816C 0x0804 DeskJet 816C
+product HP LJ1010 0x0c17 LaserJet 1010
product HP 970CSE 0x1004 Deskjet 970Cse
product HP 5400C 0x1005 Scanjet 5400C
product HP 2215 0x1016 iPAQ 22xx/Jornada 548