1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

The previous fix for the USB ugen device set configuration ioctl()

has a slight error, and returns EIO way too often.

PR:		16315
Submitted by:  Louis Mamakos <louie@TransSys.COM>
This commit is contained in:
Nick Hibma 2000-01-24 10:23:57 +00:00
parent f0aac6a503
commit dd3d335141
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=56523

View File

@ -209,8 +209,12 @@ ugen_set_config(sc, configno)
* control endpoint is open or not. It is always present. * control endpoint is open or not. It is always present.
*/ */
for (endptno = 1; endptno < USB_MAX_ENDPOINTS; endptno++) for (endptno = 1; endptno < USB_MAX_ENDPOINTS; endptno++)
if (sc->sc_is_open[endptno]) if (sc->sc_is_open[endptno]) {
DPRINTFN(1,
("ugen_set_config: %s - endpoint %d is open\n",
USBDEVNAME(sc->sc_dev), endptno));
return (USBD_IN_USE); return (USBD_IN_USE);
}
if (usbd_get_config_descriptor(dev)->bConfigurationValue != configno) { if (usbd_get_config_descriptor(dev)->bConfigurationValue != configno) {
/* Avoid setting the current value. */ /* Avoid setting the current value. */
@ -957,10 +961,14 @@ ugen_do_ioctl(sc, endpt, cmd, addr, flag, p)
if (!(flag & FWRITE)) if (!(flag & FWRITE))
return (EPERM); return (EPERM);
err = ugen_set_config(sc, *(int *)addr); err = ugen_set_config(sc, *(int *)addr);
if (err == USBD_IN_USE) switch (err) {
return(EBUSY); case USBD_NORMAL_COMPLETION:
else break;
case USBD_IN_USE:
return (EBUSY);
default:
return (EIO); return (EIO);
}
break; break;
case USB_GET_ALTINTERFACE: case USB_GET_ALTINTERFACE:
ai = (struct usb_alt_interface *)addr; ai = (struct usb_alt_interface *)addr;