On Thu, Feb 09, 2017 at 04:10:49PM -0800, Ping Cheng wrote:
> On Wednesday, February 8, 2017, Peter Hutterer <peter.hutte...@who-t.net>
> wrote:
> 
> > On Mon, Feb 06, 2017 at 05:36:21PM -0800, Ping Cheng wrote:
> > > The wcmIsSiblingDevice function uses several tricks to try and determine
> > > if two devices should be considered siblings. If its 'logical_only'
> > > parameter is false, this includes comparing device names. Device name
> > > comparison is complicated by the fact that suffixes are added on by
> > > the X and kernel drivers. To deal with this, the wcmSplitName function
> > > tries to split a device name into three pieces: its "basename" that
> > > describes the model, its "subdevice" name that describes the interface,
> > > and its "tool" name which describes the X11 tool.
> > >
> > > Spliting the name is a somewhat kludgy process which does not properly
> > > handle the device names for the MobileStudio Pro or Cintiq Pro. The
> > > kernel reads the name of these devices directly from the hardware's
> > > descriptors, and the names are slightly different between the pen and
> > > touch interfaces (the touch device has an extra "Touch" suffix).
> > >
> > > This patch tweaks how wcmSplitName breaks apart device names in order
> > > to handle the MobileStudio Pro and Cintiq Pro. Specifically, it now
> > > allows the "subdevice" to contain an arbitrary number of "Pen", "Finger",
> > > or "Pad" suffixes. For the MobileStudio Pro and Cintiq Pro, this should
> > > allow the "basename" that is considered for sibling device matches
> > > to be identical between both the pen and touch interfaces.
> > >
> > > Signed-off-by: Jason Gerecke <jason.gere...@wacom.com <javascript:;>>
> > > Signed-off-by: Ping Cheng <ping.ch...@wacom.com <javascript:;>>
> > > ---
> > >  src/wcmConfig.c | 14 +++++++++++---
> > >  1 file changed, 11 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/src/wcmConfig.c b/src/wcmConfig.c
> > > index 27c686f..ab82918 100644
> > > --- a/src/wcmConfig.c
> > > +++ b/src/wcmConfig.c
> > > @@ -320,10 +320,18 @@ static void wcmSplitName(char* devicename, char
> > *basename, char *subdevice, char
> > >       {
> > >               *a = '\0';
> > >               b = strrchr(name, ' ');
> > > -             if (b && (!strcmp(b, " Pen") || !strcmp(b, " Finger") ||
> > !strcmp(b, " Pad")))
> > > +
> > > +             while (b)
> > >               {
> > > -                     *b = '\0';
> > > -                     strncat(subdevice, b+1, len-1);
> > > +                     if (!strcmp(b, " Pen") || !strcmp(b, " Finger") ||
> > !strcmp(b, " Pad") || !strcmp(b, " Touch"))
> >
> > can we break this up over two lines please?
> 
> 
> Sure. Can you update the patch and merge it upstream? Thanks.

nope :)

because touching a patch means testing, and I don't have the hw to test this
beyond a basic compile, sorry.

Cheers,
   Peter

> 
> 
> > > +                     {
> > > +                             *b = '\0';
> > > +                             strncpy(subdevice, b+1, len-1);
> > > +                             subdevice[len-1] = '\0';
> > > +                             b = strrchr(name, ' ');
> > > +                     }
> > > +                     else
> > > +                             b = NULL;
> > >               }
> > >               strncat(tool, a+1, len-1);
> > >       }
> >
> > I'm really wondering if we can't have a better approach here, similar to
> > libinput's device groups? we can read bits from udev or worst case even
> > write out a giant xorg.conf file with static options associations.
> 
> 
> That's a great idea. Let's keep the info here so we can come back when we
> have time.
> 
> The patch itself loks good though, thanks.
> >
> 
> Thank you for the review. The patch fixes a potential touch switch issue...
> 
> Cheers,
> Ping

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to