kdrive: Grab evdev mouse/keyboard devices when X server is active
Input events are directed to both vt and input devices by default. Unless input devices are grabbed, keyboard events fill it vt buffers and cause spontaneous wakeups in kernel tty layer when buffers are full. Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
83d520d86c
commit
662594aeff
|
@ -243,7 +243,9 @@ EvdevPtrEnable (KdPointerInfo *pi)
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
|
|
||||||
|
if (ioctl (fd, EVIOCGRAB, 1) < 0)
|
||||||
|
perror ("Grabbing evdev mouse device failed");
|
||||||
|
|
||||||
if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0)
|
if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0)
|
||||||
{
|
{
|
||||||
perror ("EVIOCGBIT 0");
|
perror ("EVIOCGBIT 0");
|
||||||
|
@ -335,6 +337,10 @@ EvdevPtrDisable (KdPointerInfo *pi)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
KdUnregisterFd (pi, ke->fd, TRUE);
|
KdUnregisterFd (pi, ke->fd, TRUE);
|
||||||
|
|
||||||
|
if (ioctl (ke->fd, EVIOCGRAB, 0) < 0)
|
||||||
|
perror ("Ungrabbing evdev mouse device failed");
|
||||||
|
|
||||||
xfree (ke);
|
xfree (ke);
|
||||||
pi->driverPrivate = 0;
|
pi->driverPrivate = 0;
|
||||||
}
|
}
|
||||||
|
@ -425,6 +431,9 @@ EvdevKbdEnable (KdKeyboardInfo *ki)
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
|
|
||||||
|
if (ioctl (fd, EVIOCGRAB, 1) < 0)
|
||||||
|
perror ("Grabbing evdev keyboard device failed");
|
||||||
|
|
||||||
if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0) {
|
if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0) {
|
||||||
perror ("EVIOCGBIT 0");
|
perror ("EVIOCGBIT 0");
|
||||||
close (fd);
|
close (fd);
|
||||||
|
@ -496,6 +505,10 @@ EvdevKbdDisable (KdKeyboardInfo *ki)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
KdUnregisterFd (ki, ke->fd, TRUE);
|
KdUnregisterFd (ki, ke->fd, TRUE);
|
||||||
|
|
||||||
|
if (ioctl (ke->fd, EVIOCGRAB, 0) < 0)
|
||||||
|
perror ("Ungrabbing evdev keyboard device failed");
|
||||||
|
|
||||||
xfree (ke);
|
xfree (ke);
|
||||||
ki->driverPrivate = 0;
|
ki->driverPrivate = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue