Allow a read() on /dev/ams[0-9] to be interrupted.
Right now ams_read() uses cv_wait() to wait for new data to arrive on the mouse device. This means that when you run `cat /dev/ams0', it cannot be interrupted directly. After you press ^C, you first need to move the mouse before cat will quit. Make this function use cv_wait_sig(), which allows it to be interrupted directly. Reviewed by: nwhitehorn
This commit is contained in:
parent
ee6aa68c9c
commit
b75d197096
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=184520
@ -382,6 +382,7 @@ ams_read(struct cdev *dev, struct uio *uio, int flag)
|
||||
struct adb_mouse_softc *sc;
|
||||
size_t len;
|
||||
int8_t outpacket[8];
|
||||
int error;
|
||||
|
||||
sc = CDEV_GET_SOFTC(dev);
|
||||
if (sc == NULL)
|
||||
@ -403,7 +404,11 @@ ams_read(struct cdev *dev, struct uio *uio, int flag)
|
||||
|
||||
|
||||
/* Otherwise, block on new data */
|
||||
cv_wait(&sc->sc_cv,&sc->sc_mtx);
|
||||
error = cv_wait_sig(&sc->sc_cv, &sc->sc_mtx);
|
||||
if (error) {
|
||||
mtx_unlock(&sc->sc_mtx);
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
|
||||
sc->packet[0] = 1 << 7;
|
||||
|
Loading…
Reference in New Issue
Block a user