Libwacom_new_from_path() matches the vid/pid from a found device to
an entry in the database. Devices with entries in libwacom/data have
a name which identifies the physical device (e.g. “Wacom Intuos Pro
M”), but the generic/fallback devices have a (sysfs) name with a
suffix indicating the part of the device in question (e.g “Wacom
Intuos Pro M _Pen_”). When gnome-control-center creates panels for
the devices, the names of the related fallback/generic devices don’t
match each other, and gcc attempts to create a new panel for each of
the Pen, the Pad, etc. because gcc thinks they are separate devices.
This results in the Pad “separate” device not being connected to its
associated Pen device and the “Map Buttons...” button not being
displayed. This patch removes the suffix off of the fallback device
name and adds button position necessary for gnome to add the buttons.

Signed-off-by: Aaron Skomra <aaron.sko...@wacom.com>
---
 data/generic.tablet |  6 ++++++
 libwacom/libwacom.c | 13 +++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/data/generic.tablet b/data/generic.tablet
index 8b7f867..ca91b41 100644
--- a/data/generic.tablet
+++ b/data/generic.tablet
@@ -1,3 +1,6 @@
+# Wacom
+# Generic/Fallback Tablet
+
 [Device]
 Name=Generic
 DeviceMatch=generic
@@ -8,3 +11,6 @@ Stylus=true
 Ring=true
 NumStrips=2
 Buttons=4
+
+[Buttons]
+Left=A;B;C;D
diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
index d20b66c..7d324fe 100644
--- a/libwacom/libwacom.c
+++ b/libwacom/libwacom.c
@@ -486,7 +486,7 @@ libwacom_new_from_path(const WacomDeviceDatabase *db, const 
char *path, WacomFal
        const WacomDevice *device;
        WacomDevice *ret = NULL;
        WacomIntegrationFlags integration_flags;
-       char *name, *match_name;
+       char *name, *match_name, *name_copy;
 
        if (!db) {
                libwacom_error_set(error, WERROR_INVALID_DB, "db is NULL");
@@ -521,7 +521,16 @@ libwacom_new_from_path(const WacomDeviceDatabase *db, 
const char *path, WacomFal
 
                if (name != NULL) {
                        g_free (ret->name);
-                       ret->name = g_strdup(name);
+                       name_copy = g_strdup(name);
+
+                       /* Remove the tool name suffix from the device name. */
+                       char * new_end = g_strrstr(name_copy, " ");
+                       new_end[0] = '\0';
+
+                       ret->name = g_strdup(name_copy);
+
+                       new_end[0] = ' ';
+                       g_free (name_copy);
                }
        }
 
-- 
2.5.0


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to