On Fri, Sep 14, 2012 at 05:07:05PM -0700, Jason Gerecke wrote:
> On Fri, Sep 14, 2012 at 5:04 PM, Jason Gerecke <[email protected]> wrote:
> > Like in recent versions of xf86-input-evdev, grabbing the input device
> > with EVIOCGRAB should be optional. This would enable for example
> > indicator applets, and would improve dynamic handling of different input
> > devices.
> >
> > Proposed patch extended to document new GrabDevice driver option.
> >
> > https://sourceforge.net/tracker/?func=detail&aid=3509828&group_id=69596&atid=525124
> >
> > Reported-by: H Sundelin
> > ---
> >  man/wacom.man |  6 ++++++
> >  src/wcmUSB.c  | 17 +++++++++--------
> >  2 files changed, 15 insertions(+), 8 deletions(-)
> >
> > diff --git a/man/wacom.man b/man/wacom.man
> > index e938cf5..0502860 100644
> > --- a/man/wacom.man
> > +++ b/man/wacom.man
> > @@ -197,6 +197,12 @@ paths on the tablet. There are 12 levels, specified by 
> > the integers between
> >  "number" will be logged into the Xorg log file. This option is only
> >  available if the driver was built with debugging support.
> >  .TP 4
> > +.B Option \fI"GrabDevice"\fP \fI"bool"\fP
> > +sets whether the underlying event device will be grabbed by the driver to
> > +prevent the data from leaking to /dev/input/mice. When enabled, while the
> > +X server is running, no other programs will be able to read the event
> > +stream.  Default: "false".
> > +.TP 4
> >  .B Option \fI"CursorProx"\fP \fI"number"\fP
> >  sets the max distance from tablet to stop reporting movement for cursor in 
> > relative mode.
> >  Default for Intuos series is 10, for Graphire series (including Volitos) is
> > diff --git a/src/wcmUSB.c b/src/wcmUSB.c
> > index f25116b..b970e1c 100644
> > --- a/src/wcmUSB.c
> > +++ b/src/wcmUSB.c
> > @@ -138,16 +138,17 @@ usbStart(InputInfoPtr pInfo)
> >  {
> >         int err;
> >
> > -#ifdef EVIOCGRAB
> > -       /* Try to grab the event device so that data don't leak to 
> > /dev/input/mice */
> > -       SYSCALL(err = ioctl(pInfo->fd, EVIOCGRAB, (pointer)1));
> > -
> > -       /* this is called for all tools, so all but the first one fails with
> > -        * EBUSY */
> > -       if (err < 0 && errno != EBUSY)
> > +       if (xf86CheckBoolOption(pInfo->options, "GrabDevice", 0))
> > +         {
> > +           /* Try to grab the event device so that data don't leak to 
> > /dev/input/mice */
> > +           SYSCALL(err = ioctl(pInfo->fd, EVIOCGRAB, (pointer)1));
> > +
> > +           /* this is called for all tools, so all but the first one fails 
> > with
> > +            * EBUSY */
> > +           if (err < 0 && errno != EBUSY)
> >                 xf86Msg(X_ERROR, "%s: Wacom X driver can't grab event 
> > device (%s)\n",
> >                                 pInfo->name, strerror(errno));
> > -#endif
> > +         }
> >         return Success;
> >  }
> >
> > --
> > 1.7.12
> >
> 
> Seemed like a reasonable enough request, and I'm getting tired of
> having to drop to a TTY just to run evtest (or disable
> xf86-input-wacom to run mtview). :D

there is a side-effect to this patch. Adding the option is harmless enough
but you also switched the default to false. This can cause some
issues, though wcmIsDuplicate() should take care of that.

The effect of the EVIOCGRAB is that only one user can get data from
the event device. So if a user has hotplugging enabled but a static
configuration on, say, /dev/input/wacom or some other symlink, the same
device gets added twice. with EVIOCGRAB, that won't be an issue, but without
both readers can get events now. As said above wcmIsDuplicate() should take
care of this, but please make sure this is still the case.

Coincidentally, this would be a great test to add to
http://cgit.freedesktop.org/~whot/xorg-integration-tests/

Cheers,
   Peter

------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to