On Tue, Dec 26, 2017 at 03:56:35PM -0800, Jason Gerecke wrote:
> The wcmLinkTouchAndPen function is responsible for associating the pen and
> touch interfaces of a tablet. This association can be tripped up if multiple
> devices with the same name are connected, so it includes code to prevent
> linking to a device which already has been linked up. However, the condition
> also checks that the device being considered is a tablet (i.e., stylus/eraser/
> cursor; not pad/touch). This latter check seems nonsensical: it allows devices
> to link to the first touch device they find, even if that device is already
> linked up.
> 
> Disallowing multiple links to the same device prevents all three pen/touch/pad
> devices from having wcmTouchDevice set up, however. Leaving the stricter
> condition as-is could cause devices to be linked up incorrectly (e.g. if the
> X server has {touch1, pen1, pad1, touch2, pen2, pad2}, then touch1 and pen1
> would get linked, but pad1 and touch2 would get linked, and pen2/pad2 left
> unlinked!). To prevent this, we disallow linking of pad interfaces, which
> should not be a problem since the pad shouldn't need to use the wcmTouchDevice
> variable.
> 
> Fixes: 8bb519ef2b ("Update wcmTouchDevice for touch interface")
> Signed-off-by: Jason Gerecke <jason.gere...@wacom.com>

Acked-by: Peter Hutterer <peter.hutte...@who-t.net>

Cheers,
   Peter

> ---
>  src/wcmConfig.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/src/wcmConfig.c b/src/wcmConfig.c
> index 2402952..f85f1ca 100644
> --- a/src/wcmConfig.c
> +++ b/src/wcmConfig.c
> @@ -492,6 +492,12 @@ static Bool wcmLinkTouchAndPen(InputInfoPtr pInfo)
>       WacomCommonPtr tmpcommon = NULL;
>       WacomDevicePtr tmppriv = NULL;
>  
> +     if (IsPad(priv))
> +     {
> +             DBG(4, priv, "No need to link up pad devices.\n");
> +             return FALSE;
> +     }
> +
>       /* Lookup to find the associated pen and touch */
>       for (; device != NULL; device = device->next)
>       {
> @@ -504,7 +510,7 @@ static Bool wcmLinkTouchAndPen(InputInfoPtr pInfo)
>               DBG(4, priv, "Considering link with %s...\n", tmppriv->name);
>  
>               /* already linked devices */
> -             if (tmpcommon->wcmTouchDevice && IsTablet(tmppriv))
> +             if (tmpcommon->wcmTouchDevice)
>               {
>                       DBG(4, priv, "A link is already in place. Ignoring.\n");
>                       continue;
> -- 
> 2.15.1
> 
> 
> ------------------------------------------------------------------------------
> 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
> 

------------------------------------------------------------------------------
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