input: evdev.c EVIOCGRAB semantics question

From: Magnus Vigerlöf
Date: Sat Aug 12 2006 - 11:21:52 EST


What is the purpose of the EVIOCGRAB ioctl in evdev.c? Is it to prevent the
device driver from sending events to other event handlers? Is it to prevent
other applications from receiving events that has the device handler open?
First, last, or both?

I discovered the following behavior when I fired up a second X-server on my
machine with my Wacom tablet connected: The second X-server opened the tablet
as well and everything worked as it should. However when I switched back to
the first X-server the tablet didn't work at all. Only when I stopped the
second X-server did the tablet start working in the first X-server again. If
I changed the code in evdev to ignore the EVIOCGRAB-ioctl the tablet works in
both X-servers, but that caused other problems.

Now, having two X-servers might not be the most common thing to have, but
having other applications that depends on the movement from the tablet might
be more common.

As is it now, it's useless (more or less) to run wacdump to display the tablet
specific events in a understandable manner. An application that generates
events through uinput based on tablet events and some other qualifiers
(mouseemu, simulating mouse scroll wheel) will not work either.

And yes, the X-server must grab the tablet. Otherwise events will go
through /dev/input/mice as well and mess up applications that depend on the
tablet-specific absolute events.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at