summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPing Cheng <pinglinux@gmail.com>2017-02-10 21:53:01 -0800
committerPeter Hutterer <peter.hutterer@who-t.net>2017-02-13 07:26:06 +1000
commit23f9586779f94cacb899120ef426d8fcd1647dcb (patch)
tree7c2610995a1e5bae7edcf6a3621daa70bedd78ab
parentf0dedf7a610ac97bc45738492b98ce4f1e0514ec (diff)
downloadxf86-input-wacom-23f9586779f94cacb899120ef426d8fcd1647dcb.tar.gz
Make sibling device name matching slightly more lenient
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", :Touch", 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.gerecke@wacom.com> Signed-off-by: Ping Cheng <ping.cheng@wacom.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/wcmConfig.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/wcmConfig.c b/src/wcmConfig.c
index 27c686f..0924c43 100644
--- a/src/wcmConfig.c
+++ b/src/wcmConfig.c
@@ -320,10 +320,19 @@ 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"))
+ {
+ *b = '\0';
+ strncpy(subdevice, b+1, len-1);
+ subdevice[len-1] = '\0';
+ b = strrchr(name, ' ');
+ }
+ else
+ b = NULL;
}
strncat(tool, a+1, len-1);
}