On 09:01 Sat 18 Dec, Jacob Meuser wrote:
> On Sat, Dec 18, 2010 at 08:48:10AM +0000, Jacob Meuser wrote:
> > On Sat, Dec 18, 2010 at 10:14:54AM +0200, Vladimir Kirillov wrote:
> > > Hello, t...@!
> > > 
> > > Since a lot of HP usb printers work badly (or do not work at all)
> > > with ulpt and they want all cups and hplip goo, I've added a
> > > new UQ_SHOULD_UGEN quirk to let ulpt(4) know when to skip the device.
> > 
> > I suggested a quirk to choose ugen recently and there was some
> > resistence.
> 
> and looking at your patch ... if there will be a quirk that says
> to attach at ugen, it should really make it attach at ugen, immediately,
> and not be a flag to be used in other drivers.

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

Reply via email to