diff options
author | drochner <drochner@pkgsrc.org> | 2007-02-26 11:54:55 +0000 |
---|---|---|
committer | drochner <drochner@pkgsrc.org> | 2007-02-26 11:54:55 +0000 |
commit | 5000fc18c1d1abf3974b63729808fcd052848437 (patch) | |
tree | 50db4150d2e1ce6adb75f24422231e52d880b911 | |
parent | 9c494aceef9bff117321db21fb043fa60d0a9b19 (diff) | |
download | pkgsrc-5000fc18c1d1abf3974b63729808fcd052848437.tar.gz |
-don't assume that usb_descriptor_t has a field bDescriptorSubtype -
this field is class specific and shouldn't be there
-before reading a string descriptor, read the language table and use
a correct language code if possible
-bump PKGREVISION
-rw-r--r-- | sysutils/usbutil/Makefile | 4 | ||||
-rw-r--r-- | sysutils/usbutil/distinfo | 4 | ||||
-rw-r--r-- | sysutils/usbutil/patches/patch-ab | 81 |
3 files changed, 81 insertions, 8 deletions
diff --git a/sysutils/usbutil/Makefile b/sysutils/usbutil/Makefile index 0a71140616c..0b1840aa91b 100644 --- a/sysutils/usbutil/Makefile +++ b/sysutils/usbutil/Makefile @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.10 2007/02/22 19:27:12 wiz Exp $ +# $NetBSD: Makefile,v 1.11 2007/02/26 11:54:55 drochner Exp $ # DISTNAME= usbutil-0.5 -PKGREVISION= 1 +PKGREVISION= 2 CATEGORIES= sysutils MASTER_SITES= ftp://ftp.augustsson.net/pub/netbsd/ diff --git a/sysutils/usbutil/distinfo b/sysutils/usbutil/distinfo index e8d7fd1bdb9..08cdf1a1165 100644 --- a/sysutils/usbutil/distinfo +++ b/sysutils/usbutil/distinfo @@ -1,9 +1,9 @@ -$NetBSD: distinfo,v 1.7 2007/01/23 17:02:06 drochner Exp $ +$NetBSD: distinfo,v 1.8 2007/02/26 11:54:57 drochner Exp $ SHA1 (usbutil-0.5.tar.gz) = 4c9abc6f370ab561bd2748b1792802d1e959c599 RMD160 (usbutil-0.5.tar.gz) = 48c6bedeed8daf50a760feedef3575db021066f8 Size (usbutil-0.5.tar.gz) = 11508 bytes SHA1 (patch-aa) = 8db548f99befd76839b8b31caa2de0861c6d708b -SHA1 (patch-ab) = 264ca3c572be06b2be720ecce5e77da1725fa894 +SHA1 (patch-ab) = af20c5d609c5fccfb0f8672d00daeda195a3b4a0 SHA1 (patch-ac) = 0c1c7e67c84c1a6db1ad0144803977bee7c61ceb SHA1 (patch-ad) = bf7ba74ab56b2ae8560c3da73cbd53134a2bf2b8 diff --git a/sysutils/usbutil/patches/patch-ab b/sysutils/usbutil/patches/patch-ab index ce6add0062d..cd59d8fddf0 100644 --- a/sysutils/usbutil/patches/patch-ab +++ b/sysutils/usbutil/patches/patch-ab @@ -1,4 +1,4 @@ -$NetBSD: patch-ab,v 1.2 2007/01/23 17:02:07 drochner Exp $ +$NetBSD: patch-ab,v 1.3 2007/02/26 11:54:57 drochner Exp $ --- usbctl.c.orig 2002-02-25 01:50:55.000000000 +0100 +++ usbctl.c @@ -21,7 +21,69 @@ $NetBSD: patch-ab,v 1.2 2007/01/23 17:02:07 drochner Exp $ #ifndef USB_STACK_VERSION #define ucr_addr addr -@@ -630,7 +636,7 @@ gethubdesc(int f, usb_hub_descriptor_t * +@@ -62,6 +68,7 @@ + #endif + + #define NSTRINGS ++#define STRINGLANG + + int num = 0; + +@@ -80,17 +87,43 @@ getstring(int si, char *s) + int r, i, n; + u_int16_t c; + usb_string_descriptor_t us; ++ int lang = 0; + + if (si == 0 || num) { + *s = 0; + return; + } ++ ++#ifdef STRINGLANG + req.ucr_addr = usbaddr; + req.ucr_request.bmRequestType = UT_READ_DEVICE; + req.ucr_request.bRequest = UR_GET_DESCRIPTOR; + req.ucr_data = &us; +- USETW2(req.ucr_request.wValue, UDESC_STRING, si); ++ USETW2(req.ucr_request.wValue, UDESC_STRING, 0); + USETW(req.ucr_request.wIndex, 0); ++ USETW(req.ucr_request.wLength, sizeof(usb_string_descriptor_t)); ++ req.ucr_flags = USBD_SHORT_XFER_OK; ++ r = ioctl(usbf, USB_REQUEST, &req); ++ if (r < 0) { ++ fprintf(stderr, "get lang tbl failed (error=%d)\n", errno); ++ *s = 0; ++ return; ++ } ++ if (req.ucr_actlen > 0 && us.bLength >= 4) { ++ lang = UGETW(us.bString[0]); ++#if 0 ++ printf("getstring: %d langs, using %d\n", ++ (us.bLength - 2) / 2, lang); ++#endif ++ } ++#endif ++ ++ req.ucr_addr = usbaddr; ++ req.ucr_request.bmRequestType = UT_READ_DEVICE; ++ req.ucr_request.bRequest = UR_GET_DESCRIPTOR; ++ req.ucr_data = &us; ++ USETW2(req.ucr_request.wValue, UDESC_STRING, si); ++ USETW(req.ucr_request.wIndex, lang); + #ifdef NSTRINGS + USETW(req.ucr_request.wLength, sizeof(usb_string_descriptor_t)); + req.ucr_flags = USBD_SHORT_XFER_OK; +@@ -384,7 +417,7 @@ struct usb_cdc_union_descriptor { + }; + + void +-prcdcd(usb_descriptor_t *ud) ++prcdcd(struct usb_cdc_header_descriptor *ud) + { + if (ud->bDescriptorType != UDESC_CS_INTERFACE) + printf("prcdcd: strange bDescriptorType=%d\n", +@@ -630,7 +663,7 @@ gethubdesc(int f, usb_hub_descriptor_t * req.ucr_addr = addr; req.ucr_request.bmRequestType = UT_READ_CLASS_DEVICE; req.ucr_request.bRequest = UR_GET_DESCRIPTOR; @@ -30,7 +92,18 @@ $NetBSD: patch-ab,v 1.2 2007/01/23 17:02:07 drochner Exp $ USETW(req.ucr_request.wIndex, 0); USETW(req.ucr_request.wLength, USB_HUB_DESCRIPTOR_SIZE); req.ucr_data = d; -@@ -1321,6 +1327,7 @@ main(int argc, char **argv) +@@ -1243,8 +1276,8 @@ prdesc(void *p, int *class, int *subclas + default: + def: + printf("Unknown descriptor (class %d/%d):\n", *class, *subclass); +- printf("bLength=%d bDescriptorType=%d bDescriptorSubtype=%d ...\n", d->bLength, +- d->bDescriptorType, d->bDescriptorSubtype ++ printf("bLength=%d bDescriptorType=%d ...\n", d->bLength, ++ d->bDescriptorType + ); + break; + } +@@ -1321,6 +1354,7 @@ main(int argc, char **argv) if (!doaddr) prunits(f); @@ -38,7 +111,7 @@ $NetBSD: patch-ab,v 1.2 2007/01/23 17:02:07 drochner Exp $ if (!nodisc) { r = ioctl(f, USB_DISCOVER); if (r < 0) -@@ -1329,6 +1336,7 @@ main(int argc, char **argv) +@@ -1329,6 +1363,7 @@ main(int argc, char **argv) if (disconly) exit(0); } |