mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-31 16:57:10 +00:00
When the mouse is being disconnected, do the followings:
- Call ums_disable() to abort the pipe. - Do not wake up processes which has been waiting or polling for mouse data. It won't be available anymore. Submitted by: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
This commit is contained in:
parent
46e1f231cd
commit
c9efdb87e8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=47620
@ -368,10 +368,8 @@ ums_detach(device_t self)
|
||||
{
|
||||
struct ums_softc *sc = device_get_softc(self);
|
||||
|
||||
if (sc->sc_enabled) {
|
||||
usbd_abort_pipe(sc->sc_intrpipe);
|
||||
usbd_close_pipe(sc->sc_intrpipe);
|
||||
}
|
||||
if (sc->sc_enabled)
|
||||
ums_disable(sc);
|
||||
sc->sc_disconnected = 1;
|
||||
|
||||
DPRINTF(("%s: disconnected\n", USBDEVNAME(self)));
|
||||
@ -379,6 +377,14 @@ ums_detach(device_t self)
|
||||
free(sc->sc_loc_btn, M_USB);
|
||||
free(sc->sc_ibuf, M_USB);
|
||||
|
||||
/*
|
||||
* XXX If we wakeup the process here, the device will be gone by
|
||||
* the time the process gets a chance to notice. *_close and friends
|
||||
* should be fixed to handle this case.
|
||||
* Or we should do a delayed detach for this.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
/* someone waiting for data */
|
||||
if (sc->state & UMS_ASLEEP) {
|
||||
sc->state &= ~UMS_ASLEEP;
|
||||
@ -388,6 +394,7 @@ ums_detach(device_t self)
|
||||
sc->state &= ~UMS_SELECT;
|
||||
selwakeup(&sc->rsel);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -605,6 +612,9 @@ ums_close(dev_t dev, int flag, int fmt, struct proc *p)
|
||||
{
|
||||
USB_GET_SC(ums, UMSUNIT(dev), sc);
|
||||
|
||||
if (sc == NULL)
|
||||
return 0;
|
||||
|
||||
if (sc->sc_enabled)
|
||||
ums_disable(sc);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user