Try getting string descriptors in a slightly different way to works around
some problematic devices. From Alexander Kabaev <kan@FreeBSD.ORG>.
This commit is contained in:
parent
f2a72b5110
commit
8789d465b2
|
@ -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 @@ 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));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue