summaryrefslogtreecommitdiff
path: root/sys/dev/usb/usb_subr.c
diff options
context:
space:
mode:
authorJosef Karthauser <joe@FreeBSD.org>2003-01-14 23:07:43 +0000
committerJosef Karthauser <joe@FreeBSD.org>2003-01-14 23:07:43 +0000
commite22514406d209415eab38b8e06e3a3b33b1157d4 (patch)
tree8243a2ff179ca87bd1be888e54d2df601c922bc2 /sys/dev/usb/usb_subr.c
parentd2128d818f723a27521944f1adb1b87b7675a2bd (diff)
Notes
Diffstat (limited to 'sys/dev/usb/usb_subr.c')
-rw-r--r--sys/dev/usb/usb_subr.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c
index ee5b8757036b..08ebe65c5550 100644
--- a/sys/dev/usb/usb_subr.c
+++ b/sys/dev/usb/usb_subr.c
@@ -153,15 +153,21 @@ usbd_get_string_desc(usbd_device_handle dev, int sindex, int langid,
{
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));
}