Check whether we can change config at all. If any of the endpoints
has been opened, we should not allow configuration changes as endpoint descriptors might disappear. PR: 16256, 16168
This commit is contained in:
parent
8dc74b6288
commit
db972b58b5
@ -204,6 +204,14 @@ ugen_set_config(sc, configno)
|
|||||||
|
|
||||||
DPRINTFN(1,("ugen_set_config: %s to configno %d, sc=%p\n",
|
DPRINTFN(1,("ugen_set_config: %s to configno %d, sc=%p\n",
|
||||||
USBDEVNAME(sc->sc_dev), configno, sc));
|
USBDEVNAME(sc->sc_dev), configno, sc));
|
||||||
|
|
||||||
|
/* We start at 1, not 0, because we don't care whether the
|
||||||
|
* control endpoint is open or not. It is always present.
|
||||||
|
*/
|
||||||
|
for (endptno = 1; endptno < USB_MAX_ENDPOINTS; endptno++)
|
||||||
|
if (sc->sc_is_open[endptno])
|
||||||
|
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. */
|
||||||
err = usbd_set_config_no(dev, configno, 0);
|
err = usbd_set_config_no(dev, configno, 0);
|
||||||
@ -949,7 +957,9 @@ 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)
|
if (err == USBD_IN_USE)
|
||||||
|
return(EBUSY);
|
||||||
|
else
|
||||||
return (EIO);
|
return (EIO);
|
||||||
break;
|
break;
|
||||||
case USB_GET_ALTINTERFACE:
|
case USB_GET_ALTINTERFACE:
|
||||||
|
Loading…
Reference in New Issue
Block a user