Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Try getting string descriptors in a slightly dif...



details:   https://anonhg.NetBSD.org/src/rev/9720e533b3ec
branches:  trunk
changeset: 541098:9720e533b3ec
user:      augustss <augustss%NetBSD.org@localhost>
date:      Wed Jan 01 16:21:50 2003 +0000

description:
Try getting string descriptors in a slightly different way to works around
some problematic devices.  From Alexander Kabaev <kan%FreeBSD.ORG@localhost>.

diffstat:

 sys/dev/usb/usb_subr.c |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r 91cc405d342c -r 9720e533b3ec sys/dev/usb/usb_subr.c
--- a/sys/dev/usb/usb_subr.c    Wed Jan 01 16:18:49 2003 +0000
+++ b/sys/dev/usb/usb_subr.c    Wed Jan 01 16:21:50 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb_subr.c,v 1.101 2003/01/01 00:10:26 thorpej Exp $   */
+/*     $NetBSD: usb_subr.c,v 1.102 2003/01/01 16:21:50 augustss Exp $  */
 /*     $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $   */
 
 /*
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.101 2003/01/01 00:10:26 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.102 2003/01/01 16:21:50 augustss Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -156,15 +156,21 @@
 {
        usb_device_request_t req;
        usbd_status err;
+       int actlen;
 
        req.bmRequestType = UT_READ_DEVICE;
        req.bRequest = UR_GET_DESCRIPTOR;
        USETW2(req.wValue, UDESC_STRING, sindex);
        USETW(req.wIndex, langid);
-       USETW(req.wLength, 1);  /* only size byte first */
-       err = usbd_do_request(dev, &req, sdesc);
+       USETW(req.wLength, 2);  /* only size byte first */
+       err = usbd_do_request_flags(dev, &req, sdesc, USBD_SHORT_XFER_OK,
+               &actlen, USBD_DEFAULT_TIMEOUT);
        if (err)
                return (err);
+
+       if (actlen < 1)
+               return (USBD_SHORT_XFER);
+
        USETW(req.wLength, sdesc->bLength);     /* the whole string */
        return (usbd_do_request(dev, &req, sdesc));
 }



Home | Main Index | Thread Index | Old Index