version 1.196.4.5, 2018/08/08 10:17:11 |
version 1.196.4.6, 2019/11/16 16:13:56 |
Line 157 usbd_get_string_desc(struct usbd_device |
|
Line 157 usbd_get_string_desc(struct usbd_device |
|
usbd_status err; |
usbd_status err; |
int actlen; |
int actlen; |
|
|
|
/* |
|
* Pass a full-sized buffer to usbd_do_request_len(). At least |
|
* one device has been seen returning additional data beyond the |
|
* provided buffers (2-bytes written shortly after the request |
|
* claims to have completed and returned the 2 byte header, |
|
* corrupting other memory.) |
|
*/ |
req.bmRequestType = UT_READ_DEVICE; |
req.bmRequestType = UT_READ_DEVICE; |
req.bRequest = UR_GET_DESCRIPTOR; |
req.bRequest = UR_GET_DESCRIPTOR; |
USETW2(req.wValue, UDESC_STRING, sindex); |
USETW2(req.wValue, UDESC_STRING, sindex); |
USETW(req.wIndex, langid); |
USETW(req.wIndex, langid); |
USETW(req.wLength, 2); /* only size byte first */ |
USETW(req.wLength, 2); /* only size byte first */ |
err = usbd_do_request_flags(dev, &req, sdesc, USBD_SHORT_XFER_OK, |
err = usbd_do_request_len(dev, &req, sizeof(*sdesc), sdesc, |
&actlen, USBD_DEFAULT_TIMEOUT); |
USBD_SHORT_XFER_OK, &actlen, USBD_DEFAULT_TIMEOUT); |
if (err) |
if (err) |
return err; |
return err; |
|
|
Line 171 usbd_get_string_desc(struct usbd_device |
|
Line 178 usbd_get_string_desc(struct usbd_device |
|
return USBD_SHORT_XFER; |
return USBD_SHORT_XFER; |
|
|
USETW(req.wLength, sdesc->bLength); /* the whole string */ |
USETW(req.wLength, sdesc->bLength); /* the whole string */ |
err = usbd_do_request_flags(dev, &req, sdesc, USBD_SHORT_XFER_OK, |
err = usbd_do_request_len(dev, &req, sizeof(*sdesc), sdesc, |
&actlen, USBD_DEFAULT_TIMEOUT); |
USBD_SHORT_XFER_OK, &actlen, USBD_DEFAULT_TIMEOUT); |
if (err) |
if (err) |
return err; |
return err; |
|
|
Line 1192 usbd_get_initial_ddesc(struct usbd_devic |
|
Line 1199 usbd_get_initial_ddesc(struct usbd_devic |
|
req.bRequest = UR_GET_DESCRIPTOR; |
req.bRequest = UR_GET_DESCRIPTOR; |
USETW2(req.wValue, UDESC_DEVICE, 0); |
USETW2(req.wValue, UDESC_DEVICE, 0); |
USETW(req.wIndex, 0); |
USETW(req.wIndex, 0); |
USETW(req.wLength, 64); |
USETW(req.wLength, 8); |
res = usbd_do_request_flags(dev, &req, buf, USBD_SHORT_XFER_OK, |
res = usbd_do_request_flags(dev, &req, buf, USBD_SHORT_XFER_OK, |
&actlen, USBD_DEFAULT_TIMEOUT); |
&actlen, USBD_DEFAULT_TIMEOUT); |
if (res) |
if (res) |