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.
*/
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);
}
if (usbd_get_config_descriptor(dev)->bConfigurationValue != configno) {
/* Avoid setting the current value. */
@ -957,10 +961,14 @@ ugen_do_ioctl(sc, endpt, cmd, addr, flag, p)
if (!(flag & FWRITE))
return (EPERM);
err = ugen_set_config(sc, *(int *)addr);
if (err == USBD_IN_USE)
return(EBUSY);
else
switch (err) {
case USBD_NORMAL_COMPLETION:
break;
case USBD_IN_USE:
return (EBUSY);
default:
return (EIO);
}
break;
case USB_GET_ALTINTERFACE:
ai = (struct usb_alt_interface *)addr;