mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-03-25 10:19:22 +00:00
Add option "GrabDevice", don't grab the device by default.
We now have the matching code in the server to set the console to RAW mode and don't need to grab the devices anymore. This is an updated version ofe8534d47c8, which was reverted in6dc4199155. (cherry picked from commit4912e2aa7f)
This commit is contained in:
@@ -11,6 +11,7 @@ evdev \- Generic Linux input driver
|
||||
.BI " Option \*qDevice\*q \*q" devpath \*q
|
||||
.BI " Option \*qEmulate3Buttons\*q \*q" True \*q
|
||||
.BI " Option \*qEmulate3Timeout\*q \*q" 50 \*q
|
||||
.BI " Option \*qGrabDevice\*q \*q" False \*q
|
||||
\ \ ...
|
||||
.B EndSection
|
||||
.fi
|
||||
@@ -145,6 +146,13 @@ waking up from suspend). In between each attempt is a 100ms wait. Default: 10.
|
||||
.TP 7
|
||||
.BI "Option \*qInvertY\*q \*q" Bool \*q
|
||||
Invert the given axis. Default: off. Property: "Evdev Axis Inversion".
|
||||
.TP 7
|
||||
.BI "Option \*qGrabDevice\*q \*q" boolean \*q
|
||||
Force a grab on the event device. Doing so will ensure that no other driver
|
||||
can initialise the same device and it will also stop the device from sending
|
||||
events to /dev/kbd or /dev/input/mice. Events from this device will not be
|
||||
sent to virtual devices (e.g. rfkill or the Macintosh mouse button emulation).
|
||||
Default disabled.
|
||||
|
||||
.SH SUPPORTED PROPERTIES
|
||||
The following properties are provided by the
|
||||
|
||||
19
src/evdev.c
19
src/evdev.c
@@ -979,7 +979,7 @@ EvdevOn(DeviceIntPtr device)
|
||||
pInfo = device->public.devicePrivate;
|
||||
pEvdev = pInfo->private;
|
||||
|
||||
if (pInfo->fd != -1 && !pEvdev->kernel24 &&
|
||||
if (pInfo->fd != -1 && pEvdev->grabDevice &&
|
||||
(rc = ioctl(pInfo->fd, EVIOCGRAB, (void *)1)))
|
||||
{
|
||||
xf86Msg(X_WARNING, "%s: Grab failed (%s)\n", pInfo->name,
|
||||
@@ -1028,7 +1028,7 @@ EvdevProc(DeviceIntPtr device, int what)
|
||||
case DEVICE_OFF:
|
||||
if (pInfo->fd != -1)
|
||||
{
|
||||
if (!pEvdev->kernel24 && ioctl(pInfo->fd, EVIOCGRAB, (void *)0))
|
||||
if (pEvdev->grabDevice && ioctl(pInfo->fd, EVIOCGRAB, (void *)0))
|
||||
xf86Msg(X_WARNING, "%s: Release failed (%s)\n", pInfo->name,
|
||||
strerror(errno));
|
||||
xf86RemoveEnabledDevice(pInfo);
|
||||
@@ -1177,17 +1177,19 @@ EvdevProbe(InputInfoPtr pInfo)
|
||||
long rel_bitmask[NBITS(REL_MAX)];
|
||||
long abs_bitmask[NBITS(ABS_MAX)];
|
||||
int i, has_axes, has_keys, num_buttons;
|
||||
int kernel24 = 0;
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
|
||||
if (ioctl(pInfo->fd, EVIOCGRAB, (void *)1)) {
|
||||
if (pEvdev->grabDevice && ioctl(pInfo->fd, EVIOCGRAB, (void *)1)) {
|
||||
if (errno == EINVAL) {
|
||||
/* keyboards are unsafe in 2.4 */
|
||||
pEvdev->kernel24 = 1;
|
||||
kernel24 = 1;
|
||||
pEvdev->grabDevice = 0;
|
||||
} else {
|
||||
xf86Msg(X_ERROR, "Grab failed. Device already configured?\n");
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
} else if (pEvdev->grabDevice) {
|
||||
ioctl(pInfo->fd, EVIOCGRAB, (void *)0);
|
||||
}
|
||||
|
||||
@@ -1263,7 +1265,7 @@ EvdevProbe(InputInfoPtr pInfo)
|
||||
}
|
||||
|
||||
if (has_keys) {
|
||||
if (pEvdev->kernel24) {
|
||||
if (kernel24) {
|
||||
xf86Msg(X_INFO, "%s: Kernel < 2.6 is too old, ignoring keyboard\n",
|
||||
pInfo->name);
|
||||
} else {
|
||||
@@ -1348,6 +1350,11 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
|
||||
pEvdev->invert_x = xf86SetBoolOption(pInfo->options, "InvertX", FALSE);
|
||||
pEvdev->invert_y = xf86SetBoolOption(pInfo->options, "InvertY", FALSE);
|
||||
|
||||
/* Grabbing the event device stops in-kernel event forwarding. In other
|
||||
words, it disables rfkill and the "Macintosh mouse button emulation".
|
||||
Note that this needs a server that sets the console to RAW mode. */
|
||||
pEvdev->grabDevice = xf86CheckBoolOption(dev->commonOptions, "GrabDevice", 0);
|
||||
|
||||
pEvdev->noXkb = noXkbExtension; /* parse the XKB options during kbd setup */
|
||||
|
||||
EvdevInitButtonMapping(pInfo);
|
||||
|
||||
@@ -57,7 +57,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
const char *device;
|
||||
int kernel24;
|
||||
int grabDevice; /* grab the event device? */
|
||||
int screen;
|
||||
int min_x, min_y, max_x, max_y;
|
||||
int abs_x, abs_y, old_x, old_y;
|
||||
|
||||
Reference in New Issue
Block a user