Lines 1436-1441
usbd_req_set_alt_interface_no(struct usb_device *udev, struct mtx *mtx,
Link Here
|
1436 |
{ |
1436 |
{ |
1437 |
struct usb_interface *iface = usbd_get_iface(udev, iface_index); |
1437 |
struct usb_interface *iface = usbd_get_iface(udev, iface_index); |
1438 |
struct usb_device_request req; |
1438 |
struct usb_device_request req; |
|
|
1439 |
usb_error_t err; |
1439 |
|
1440 |
|
1440 |
if ((iface == NULL) || (iface->idesc == NULL)) |
1441 |
if ((iface == NULL) || (iface->idesc == NULL)) |
1441 |
return (USB_ERR_INVAL); |
1442 |
return (USB_ERR_INVAL); |
Lines 1447-1453
usbd_req_set_alt_interface_no(struct usb_device *udev, struct mtx *mtx,
Link Here
|
1447 |
req.wIndex[0] = iface->idesc->bInterfaceNumber; |
1448 |
req.wIndex[0] = iface->idesc->bInterfaceNumber; |
1448 |
req.wIndex[1] = 0; |
1449 |
req.wIndex[1] = 0; |
1449 |
USETW(req.wLength, 0); |
1450 |
USETW(req.wLength, 0); |
1450 |
return (usbd_do_request(udev, mtx, &req, 0)); |
1451 |
err = usbd_do_request(udev, mtx, &req, 0); |
|
|
1452 |
if ((err == USB_ERR_STALLED) && (iface->num_altsetting <= 1)) { |
1453 |
/* USB spec 9.4.10 says devices don't need this and are free to STALL the |
1454 |
* request if the interface only has one alternate setting. |
1455 |
*/ |
1456 |
err = 0; |
1457 |
DPRINTF("iface %p, %d, %d\n", |
1458 |
iface, err, iface->num_altsetting); |
1459 |
} |
1460 |
return (err); |
1451 |
} |
1461 |
} |
1452 |
|
1462 |
|
1453 |
/*------------------------------------------------------------------------* |
1463 |
/*------------------------------------------------------------------------* |