Re: new usb quirk and gps device id that needs it
On Thu, Feb 10, 2011 at 02:21:23AM -0800, Daniel C. Sinclair wrote: > On Wed, Feb 9, 2011 at 10:52 PM, Jacob Meuser > wrote: > > this actually works? could you please send usbctl (from the usbutil > > package) output for this device? I don't like adding more quirks. > > if the device has the bulk endpoints in the control interface, then the > > requirement that the endpoints be in a different interface is overly > > restrictive. > > DEVICE addr 2 > DEVICE descriptor: > bLength=18 bDescriptorType=device(1) bcdUSB=2.00 bDeviceClass=2 > bDeviceSubClass=0 > bDeviceProtocol=0 bMaxPacketSize=64 idVendor=0x0e8d idProduct=0x3329 > bcdDevice=100 > iManufacturer=3(MTK) iProduct=4(GPS Receiver) iSerialNumber=0() > bNumConfigurations=1 > > CONFIGURATION descriptor 0: > bLength=9 bDescriptorType=config(2) wTotalLength=67 bNumInterface=2 > bConfigurationValue=1 iConfiguration=0() bmAttributes=80 bMaxPower=500 mA > > INTERFACE descriptor 0: > bLength=9 bDescriptorType=interface(4) bInterfaceNumber=0 bAlternateSetting=0 > bNumEndpoints=2 bInterfaceClass=10 bInterfaceSubClass=0 > bInterfaceProtocol=0 iInterface=1(GPS COM(data_if)) > > ENDPOINT descriptor: > bLength=7 bDescriptorType=endpoint(5) bEndpointAddress=1-in > bmAttributes=bulk wMaxPacketSize=64 bInterval=0 > > ENDPOINT descriptor: > bLength=7 bDescriptorType=endpoint(5) bEndpointAddress=1-out > bmAttributes=bulk wMaxPacketSize=64 bInterval=0 > > INTERFACE descriptor 1: > bLength=28 bDescriptorType=interface(4) bInterfaceNumber=1 > bAlternateSetting=0 > bNumEndpoints=1 bInterfaceClass=2 bInterfaceSubClass=2 > bInterfaceProtocol=1 iInterface=2(GPS COM(comm_if)) > > ENDPOINT descriptor: > bLength=7 bDescriptorType=endpoint(5) bEndpointAddress=2-in > bmAttributes=interrupt wMaxPacketSize=64 bInterval=1 > > current configuration 1 > > -- does the following work for you? -- jake...@sdf.lonestar.org SDF Public Access UNIX System - http://sdf.lonestar.org Index: umodem.c === RCS file: /cvs/src/sys/dev/usb/umodem.c,v retrieving revision 1.41 diff -u -p umodem.c --- umodem.c25 Jan 2011 20:03:36 - 1.41 +++ umodem.c11 Feb 2011 16:34:47 - @@ -170,9 +170,11 @@ umodem_get_caps(struct usb_attach_arg *uaa, int ctl_if const usb_cdc_cm_descriptor_t *cmd; const usb_cdc_acm_descriptor_t *acmd; const usb_cdc_union_descriptor_t *uniond; + const usb_endpoint_descriptor_t *ed; usbd_desc_iter_t iter; - int current_iface_no = -1; + int bulkin, bulkout, current_iface_no; + *data_iface_no = current_iface_no = bulkin = bulkout = -1; *cm_cap = *acm_cap = 0; usb_desc_iter_init(uaa->device, &iter); desc = usb_desc_iter_next(&iter); @@ -198,9 +200,26 @@ umodem_get_caps(struct usb_attach_arg *uaa, int ctl_if *data_iface_no = uniond->bSlaveInterface[0]; break; } + } else if (current_iface_no == ctl_iface_no && + desc->bDescriptorType == UDESC_CS_ENDPOINT) { + ed = (usb_endpoint_descriptor_t *)desc; + if (UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { + if (UE_GET_DIR(ed->bEndpointAddress) == + UE_DIR_IN) + bulkin = ed->bEndpointAddress; + else + bulkout = ed->bEndpointAddress; + } } desc = usb_desc_iter_next(&iter); } + + /* +* Usually, there is a separate data interface. However, some +* devices have the bulk data endpoints in the control interface. +*/ + if (*data_iface_no == -1 && (bulkin != -1 && bulkout != -1)) + *data_iface_no = ctl_iface_no; } int @@ -234,10 +253,13 @@ umodem_match(struct device *parent, void *match, void if (ret == UMATCH_NONE) return (ret); - /* umodem doesn't yet support devices without a data iface */ + /* +* Check that either the bulk endpoints are in the control interface +* or that there is a data interface. +*/ umodem_get_caps(uaa, id->bInterfaceNumber, &data_iface_no, &cm_cap, &acm_cap); - if (data_iface_no == 0) + if (data_iface_no == -1) ret = UMATCH_NONE; return (ret); @@ -267,8 +289,8 @@ umodem_attach(struct device *parent, struct device *se /* Get the capabilities. */ umodem_get_caps(uaa, id->bInterfaceNumber, &data_iface_no, &sc->sc_cm_cap, &sc->sc_acm_cap); - if (data_iface_no == 0) { - printf("%s: no pointer to data interface\n", + if (data_iface_no == -1) { + printf("%s: no interface with bulk endpoints\n", sc->sc_dev.d
Re: new usb quirk and gps device id that needs it
On Wed, Feb 9, 2011 at 10:52 PM, Jacob Meuser wrote: > this actually works? could you please send usbctl (from the usbutil > package) output for this device? I don't like adding more quirks. > if the device has the bulk endpoints in the control interface, then the > requirement that the endpoints be in a different interface is overly > restrictive. DEVICE addr 2 DEVICE descriptor: bLength=18 bDescriptorType=device(1) bcdUSB=2.00 bDeviceClass=2 bDeviceSubClass=0 bDeviceProtocol=0 bMaxPacketSize=64 idVendor=0x0e8d idProduct=0x3329 bcdDevice=100 iManufacturer=3(MTK) iProduct=4(GPS Receiver) iSerialNumber=0() bNumConfigurations=1 CONFIGURATION descriptor 0: bLength=9 bDescriptorType=config(2) wTotalLength=67 bNumInterface=2 bConfigurationValue=1 iConfiguration=0() bmAttributes=80 bMaxPower=500 mA INTERFACE descriptor 0: bLength=9 bDescriptorType=interface(4) bInterfaceNumber=0 bAlternateSetting=0 bNumEndpoints=2 bInterfaceClass=10 bInterfaceSubClass=0 bInterfaceProtocol=0 iInterface=1(GPS COM(data_if)) ENDPOINT descriptor: bLength=7 bDescriptorType=endpoint(5) bEndpointAddress=1-in bmAttributes=bulk wMaxPacketSize=64 bInterval=0 ENDPOINT descriptor: bLength=7 bDescriptorType=endpoint(5) bEndpointAddress=1-out bmAttributes=bulk wMaxPacketSize=64 bInterval=0 INTERFACE descriptor 1: bLength=28 bDescriptorType=interface(4) bInterfaceNumber=1 bAlternateSetting=0 bNumEndpoints=1 bInterfaceClass=2 bInterfaceSubClass=2 bInterfaceProtocol=1 iInterface=2(GPS COM(comm_if)) ENDPOINT descriptor: bLength=7 bDescriptorType=endpoint(5) bEndpointAddress=2-in bmAttributes=interrupt wMaxPacketSize=64 bInterval=1 current configuration 1 -- Daniel
Re: new usb quirk and gps device id that needs it
this actually works? could you please send usbctl (from the usbutil package) output for this device? I don't like adding more quirks. if the device has the bulk endpoints in the control interface, then the requirement that the endpoints be in a different interface is overly restrictive. On Wed, Feb 09, 2011 at 06:54:06PM -0800, Daniel C. Sinclair wrote: > Hello, I recently got a Qstarz BT-Q818XT GPS receiver > (http://www.qstarz.com/Products/GPS%20Products/BT-Q818XT-F.htm) which > contains an MTK vII/3329 chipset > (http://www.mediatek.com/en/product/info.php?sn=50). I got the > following when I plugged it into my laptop which is running > yesterday's snapshot: > > umodem0 at uhub1 port 2 configuration 1 interface 1 "MTK GPS Receiver" > rev 2.00/1.00 addr 2 > umodem0: no pointer to data interface > ugen0 at uhub1 port 2 configuration 1 "MTK GPS Receiver" rev 2.00/1.00 addr 2 > > I came up with some patches that make my GPS work and now I get the following: > > umodem0 at uhub1 port 2 configuration 1 interface 1 "MTK GPS Receiver" > rev 2.00/1.00 addr 2 > umodem0: data interface 0, has no CM over data, has no break > umodem0: status change notification available > ucom0 at umodem0 > > The first patch adds a new class of USB quirks: > > Index: usb_quirks.h > === > RCS file: /cvs/src/sys/dev/usb/usb_quirks.h,v > retrieving revision 1.16 > diff -u -r1.16 usb_quirks.h > --- usb_quirks.h 19 Jul 2010 05:08:37 - 1.16 > +++ usb_quirks.h 10 Feb 2011 01:37:18 - > @@ -49,6 +49,7 @@ > #define UQ_MS_LEADING_BYTE 0x0001 /* mouse sends unknown leading byte > */ > #define UQ_EHCI_NEEDTO_DISOWN0x0002 /* must hand device over to > USB 1.1 > if attached to EHCI */ > +#define UQ_NO_CDC_UNION 0x0004 /* no CDC UNION descriptor */ > }; > > extern const struct usbd_quirks usbd_no_quirk; > Index: umodem.c > === > RCS file: /cvs/src/sys/dev/usb/umodem.c,v > retrieving revision 1.41 > diff -u -r1.41 umodem.c > --- umodem.c 25 Jan 2011 20:03:36 - 1.41 > +++ umodem.c 10 Feb 2011 01:37:18 - > @@ -267,10 +267,13 @@ > /* Get the capabilities. */ > umodem_get_caps(uaa, id->bInterfaceNumber, &data_iface_no, > &sc->sc_cm_cap, &sc->sc_acm_cap); > - if (data_iface_no == 0) { > - printf("%s: no pointer to data interface\n", > -sc->sc_dev.dv_xname); > - goto bad; > + > + if (!(usbd_get_quirks(sc->sc_udev)->uq_flags & UQ_NO_CDC_UNION)) { > + if (data_iface_no == 0) { > + printf("%s: no pointer to data interface\n", > +sc->sc_dev.dv_xname); > + goto bad; > + } > } > > printf("%s: data interface %d, has %sCM over data, has %sbreak\n", > > > The second patch adds the vendor/device IDs and makes the GPS use the quirk: > > Index: usbdevs > === > RCS file: /cvs/src/sys/dev/usb/usbdevs,v > retrieving revision 1.540 > diff -u -r1.540 usbdevs > --- usbdevs 1 Feb 2011 18:23:59 - 1.540 > +++ usbdevs 10 Feb 2011 01:37:53 - > @@ -437,6 +437,7 @@ > vendor HAWKING 0x0e66 Hawking > vendor FOSSIL0x0e67 Fossil > vendor GMATE 0x0e7e G.Mate > +vendor MTK 0x0e8d MTK > vendor OTI 0x0ea0 Ours Technology > vendor PILOTECH 0x0eaf Pilotech > vendor NOVATECH 0x0eb0 Nova Tech > @@ -2565,6 +2566,9 @@ > > /* MDS products */ > product MDS ISDBT0x0001 MDS ISDB-T tuner > + > +/* MTK products */ > +product MTK VII3329 0x3329 vII/3329 GPS Receiver > > /* Meinberg Funkuhren products */ > product MEINBERG USB5131 0x0301 USB 5131 DCF77 - Radio Clock > Index: usb_quirks.c > === > RCS file: /cvs/src/sys/dev/usb/usb_quirks.c,v > retrieving revision 1.63 > diff -u -r1.63 usb_quirks.c > --- usb_quirks.c 2 Dec 2010 06:39:09 - 1.63 > +++ usb_quirks.c 10 Feb 2011 01:37:54 - > @@ -133,6 +133,8 @@ > { USB_VENDOR_VELLEMAN, USB_PRODUCT_VELLEMAN_K8055, ANY,{ UQ_BAD_HID }}, > { USB_VENDOR_DREAMLINK, USB_PRODUCT_DREAMLINK_ULMB1,ANY,{ > UQ_BAD_HID }}, > > + { USB_VENDOR_MTK, USB_PRODUCT_MTK_VII3329, ANY,{ UQ_NO_CDC_UNION }}, > + > { USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E220, ANY,{ UQ_NO_STRINGS > }}, > { USB_VENDOR_SHANTOU, USB_PRODUCT_SHANTOU_DM9601, ANY, { UQ_NO_STRINGS }}, > { USB_VENDOR_RALINK, USB_PRODUCT_RALINK_RT2573, ANY,{ UQ_NO_STRINGS > }}, > > > A very similar thing was done in NetBSD last year. See > http://www.mail-archive.com/source-changes-full@netbsd.org/msg15959.html > and http://www.mail-archi
new usb quirk and gps device id that needs it
Hello, I recently got a Qstarz BT-Q818XT GPS receiver (http://www.qstarz.com/Products/GPS%20Products/BT-Q818XT-F.htm) which contains an MTK vII/3329 chipset (http://www.mediatek.com/en/product/info.php?sn=50). I got the following when I plugged it into my laptop which is running yesterday's snapshot: umodem0 at uhub1 port 2 configuration 1 interface 1 "MTK GPS Receiver" rev 2.00/1.00 addr 2 umodem0: no pointer to data interface ugen0 at uhub1 port 2 configuration 1 "MTK GPS Receiver" rev 2.00/1.00 addr 2 I came up with some patches that make my GPS work and now I get the following: umodem0 at uhub1 port 2 configuration 1 interface 1 "MTK GPS Receiver" rev 2.00/1.00 addr 2 umodem0: data interface 0, has no CM over data, has no break umodem0: status change notification available ucom0 at umodem0 The first patch adds a new class of USB quirks: Index: usb_quirks.h === RCS file: /cvs/src/sys/dev/usb/usb_quirks.h,v retrieving revision 1.16 diff -u -r1.16 usb_quirks.h --- usb_quirks.h19 Jul 2010 05:08:37 - 1.16 +++ usb_quirks.h10 Feb 2011 01:37:18 - @@ -49,6 +49,7 @@ #define UQ_MS_LEADING_BYTE 0x0001 /* mouse sends unknown leading byte */ #define UQ_EHCI_NEEDTO_DISOWN 0x0002 /* must hand device over to USB 1.1 if attached to EHCI */ +#define UQ_NO_CDC_UNION0x0004 /* no CDC UNION descriptor */ }; extern const struct usbd_quirks usbd_no_quirk; Index: umodem.c === RCS file: /cvs/src/sys/dev/usb/umodem.c,v retrieving revision 1.41 diff -u -r1.41 umodem.c --- umodem.c25 Jan 2011 20:03:36 - 1.41 +++ umodem.c10 Feb 2011 01:37:18 - @@ -267,10 +267,13 @@ /* Get the capabilities. */ umodem_get_caps(uaa, id->bInterfaceNumber, &data_iface_no, &sc->sc_cm_cap, &sc->sc_acm_cap); - if (data_iface_no == 0) { - printf("%s: no pointer to data interface\n", - sc->sc_dev.dv_xname); - goto bad; + + if (!(usbd_get_quirks(sc->sc_udev)->uq_flags & UQ_NO_CDC_UNION)) { + if (data_iface_no == 0) { + printf("%s: no pointer to data interface\n", + sc->sc_dev.dv_xname); + goto bad; + } } printf("%s: data interface %d, has %sCM over data, has %sbreak\n", The second patch adds the vendor/device IDs and makes the GPS use the quirk: Index: usbdevs === RCS file: /cvs/src/sys/dev/usb/usbdevs,v retrieving revision 1.540 diff -u -r1.540 usbdevs --- usbdevs 1 Feb 2011 18:23:59 - 1.540 +++ usbdevs 10 Feb 2011 01:37:53 - @@ -437,6 +437,7 @@ vendor HAWKING 0x0e66 Hawking vendor FOSSIL 0x0e67 Fossil vendor GMATE 0x0e7e G.Mate +vendor MTK 0x0e8d MTK vendor OTI 0x0ea0 Ours Technology vendor PILOTECH0x0eaf Pilotech vendor NOVATECH0x0eb0 Nova Tech @@ -2565,6 +2566,9 @@ /* MDS products */ product MDS ISDBT 0x0001 MDS ISDB-T tuner + +/* MTK products */ +product MTK VII33290x3329 vII/3329 GPS Receiver /* Meinberg Funkuhren products */ product MEINBERG USB5131 0x0301 USB 5131 DCF77 - Radio Clock Index: usb_quirks.c === RCS file: /cvs/src/sys/dev/usb/usb_quirks.c,v retrieving revision 1.63 diff -u -r1.63 usb_quirks.c --- usb_quirks.c2 Dec 2010 06:39:09 - 1.63 +++ usb_quirks.c10 Feb 2011 01:37:54 - @@ -133,6 +133,8 @@ { USB_VENDOR_VELLEMAN, USB_PRODUCT_VELLEMAN_K8055,ANY,{ UQ_BAD_HID }}, { USB_VENDOR_DREAMLINK, USB_PRODUCT_DREAMLINK_ULMB1, ANY,{ UQ_BAD_HID }}, + { USB_VENDOR_MTK, USB_PRODUCT_MTK_VII3329,ANY,{ UQ_NO_CDC_UNION }}, + { USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E220, ANY,{ UQ_NO_STRINGS }}, { USB_VENDOR_SHANTOU, USB_PRODUCT_SHANTOU_DM9601, ANY, { UQ_NO_STRINGS }}, { USB_VENDOR_RALINK, USB_PRODUCT_RALINK_RT2573, ANY, { UQ_NO_STRINGS }}, A very similar thing was done in NetBSD last year. See http://www.mail-archive.com/source-changes-full@netbsd.org/msg15959.html and http://www.mail-archive.com/source-changes-full@netbsd.org/msg15960.html Daniel