diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2008-07-28 20:49:29 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2008-07-28 20:49:29 +0000 |
commit | f77806647c0ea8f3f797a28338d7cc86a22ce432 (patch) | |
tree | ed0f61033a3fe9c3fe633fab0fed87246e92d300 /sys | |
parent | 44213d114ce621b184edefaaf523e68d70386cd4 (diff) |
When getting the string descriptors, fetch 2 bytes (size and type) first,
and then the whole string based on the returned size, not just one byte.
The Lexar card reader kindly loaned by
Denis Doroshenko (denis dot doroshenko at gmail.com) it's happy now, and
after further inspection it's what other OSs do.
Discussed with yuo@. krw@ yuo@ ok.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/usb/usb_subr.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index 0b682d87a09..eaad41a74c6 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb_subr.c,v 1.69 2008/06/29 10:04:15 yuo Exp $ */ +/* $OpenBSD: usb_subr.c,v 1.70 2008/07/28 20:49:28 fgsch Exp $ */ /* $NetBSD: usb_subr.c,v 1.103 2003/01/10 11:19:13 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ @@ -127,13 +127,13 @@ usbd_get_string_desc(usbd_device_handle dev, int sindex, int langid, req.bRequest = UR_GET_DESCRIPTOR; USETW2(req.wValue, UDESC_STRING, sindex); USETW(req.wIndex, langid); - USETW(req.wLength, 1); /* only size byte first */ + USETW(req.wLength, 2); /* size and descriptor type first */ err = usbd_do_request_flags(dev, &req, sdesc, USBD_SHORT_XFER_OK, &actlen, USBD_DEFAULT_TIMEOUT); if (err) return (err); - if (actlen < 1) + if (actlen < 2) return (USBD_SHORT_XFER); USETW(req.wLength, sdesc->bLength); /* the whole string */ |