[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#450713: Disable device grab to allow device access for other calibration utility



Hello,
this patch adds GrabDevice option to the driver. When this option is set in xorg.conf to Off,
it disables EVIOCGRAB, allowing other programs to access the device.
This allows calibrator from touchkitusb to work.


diff -urN xf86-input-evtouch-0.8.7/evtouch.c xf86-input-evtouch-0.8.7.new/evtouch.c
--- xf86-input-evtouch-0.8.7/evtouch.c  2008-05-28 11:50:22.000000000 +0200
+++ xf86-input-evtouch-0.8.7.new/evtouch.c      2008-05-28 12:03:11.000000000 +0200
@@ -499,7 +499,7 @@
 
         xf86FlushInput(local->fd);
 
-        if (ioctl(local->fd, EVIOCGRAB, (void *)1))
+        if (priv->grab_device && ioctl(local->fd, EVIOCGRAB, (void *)1))
                 xf86Msg(X_ERROR, "%s: Unable to grab device (%s).\n", local->name, strerror(errno));
 
 
@@ -527,7 +527,8 @@
 
         if (local->fd != -1)
         {
-                ioctl(local->fd, EVIOCGRAB, (void *)0);
+                if (priv->grab_device)
+                        ioctl(local->fd, EVIOCGRAB, (void *)0);
                 xf86RemoveEnabledDevice (local);
                 if (priv->buffer)
                 {
@@ -1203,6 +1204,8 @@
         priv->swap_y = xf86SetBoolOption(local->options, "SwapY", FALSE);
         priv->swap_x = xf86SetBoolOption(local->options, "SwapX", FALSE);
 
+        priv->grab_device = xf86SetBoolOption(local->options, "GrabDevice", TRUE);
+
         /*
            get calibration parameters from XF86Config
         */
diff -urN xf86-input-evtouch-0.8.7/evtouch.h xf86-input-evtouch-0.8.7.new/evtouch.h
--- xf86-input-evtouch-0.8.7/evtouch.h  2008-05-28 11:50:19.000000000 +0200
+++ xf86-input-evtouch-0.8.7.new/evtouch.h      2008-05-28 12:01:59.000000000 +0200
@@ -128,6 +128,8 @@
         int screen_num;    /* Screen associated with the device */
         int screen_width;   /* Width of the associated X screen  */
         int screen_height;   /* Height of the screen              */
+
+        Bool grab_device;
         
         XISBuffer *buffer;
         struct input_event ev; /* packet being/just read */




-- 
Ondrej Zary



Reply to: