|
From: Benjamin T. <ben...@re...> - 2015-03-13 18:57:26
|
The match count (and update to the first correct) has to be done
in libwacom_parse_tablet_keyfile() now.
---
New in v2 (requested by Bastien)
libwacom/libwacom-database.c | 76 +++++++++++++++++++++-----------------------
1 file changed, 36 insertions(+), 40 deletions(-)
diff --git a/libwacom/libwacom-database.c b/libwacom/libwacom-database.c
index f4cb82a..8a2519a 100644
--- a/libwacom/libwacom-database.c
+++ b/libwacom/libwacom-database.c
@@ -130,45 +130,31 @@ make_match_string (WacomBusType bus, int vendor_id, int product_id)
}
static int
-libwacom_matchstr_to_matches(WacomDevice *device, const char *match)
+libwacom_matchstr_to_match(WacomDevice *device, const char *match)
{
int rc = 1;
- char **strs;
- int i, nmatches = 0;
- WacomBusType first_bus;
- int first_vendor_id, first_product_id;
+ char busstr[64];
+ int vendor_id, product_id;
+ WacomBusType bus;
if (match == NULL)
return 0;
- strs = g_strsplit(match, ";", 0);
- for (i = 0; strs[i] != NULL && *strs[i] != '\0'; i++) {
- char busstr[64];
- int vendor_id, product_id;
- WacomBusType bus;
- rc = sscanf(strs[i], "%63[^:]:%x:%x", busstr, &vendor_id, &product_id);
- if (rc != 3) {
- DBG("failed to match '%s' for product/vendor IDs. Skipping.\n", strs[i]);
- continue;
- }
- bus = bus_from_str (busstr);
-
- libwacom_update_match(device, bus, vendor_id, product_id);
+ if (g_strcmp0 (match, GENERIC_DEVICE_MATCH) == 0) {
+ libwacom_update_match(device, WBUSTYPE_UNKNOWN, 0, 0);
+ return 1;
+ }
- if (nmatches == 0) {
- first_bus = bus;
- first_vendor_id = vendor_id;
- first_product_id = product_id;
- }
- nmatches++;
+ rc = sscanf(match, "%63[^:]:%x:%x", busstr, &vendor_id, &product_id);
+ if (rc != 3) {
+ DBG("failed to match '%s' for product/vendor IDs. Skipping.\n", match);
+ return 0;
}
+ bus = bus_from_str (busstr);
- /* set default to first entry */
- if (nmatches > 1)
- libwacom_update_match(device, first_bus, first_vendor_id, first_product_id);
+ libwacom_update_match(device, bus, vendor_id, product_id);
- g_strfreev(strs);
- return i;
+ return 1;
}
static void
@@ -397,19 +383,29 @@ libwacom_parse_tablet_keyfile(const char *datadir, const char *filename)
device = g_new0 (WacomDevice, 1);
- match = g_key_file_get_string(keyfile, DEVICE_GROUP, "DeviceMatch", NULL);
- if (g_strcmp0 (match, GENERIC_DEVICE_MATCH) == 0) {
- libwacom_update_match(device, WBUSTYPE_UNKNOWN, 0, 0);
- } else {
- if (libwacom_matchstr_to_matches(device, match) == 0) {
- DBG("failed to match '%s' for product/vendor IDs in '%s'\n", match, path);
- g_free (match);
- g_free (device);
- device = NULL;
- goto out;
+ string_list = g_key_file_get_string_list(keyfile, DEVICE_GROUP, "DeviceMatch", NULL, NULL);
+ if (string_list) {
+ guint i;
+ guint nmatches = 0;
+ guint first_valid_match = 0;
+ for (i = 0; string_list[i]; i++) {
+ nmatches += libwacom_matchstr_to_match (device, string_list[i]);
+ if (nmatches == 1)
+ first_valid_match = i;
}
+ if (nmatches == 0) {
+ DBG("failed to match '%s' for product/vendor IDs in '%s'\n", string_list[i], path);
+ g_strfreev (string_list);
+ g_free (device);
+ device = NULL;
+ goto out;
+ }
+ if (nmatches > 1) {
+ /* set default to first entry */
+ libwacom_matchstr_to_match(device, string_list[first_valid_match]);
+ }
+ g_strfreev (string_list);
}
- g_free (match);
device->name = g_key_file_get_string(keyfile, DEVICE_GROUP, "Name", NULL);
device->width = g_key_file_get_integer(keyfile, DEVICE_GROUP, "Width", NULL);
--
2.3.1
|
|
From: Benjamin T. <ben...@re...> - 2015-03-13 21:21:43
|
The match count (and update to the first correct) has to be done
in libwacom_parse_tablet_keyfile() now.
---
changes in v3:
- libwacom_matchstr_to_match now returns a gboolean
new in v2
libwacom/libwacom-database.c | 81 +++++++++++++++++++++-----------------------
1 file changed, 39 insertions(+), 42 deletions(-)
diff --git a/libwacom/libwacom-database.c b/libwacom/libwacom-database.c
index f4cb82a..3b39dba 100644
--- a/libwacom/libwacom-database.c
+++ b/libwacom/libwacom-database.c
@@ -129,46 +129,32 @@ make_match_string (WacomBusType bus, int vendor_id, int product_id)
return g_strdup_printf("%s:%04x:%04x", bus_to_str (bus), vendor_id, product_id);
}
-static int
-libwacom_matchstr_to_matches(WacomDevice *device, const char *match)
+static gboolean
+libwacom_matchstr_to_match(WacomDevice *device, const char *match)
{
int rc = 1;
- char **strs;
- int i, nmatches = 0;
- WacomBusType first_bus;
- int first_vendor_id, first_product_id;
+ char busstr[64];
+ int vendor_id, product_id;
+ WacomBusType bus;
if (match == NULL)
- return 0;
-
- strs = g_strsplit(match, ";", 0);
- for (i = 0; strs[i] != NULL && *strs[i] != '\0'; i++) {
- char busstr[64];
- int vendor_id, product_id;
- WacomBusType bus;
- rc = sscanf(strs[i], "%63[^:]:%x:%x", busstr, &vendor_id, &product_id);
- if (rc != 3) {
- DBG("failed to match '%s' for product/vendor IDs. Skipping.\n", strs[i]);
- continue;
- }
- bus = bus_from_str (busstr);
+ return FALSE;
- libwacom_update_match(device, bus, vendor_id, product_id);
+ if (g_strcmp0 (match, GENERIC_DEVICE_MATCH) == 0) {
+ libwacom_update_match(device, WBUSTYPE_UNKNOWN, 0, 0);
+ return TRUE;
+ }
- if (nmatches == 0) {
- first_bus = bus;
- first_vendor_id = vendor_id;
- first_product_id = product_id;
- }
- nmatches++;
+ rc = sscanf(match, "%63[^:]:%x:%x", busstr, &vendor_id, &product_id);
+ if (rc != 3) {
+ DBG("failed to match '%s' for product/vendor IDs. Skipping.\n", match);
+ return 0;
}
+ bus = bus_from_str (busstr);
- /* set default to first entry */
- if (nmatches > 1)
- libwacom_update_match(device, first_bus, first_vendor_id, first_product_id);
+ libwacom_update_match(device, bus, vendor_id, product_id);
- g_strfreev(strs);
- return i;
+ return TRUE;
}
static void
@@ -397,19 +383,30 @@ libwacom_parse_tablet_keyfile(const char *datadir, const char *filename)
device = g_new0 (WacomDevice, 1);
- match = g_key_file_get_string(keyfile, DEVICE_GROUP, "DeviceMatch", NULL);
- if (g_strcmp0 (match, GENERIC_DEVICE_MATCH) == 0) {
- libwacom_update_match(device, WBUSTYPE_UNKNOWN, 0, 0);
- } else {
- if (libwacom_matchstr_to_matches(device, match) == 0) {
- DBG("failed to match '%s' for product/vendor IDs in '%s'\n", match, path);
- g_free (match);
- g_free (device);
- device = NULL;
- goto out;
+ string_list = g_key_file_get_string_list(keyfile, DEVICE_GROUP, "DeviceMatch", NULL, NULL);
+ if (string_list) {
+ guint i;
+ guint nmatches = 0;
+ guint first_valid_match = 0;
+ for (i = 0; string_list[i]; i++) {
+ if (libwacom_matchstr_to_match (device, string_list[i]))
+ nmatches++;
+ if (nmatches == 1)
+ first_valid_match = i;
+ }
+ if (nmatches == 0) {
+ DBG("failed to match '%s' for product/vendor IDs in '%s'\n", string_list[i], path);
+ g_strfreev (string_list);
+ g_free (device);
+ device = NULL;
+ goto out;
}
+ if (nmatches > 1) {
+ /* set default to first entry */
+ libwacom_matchstr_to_match(device, string_list[first_valid_match]);
+ }
+ g_strfreev (string_list);
}
- g_free (match);
device->name = g_key_file_get_string(keyfile, DEVICE_GROUP, "Name", NULL);
device->width = g_key_file_get_integer(keyfile, DEVICE_GROUP, "Width", NULL);
--
2.3.1
|
|
From: Benjamin T. <ben...@re...> - 2015-03-13 21:21:45
|
To support generic tablets, we need to extend the matching pattern of
libwacom. The Huion tablets reuse the same VID:PID accross all of the
products. To be able to differentiate between the models, we can somewhat
rely on the name of the product. It doesn't seem very reliable (for
instance, the H610 Pro and the W58 seems to share the same name), but it
should allow a good amount of them to be added to the DB.
The current usb:VID:PID pattern is still working, we add a new pattern
usb:VID:PID:NAME.
For devices with their name in the matching pattern, the function
libwacom_new_from_usbid() does not work. We encourage users to use
libwacom_new_from_path() instead. (g-c-c and g-s-d already use that, and
libinput just switched to it).
---
changes in v3:
- rebased on top of previous one
changes in v2:
- libwacom_new_from_path() now tries with or without name (or an extra match
was appended to the device)
- rebased on previous patch
libwacom/libwacom-database.c | 25 ++++++++++++++++++-------
libwacom/libwacom.c | 43 ++++++++++++++++++++++++++++++-------------
libwacom/libwacom.h | 1 +
libwacom/libwacomint.h | 6 +++---
4 files changed, 52 insertions(+), 23 deletions(-)
diff --git a/libwacom/libwacom-database.c b/libwacom/libwacom-database.c
index 3b39dba..841d2b4 100644
--- a/libwacom/libwacom-database.c
+++ b/libwacom/libwacom-database.c
@@ -124,16 +124,21 @@ bus_to_str (WacomBusType bus)
}
char *
-make_match_string (WacomBusType bus, int vendor_id, int product_id)
+make_match_string (const char *name, WacomBusType bus, int vendor_id, int product_id)
{
- return g_strdup_printf("%s:%04x:%04x", bus_to_str (bus), vendor_id, product_id);
+ return g_strdup_printf("%s:%04x:%04x%s%s",
+ bus_to_str (bus),
+ vendor_id, product_id,
+ name ? ":" : "",
+ name ? name : "");
}
static gboolean
libwacom_matchstr_to_match(WacomDevice *device, const char *match)
{
int rc = 1;
- char busstr[64];
+ char busstr[64], namestr[64];
+ char *name;
int vendor_id, product_id;
WacomBusType bus;
@@ -141,18 +146,24 @@ libwacom_matchstr_to_match(WacomDevice *device, const char *match)
return FALSE;
if (g_strcmp0 (match, GENERIC_DEVICE_MATCH) == 0) {
- libwacom_update_match(device, WBUSTYPE_UNKNOWN, 0, 0);
+ libwacom_update_match(device, NULL, WBUSTYPE_UNKNOWN, 0, 0);
return TRUE;
}
- rc = sscanf(match, "%63[^:]:%x:%x", busstr, &vendor_id, &product_id);
- if (rc != 3) {
+ memset(namestr, 0, sizeof(namestr));
+
+ rc = sscanf(match, "%63[^:]:%x:%x:%63c", busstr, &vendor_id, &product_id, namestr);
+ if (rc == 4) {
+ name = namestr;
+ } else if (rc == 3) {
+ name = NULL;
+ } else {
DBG("failed to match '%s' for product/vendor IDs. Skipping.\n", match);
return 0;
}
bus = bus_from_str (busstr);
- libwacom_update_match(device, bus, vendor_id, product_id);
+ libwacom_update_match(device, name, bus, vendor_id, product_id);
return TRUE;
}
diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
index d100793..b389ef5 100644
--- a/libwacom/libwacom.c
+++ b/libwacom/libwacom.c
@@ -300,6 +300,7 @@ static WacomMatch *libwacom_copy_match(const WacomMatch *src)
dst = g_new0(WacomMatch, 1);
dst->match = g_strdup(src->match);
+ dst->name = g_strdup(src->name);
dst->bus = src->bus;
dst->vendor_id = src->vendor_id;
dst->product_id = src->product_id;
@@ -448,7 +449,7 @@ libwacom_compare(const WacomDevice *a, const WacomDevice *b, WacomCompareFlags f
}
static const WacomDevice *
-libwacom_new (const WacomDeviceDatabase *db, int vendor_id, int product_id, WacomBusType bus, WacomError *error)
+libwacom_new (const WacomDeviceDatabase *db, const char *name, int vendor_id, int product_id, WacomBusType bus, WacomError *error)
{
const WacomDevice *device;
char *match;
@@ -458,7 +459,7 @@ libwacom_new (const WacomDeviceDatabase *db, int vendor_id, int product_id, Waco
return NULL;
}
- match = make_match_string(bus, vendor_id, product_id);
+ match = make_match_string(name, bus, vendor_id, product_id);
device = libwacom_get_device(db, match);
g_free (match);
@@ -473,7 +474,7 @@ libwacom_new_from_path(const WacomDeviceDatabase *db, const char *path, WacomFal
const WacomDevice *device;
WacomDevice *ret;
WacomIntegrationFlags integration_flags;
- char *name;
+ char *name, *match_name;
if (!db) {
libwacom_error_set(error, WERROR_INVALID_DB, "db is NULL");
@@ -488,7 +489,12 @@ libwacom_new_from_path(const WacomDeviceDatabase *db, const char *path, WacomFal
if (!get_device_info (path, &vendor_id, &product_id, &name, &bus, &integration_flags, error))
return NULL;
- device = libwacom_new (db, vendor_id, product_id, bus, error);
+ match_name = name;
+ device = libwacom_new (db, match_name, vendor_id, product_id, bus, error);
+ if (device == NULL) {
+ match_name = NULL;
+ device = libwacom_new (db, match_name, vendor_id, product_id, bus, error);
+ }
if (device != NULL)
ret = libwacom_copy(device);
else if (fallback == WFALLBACK_NONE)
@@ -503,14 +509,14 @@ libwacom_new_from_path(const WacomDeviceDatabase *db, const char *path, WacomFal
if (name != NULL) {
g_free (ret->name);
- ret->name = name;
+ ret->name = g_strdup(name);
}
- } else {
- g_free (name);
}
/* for multiple-match devices, set to the one we requested */
- libwacom_update_match(ret, bus, vendor_id, product_id);
+ libwacom_update_match(ret, match_name, bus, vendor_id, product_id);
+
+ g_free (name);
if (device) {
/* if unset, use the kernel flags. Could be unset as well. */
@@ -536,7 +542,7 @@ libwacom_new_from_usbid(const WacomDeviceDatabase *db, int vendor_id, int produc
return NULL;
}
- device = libwacom_new(db, vendor_id, product_id, WBUSTYPE_USB, error);
+ device = libwacom_new(db, NULL, vendor_id, product_id, WBUSTYPE_USB, error);
if (device)
return libwacom_copy(device);
@@ -706,6 +712,7 @@ libwacom_print_device_description(int fd, const WacomDevice *device)
dprintf(fd, "Name=%s\n", libwacom_get_name(device));
dprintf(fd, "DeviceMatch=");
for (match = libwacom_get_matches(device); *match; match++) {
+ const char *name = libwacom_match_get_name(*match);
WacomBusType type = libwacom_match_get_bustype(*match);
int vendor = libwacom_match_get_vendor_id(*match);
int product = libwacom_match_get_product_id(*match);
@@ -717,7 +724,10 @@ libwacom_print_device_description(int fd, const WacomDevice *device)
case WBUSTYPE_UNKNOWN: bus_name = "unknown"; break;
default: g_assert_not_reached(); break;
}
- dprintf(fd, "%s:%04x:%04x;", bus_name, vendor, product);
+ dprintf(fd, "%s:%04x:%04x", bus_name, vendor, product);
+ if (name)
+ dprintf(fd, ":%s", name);
+ dprintf(fd, ";");
}
dprintf(fd, "\n");
@@ -758,6 +768,7 @@ libwacom_destroy(WacomDevice *device)
for (i = 0; i < device->nmatches; i++) {
g_free (device->matches[i]->match);
+ g_free (device->matches[i]->name);
g_free (device->matches[i]);
}
g_free (device->matches);
@@ -768,18 +779,19 @@ libwacom_destroy(WacomDevice *device)
}
void
-libwacom_update_match(WacomDevice *device, WacomBusType bus, int vendor_id, int product_id)
+libwacom_update_match(WacomDevice *device, const char *name, WacomBusType bus, int vendor_id, int product_id)
{
char *newmatch;
int i;
WacomMatch match;
- if (bus == WBUSTYPE_UNKNOWN && vendor_id == 0 && product_id == 0)
+ if (name == NULL && bus == WBUSTYPE_UNKNOWN && vendor_id == 0 && product_id == 0)
newmatch = g_strdup("generic");
else
- newmatch = make_match_string(bus, vendor_id, product_id);
+ newmatch = make_match_string(name, bus, vendor_id, product_id);
match.match = newmatch;
+ match.name = g_strdup(name);
match.bus = bus;
match.vendor_id = vendor_id;
match.product_id = product_id;
@@ -1100,6 +1112,11 @@ void libwacom_stylus_destroy(WacomStylus *stylus)
}
+const char *libwacom_match_get_name(const WacomMatch *match)
+{
+ return match->name;
+}
+
WacomBusType libwacom_match_get_bustype(const WacomMatch *match)
{
return match->bus;
diff --git a/libwacom/libwacom.h b/libwacom/libwacom.h
index 60c873f..a0778c5 100644
--- a/libwacom/libwacom.h
+++ b/libwacom/libwacom.h
@@ -602,6 +602,7 @@ WacomStylusType libwacom_stylus_get_type (const WacomStylus *stylus);
*/
void libwacom_print_stylus_description (int fd, const WacomStylus *stylus);
+const char *libwacom_match_get_name(const WacomMatch *match);
WacomBusType libwacom_match_get_bustype(const WacomMatch *match);
uint32_t libwacom_match_get_product_id(const WacomMatch *match);
uint32_t libwacom_match_get_vendor_id(const WacomMatch *match);
diff --git a/libwacom/libwacomint.h b/libwacom/libwacomint.h
index 3ba54cc..825f9e9 100644
--- a/libwacom/libwacomint.h
+++ b/libwacom/libwacomint.h
@@ -54,6 +54,7 @@ enum WacomFeature {
* make sure to update libwacom_copy_match() ! */
struct _WacomMatch {
char *match;
+ char *name;
WacomBusType bus;
uint32_t vendor_id;
uint32_t product_id;
@@ -119,12 +120,11 @@ struct _WacomError {
/* INTERNAL */
void libwacom_error_set(WacomError *error, enum WacomErrorCode code, const char *msg, ...);
void libwacom_stylus_destroy(WacomStylus *stylus);
-void libwacom_update_match(WacomDevice *device, WacomBusType bus, int vendor_id, int product_id);
+void libwacom_update_match(WacomDevice *device, const char *name, WacomBusType bus, int vendor_id, int product_id);
WacomBusType bus_from_str (const char *str);
const char *bus_to_str (WacomBusType bus);
-char *make_match_string(WacomBusType bus, int vendor_id, int product_id);
-
+char *make_match_string(const char *name, WacomBusType bus, int vendor_id, int product_id);
#endif /* _LIBWACOMINT_H_ */
--
2.3.1
|
|
From: Benjamin T. <ben...@re...> - 2015-03-13 21:21:46
|
--- no changes in v3 data/huion-h610-pro.tablet | 23 ++++++ data/layouts/huion-h610-pro.svg | 153 ++++++++++++++++++++++++++++++++++++++++ data/libwacom.stylus | 7 ++ 3 files changed, 183 insertions(+) create mode 100644 data/huion-h610-pro.tablet create mode 100644 data/layouts/huion-h610-pro.svg diff --git a/data/huion-h610-pro.tablet b/data/huion-h610-pro.tablet new file mode 100644 index 0000000..484c390 --- /dev/null +++ b/data/huion-h610-pro.tablet @@ -0,0 +1,23 @@ +# HUION +# H610 Pro +# + +[Device] +Name=Huion H610 Pro +DeviceMatch=usb:256c:006e:HUION PenTablet Pen;usb:256c:006e:HUION PenTablet Pad +Class=Bamboo +Width=10 +Height=6 +IntegratedIn= +Layout=huion-h610-pro.svg +Styli=0xffffd; + +[Features] +Stylus=true +Reversible=true +Touch=false +Buttons=8 + +[Buttons] +Left=A;B;C;D;E;F;G;H + diff --git a/data/layouts/huion-h610-pro.svg b/data/layouts/huion-h610-pro.svg new file mode 100644 index 0000000..0402995 --- /dev/null +++ b/data/layouts/huion-h610-pro.svg @@ -0,0 +1,153 @@ +<?xml version="1.0" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" + "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg + xmlns="http://www.w3.org/2000/svg" + version="1.1" + style="color:#000000;stroke:#7f7f7f;fill:none;stroke-width:.25;font-size:8" + id="intuos-pro-m" + width="355" + height="250"> + <title + id="title">Huion H610 Pro</title> + <g> + <circle + id="ButtonA" + class="A ModeSwitch Button" + cx="29" + cy="56" + r="7.5" /> + <path + id="LeaderA" + class="A ModeSwitch Leader" + d="m 51,56 4,0" /> + <text + id="LabelA" + class="A ModeSwitch Label" + x="57" + y="56" + style="text-anchor:start">A</text> + </g> + <g> + <circle + r="7.5" + cy="75" + cx="29" + class="B ModeSwitch Button" + id="ButtonB" /> + <path + d="m 51,75 4,0" + class="B ModeSwitch Leader" + id="LeaderB" /> + <text + style="text-anchor:start" + y="75" + x="57" + class="B ModeSwitch Label" + id="LabelB">B</text> + </g> + <g> + <circle + id="ButtonC" + class="C ModeSwitch Button" + cx="29" + cy="94" + r="7.5" /> + <path + id="LeaderC" + class="C ModeSwitch Leader" + d="m 51,94 4,0" /> + <text + id="LabelC" + class="C ModeSwitch Label" + x="57" + y="94" + style="text-anchor:start">C</text> + </g> + <g> + <path + id="ButtonD" + class="D ModeSwitch Button" + d="m 18.056792,123.54602 c 0.300764,-2.53638 1.528708,-4.99316 3.165033,-6.65348 1.990614,-1.99061 4.740609,-3.22183 7.778175,-3.22183 3.037566,0 5.787566,1.23122 7.778174,3.22183 1.772939,2.1284 2.827481,4.24769 3.165034,6.65348 -10.929806,-3.03352 -12.689135,3.86 -21.886416,0 z"/> + <path + id="LeaderD" + class="D ModeSwitch Leader" + d="m 51,118 4,0" /> + <text + id="LabelD" + class="D ModeSwitch Label" + x="57" + y="118" + style="text-anchor:start">D</text> + </g> + <g> + <path + d="m 39.943205,125.91036 c -0.30076,2.53638 -1.5287,4.99316 -3.16503,6.65348 -1.99061,1.99061 -4.74061,3.22183 -7.77817,3.22183 -3.03757,0 -5.78757,-1.23122 -7.77818,-3.22183 -1.77294,-2.1284 -2.82748,-4.24769 -3.16503,-6.65348 10.9298,3.03352 12.68913,-3.86 21.88641,0 z" + id="ButtonE" + class="E ModeSwitch Button" /> + <path + id="LeaderE" + class="E ModeSwitch Leader" + d="m 51,132 4,0" /> + <text + id="LabelE" + class="E ModeSwitch Label" + x="57" + y="132" + style="text-anchor:start">E</text> + </g> + <g> + <circle + id="ButtonF" + class="F ModeSwitch Button" + cx="29" + cy="156" + r="7.5" /> + <path + id="LeaderF" + class="F ModeSwitch Leader" + d="m 51,156 4,0" /> + <text + id="LabelF" + class="F ModeSwitch Label" + x="57" + y="156" + style="text-anchor:start">F</text> + </g> + <g> + <circle + id="ButtonG" + class="G ModeSwitch Button" + cx="29" + cy="175" + r="7.5" /> + <path + id="LeaderG" + class="G ModeSwitch Leader" + d="m 51,175 4,0" /> + <text + id="LabelG" + class="G ModeSwitch Label" + x="57" + y="175" + style="text-anchor:start">G</text> + </g> + <g> + <circle + id="ButtonH" + class="H ModeSwitch Button" + cx="29" + cy="194" + r="7.5" /> + <path + id="LeaderH" + class="H ModeSwitch Leader" + d="m 51,194 4,0" /> + <text + id="LabelH" + class="H ModeSwitch Label" + x="57" + y="194" + style="text-anchor:start">H</text> + </g> +</svg> diff --git a/data/libwacom.stylus b/data/libwacom.stylus index f0c6c4e..aeaee81 100644 --- a/data/libwacom.stylus +++ b/data/libwacom.stylus @@ -13,6 +13,13 @@ Buttons=2 Axes=Tilt;Pressure;Distance; Type=General +[0xffffd] +Name=General Pen with no Eraser +HasEraser=false +Buttons=2 +Axes=Pressure; +Type=General + # Inking pen have no eraser [0x812] # Intuos and Intuos2 -- 2.3.1 |
|
From: Peter H. <pet...@wh...> - 2015-03-16 02:32:34
|
On Fri, Mar 13, 2015 at 05:21:31PM -0400, Benjamin Tissoires wrote:
> The match count (and update to the first correct) has to be done
> in libwacom_parse_tablet_keyfile() now.
> ---
>
> changes in v3:
> - libwacom_matchstr_to_match now returns a gboolean
>
> new in v2
series pushed, with a fix to the tablet-validity test case
40ece8c..c621fb6 master -> master
thanks.
Cheers,
Peter
> libwacom/libwacom-database.c | 81 +++++++++++++++++++++-----------------------
> 1 file changed, 39 insertions(+), 42 deletions(-)
>
> diff --git a/libwacom/libwacom-database.c b/libwacom/libwacom-database.c
> index f4cb82a..3b39dba 100644
> --- a/libwacom/libwacom-database.c
> +++ b/libwacom/libwacom-database.c
> @@ -129,46 +129,32 @@ make_match_string (WacomBusType bus, int vendor_id, int product_id)
> return g_strdup_printf("%s:%04x:%04x", bus_to_str (bus), vendor_id, product_id);
> }
>
> -static int
> -libwacom_matchstr_to_matches(WacomDevice *device, const char *match)
> +static gboolean
> +libwacom_matchstr_to_match(WacomDevice *device, const char *match)
> {
> int rc = 1;
> - char **strs;
> - int i, nmatches = 0;
> - WacomBusType first_bus;
> - int first_vendor_id, first_product_id;
> + char busstr[64];
> + int vendor_id, product_id;
> + WacomBusType bus;
>
> if (match == NULL)
> - return 0;
> -
> - strs = g_strsplit(match, ";", 0);
> - for (i = 0; strs[i] != NULL && *strs[i] != '\0'; i++) {
> - char busstr[64];
> - int vendor_id, product_id;
> - WacomBusType bus;
> - rc = sscanf(strs[i], "%63[^:]:%x:%x", busstr, &vendor_id, &product_id);
> - if (rc != 3) {
> - DBG("failed to match '%s' for product/vendor IDs. Skipping.\n", strs[i]);
> - continue;
> - }
> - bus = bus_from_str (busstr);
> + return FALSE;
>
> - libwacom_update_match(device, bus, vendor_id, product_id);
> + if (g_strcmp0 (match, GENERIC_DEVICE_MATCH) == 0) {
> + libwacom_update_match(device, WBUSTYPE_UNKNOWN, 0, 0);
> + return TRUE;
> + }
>
> - if (nmatches == 0) {
> - first_bus = bus;
> - first_vendor_id = vendor_id;
> - first_product_id = product_id;
> - }
> - nmatches++;
> + rc = sscanf(match, "%63[^:]:%x:%x", busstr, &vendor_id, &product_id);
> + if (rc != 3) {
> + DBG("failed to match '%s' for product/vendor IDs. Skipping.\n", match);
> + return 0;
> }
> + bus = bus_from_str (busstr);
>
> - /* set default to first entry */
> - if (nmatches > 1)
> - libwacom_update_match(device, first_bus, first_vendor_id, first_product_id);
> + libwacom_update_match(device, bus, vendor_id, product_id);
>
> - g_strfreev(strs);
> - return i;
> + return TRUE;
> }
>
> static void
> @@ -397,19 +383,30 @@ libwacom_parse_tablet_keyfile(const char *datadir, const char *filename)
>
> device = g_new0 (WacomDevice, 1);
>
> - match = g_key_file_get_string(keyfile, DEVICE_GROUP, "DeviceMatch", NULL);
> - if (g_strcmp0 (match, GENERIC_DEVICE_MATCH) == 0) {
> - libwacom_update_match(device, WBUSTYPE_UNKNOWN, 0, 0);
> - } else {
> - if (libwacom_matchstr_to_matches(device, match) == 0) {
> - DBG("failed to match '%s' for product/vendor IDs in '%s'\n", match, path);
> - g_free (match);
> - g_free (device);
> - device = NULL;
> - goto out;
> + string_list = g_key_file_get_string_list(keyfile, DEVICE_GROUP, "DeviceMatch", NULL, NULL);
> + if (string_list) {
> + guint i;
> + guint nmatches = 0;
> + guint first_valid_match = 0;
> + for (i = 0; string_list[i]; i++) {
> + if (libwacom_matchstr_to_match (device, string_list[i]))
> + nmatches++;
> + if (nmatches == 1)
> + first_valid_match = i;
> + }
> + if (nmatches == 0) {
> + DBG("failed to match '%s' for product/vendor IDs in '%s'\n", string_list[i], path);
> + g_strfreev (string_list);
> + g_free (device);
> + device = NULL;
> + goto out;
> }
> + if (nmatches > 1) {
> + /* set default to first entry */
> + libwacom_matchstr_to_match(device, string_list[first_valid_match]);
> + }
> + g_strfreev (string_list);
> }
> - g_free (match);
>
> device->name = g_key_file_get_string(keyfile, DEVICE_GROUP, "Name", NULL);
> device->width = g_key_file_get_integer(keyfile, DEVICE_GROUP, "Width", NULL);
> --
> 2.3.1
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Linuxwacom-devel mailing list
> Lin...@li...
> https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
>
|
|
From: Benjamin T. <ben...@re...> - 2015-03-13 18:57:27
|
To support generic tablets, we need to extend the matching pattern of
libwacom. The Huion tablets reuse the same VID:PID accross all of the
products. To be able to differentiate between the models, we can somewhat
rely on the name of the product. It doesn't seem very reliable (for
instance, the H610 Pro and the W58 seems to share the same name), but it
should allow a good amount of them to be added to the DB.
The current usb:VID:PID pattern is still working, we add a new pattern
usb:VID:PID:NAME.
For devices with their name in the matching pattern, the function
libwacom_new_from_usbid() does not work. We encourage users to use
libwacom_new_from_path() instead. (g-c-c and g-s-d already use that, and
libinput just switched to it).
---
changes in v2:
- libwacom_new_from_path() now tries with or without name (or an extra match
was appended to the device)
- rebased on previous patch
libwacom/libwacom-database.c | 25 ++++++++++++++++++-------
libwacom/libwacom.c | 43 ++++++++++++++++++++++++++++++-------------
libwacom/libwacom.h | 1 +
libwacom/libwacomint.h | 6 +++---
4 files changed, 52 insertions(+), 23 deletions(-)
diff --git a/libwacom/libwacom-database.c b/libwacom/libwacom-database.c
index 8a2519a..1c701a2 100644
--- a/libwacom/libwacom-database.c
+++ b/libwacom/libwacom-database.c
@@ -124,16 +124,21 @@ bus_to_str (WacomBusType bus)
}
char *
-make_match_string (WacomBusType bus, int vendor_id, int product_id)
+make_match_string (const char *name, WacomBusType bus, int vendor_id, int product_id)
{
- return g_strdup_printf("%s:%04x:%04x", bus_to_str (bus), vendor_id, product_id);
+ return g_strdup_printf("%s:%04x:%04x%s%s",
+ bus_to_str (bus),
+ vendor_id, product_id,
+ name ? ":" : "",
+ name ? name : "");
}
static int
libwacom_matchstr_to_match(WacomDevice *device, const char *match)
{
int rc = 1;
- char busstr[64];
+ char busstr[64], namestr[64];
+ char *name;
int vendor_id, product_id;
WacomBusType bus;
@@ -141,18 +146,24 @@ libwacom_matchstr_to_match(WacomDevice *device, const char *match)
return 0;
if (g_strcmp0 (match, GENERIC_DEVICE_MATCH) == 0) {
- libwacom_update_match(device, WBUSTYPE_UNKNOWN, 0, 0);
+ libwacom_update_match(device, NULL, WBUSTYPE_UNKNOWN, 0, 0);
return 1;
}
- rc = sscanf(match, "%63[^:]:%x:%x", busstr, &vendor_id, &product_id);
- if (rc != 3) {
+ memset(namestr, 0, sizeof(namestr));
+
+ rc = sscanf(match, "%63[^:]:%x:%x:%63c", busstr, &vendor_id, &product_id, namestr);
+ if (rc == 4) {
+ name = namestr;
+ } else if (rc == 3) {
+ name = NULL;
+ } else {
DBG("failed to match '%s' for product/vendor IDs. Skipping.\n", match);
return 0;
}
bus = bus_from_str (busstr);
- libwacom_update_match(device, bus, vendor_id, product_id);
+ libwacom_update_match(device, name, bus, vendor_id, product_id);
return 1;
}
diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
index d100793..b389ef5 100644
--- a/libwacom/libwacom.c
+++ b/libwacom/libwacom.c
@@ -300,6 +300,7 @@ static WacomMatch *libwacom_copy_match(const WacomMatch *src)
dst = g_new0(WacomMatch, 1);
dst->match = g_strdup(src->match);
+ dst->name = g_strdup(src->name);
dst->bus = src->bus;
dst->vendor_id = src->vendor_id;
dst->product_id = src->product_id;
@@ -448,7 +449,7 @@ libwacom_compare(const WacomDevice *a, const WacomDevice *b, WacomCompareFlags f
}
static const WacomDevice *
-libwacom_new (const WacomDeviceDatabase *db, int vendor_id, int product_id, WacomBusType bus, WacomError *error)
+libwacom_new (const WacomDeviceDatabase *db, const char *name, int vendor_id, int product_id, WacomBusType bus, WacomError *error)
{
const WacomDevice *device;
char *match;
@@ -458,7 +459,7 @@ libwacom_new (const WacomDeviceDatabase *db, int vendor_id, int product_id, Waco
return NULL;
}
- match = make_match_string(bus, vendor_id, product_id);
+ match = make_match_string(name, bus, vendor_id, product_id);
device = libwacom_get_device(db, match);
g_free (match);
@@ -473,7 +474,7 @@ libwacom_new_from_path(const WacomDeviceDatabase *db, const char *path, WacomFal
const WacomDevice *device;
WacomDevice *ret;
WacomIntegrationFlags integration_flags;
- char *name;
+ char *name, *match_name;
if (!db) {
libwacom_error_set(error, WERROR_INVALID_DB, "db is NULL");
@@ -488,7 +489,12 @@ libwacom_new_from_path(const WacomDeviceDatabase *db, const char *path, WacomFal
if (!get_device_info (path, &vendor_id, &product_id, &name, &bus, &integration_flags, error))
return NULL;
- device = libwacom_new (db, vendor_id, product_id, bus, error);
+ match_name = name;
+ device = libwacom_new (db, match_name, vendor_id, product_id, bus, error);
+ if (device == NULL) {
+ match_name = NULL;
+ device = libwacom_new (db, match_name, vendor_id, product_id, bus, error);
+ }
if (device != NULL)
ret = libwacom_copy(device);
else if (fallback == WFALLBACK_NONE)
@@ -503,14 +509,14 @@ libwacom_new_from_path(const WacomDeviceDatabase *db, const char *path, WacomFal
if (name != NULL) {
g_free (ret->name);
- ret->name = name;
+ ret->name = g_strdup(name);
}
- } else {
- g_free (name);
}
/* for multiple-match devices, set to the one we requested */
- libwacom_update_match(ret, bus, vendor_id, product_id);
+ libwacom_update_match(ret, match_name, bus, vendor_id, product_id);
+
+ g_free (name);
if (device) {
/* if unset, use the kernel flags. Could be unset as well. */
@@ -536,7 +542,7 @@ libwacom_new_from_usbid(const WacomDeviceDatabase *db, int vendor_id, int produc
return NULL;
}
- device = libwacom_new(db, vendor_id, product_id, WBUSTYPE_USB, error);
+ device = libwacom_new(db, NULL, vendor_id, product_id, WBUSTYPE_USB, error);
if (device)
return libwacom_copy(device);
@@ -706,6 +712,7 @@ libwacom_print_device_description(int fd, const WacomDevice *device)
dprintf(fd, "Name=%s\n", libwacom_get_name(device));
dprintf(fd, "DeviceMatch=");
for (match = libwacom_get_matches(device); *match; match++) {
+ const char *name = libwacom_match_get_name(*match);
WacomBusType type = libwacom_match_get_bustype(*match);
int vendor = libwacom_match_get_vendor_id(*match);
int product = libwacom_match_get_product_id(*match);
@@ -717,7 +724,10 @@ libwacom_print_device_description(int fd, const WacomDevice *device)
case WBUSTYPE_UNKNOWN: bus_name = "unknown"; break;
default: g_assert_not_reached(); break;
}
- dprintf(fd, "%s:%04x:%04x;", bus_name, vendor, product);
+ dprintf(fd, "%s:%04x:%04x", bus_name, vendor, product);
+ if (name)
+ dprintf(fd, ":%s", name);
+ dprintf(fd, ";");
}
dprintf(fd, "\n");
@@ -758,6 +768,7 @@ libwacom_destroy(WacomDevice *device)
for (i = 0; i < device->nmatches; i++) {
g_free (device->matches[i]->match);
+ g_free (device->matches[i]->name);
g_free (device->matches[i]);
}
g_free (device->matches);
@@ -768,18 +779,19 @@ libwacom_destroy(WacomDevice *device)
}
void
-libwacom_update_match(WacomDevice *device, WacomBusType bus, int vendor_id, int product_id)
+libwacom_update_match(WacomDevice *device, const char *name, WacomBusType bus, int vendor_id, int product_id)
{
char *newmatch;
int i;
WacomMatch match;
- if (bus == WBUSTYPE_UNKNOWN && vendor_id == 0 && product_id == 0)
+ if (name == NULL && bus == WBUSTYPE_UNKNOWN && vendor_id == 0 && product_id == 0)
newmatch = g_strdup("generic");
else
- newmatch = make_match_string(bus, vendor_id, product_id);
+ newmatch = make_match_string(name, bus, vendor_id, product_id);
match.match = newmatch;
+ match.name = g_strdup(name);
match.bus = bus;
match.vendor_id = vendor_id;
match.product_id = product_id;
@@ -1100,6 +1112,11 @@ void libwacom_stylus_destroy(WacomStylus *stylus)
}
+const char *libwacom_match_get_name(const WacomMatch *match)
+{
+ return match->name;
+}
+
WacomBusType libwacom_match_get_bustype(const WacomMatch *match)
{
return match->bus;
diff --git a/libwacom/libwacom.h b/libwacom/libwacom.h
index 60c873f..a0778c5 100644
--- a/libwacom/libwacom.h
+++ b/libwacom/libwacom.h
@@ -602,6 +602,7 @@ WacomStylusType libwacom_stylus_get_type (const WacomStylus *stylus);
*/
void libwacom_print_stylus_description (int fd, const WacomStylus *stylus);
+const char *libwacom_match_get_name(const WacomMatch *match);
WacomBusType libwacom_match_get_bustype(const WacomMatch *match);
uint32_t libwacom_match_get_product_id(const WacomMatch *match);
uint32_t libwacom_match_get_vendor_id(const WacomMatch *match);
diff --git a/libwacom/libwacomint.h b/libwacom/libwacomint.h
index 3ba54cc..825f9e9 100644
--- a/libwacom/libwacomint.h
+++ b/libwacom/libwacomint.h
@@ -54,6 +54,7 @@ enum WacomFeature {
* make sure to update libwacom_copy_match() ! */
struct _WacomMatch {
char *match;
+ char *name;
WacomBusType bus;
uint32_t vendor_id;
uint32_t product_id;
@@ -119,12 +120,11 @@ struct _WacomError {
/* INTERNAL */
void libwacom_error_set(WacomError *error, enum WacomErrorCode code, const char *msg, ...);
void libwacom_stylus_destroy(WacomStylus *stylus);
-void libwacom_update_match(WacomDevice *device, WacomBusType bus, int vendor_id, int product_id);
+void libwacom_update_match(WacomDevice *device, const char *name, WacomBusType bus, int vendor_id, int product_id);
WacomBusType bus_from_str (const char *str);
const char *bus_to_str (WacomBusType bus);
-char *make_match_string(WacomBusType bus, int vendor_id, int product_id);
-
+char *make_match_string(const char *name, WacomBusType bus, int vendor_id, int product_id);
#endif /* _LIBWACOMINT_H_ */
--
2.3.1
|
|
From: Benjamin T. <ben...@re...> - 2015-03-13 18:57:27
|
--- changed in v2: - renamed 0xffffd stylus in "General Pen with no Eraser" data/huion-h610-pro.tablet | 23 ++++++ data/layouts/huion-h610-pro.svg | 153 ++++++++++++++++++++++++++++++++++++++++ data/libwacom.stylus | 7 ++ 3 files changed, 183 insertions(+) create mode 100644 data/huion-h610-pro.tablet create mode 100644 data/layouts/huion-h610-pro.svg diff --git a/data/huion-h610-pro.tablet b/data/huion-h610-pro.tablet new file mode 100644 index 0000000..484c390 --- /dev/null +++ b/data/huion-h610-pro.tablet @@ -0,0 +1,23 @@ +# HUION +# H610 Pro +# + +[Device] +Name=Huion H610 Pro +DeviceMatch=usb:256c:006e:HUION PenTablet Pen;usb:256c:006e:HUION PenTablet Pad +Class=Bamboo +Width=10 +Height=6 +IntegratedIn= +Layout=huion-h610-pro.svg +Styli=0xffffd; + +[Features] +Stylus=true +Reversible=true +Touch=false +Buttons=8 + +[Buttons] +Left=A;B;C;D;E;F;G;H + diff --git a/data/layouts/huion-h610-pro.svg b/data/layouts/huion-h610-pro.svg new file mode 100644 index 0000000..0402995 --- /dev/null +++ b/data/layouts/huion-h610-pro.svg @@ -0,0 +1,153 @@ +<?xml version="1.0" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" + "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg + xmlns="http://www.w3.org/2000/svg" + version="1.1" + style="color:#000000;stroke:#7f7f7f;fill:none;stroke-width:.25;font-size:8" + id="intuos-pro-m" + width="355" + height="250"> + <title + id="title">Huion H610 Pro</title> + <g> + <circle + id="ButtonA" + class="A ModeSwitch Button" + cx="29" + cy="56" + r="7.5" /> + <path + id="LeaderA" + class="A ModeSwitch Leader" + d="m 51,56 4,0" /> + <text + id="LabelA" + class="A ModeSwitch Label" + x="57" + y="56" + style="text-anchor:start">A</text> + </g> + <g> + <circle + r="7.5" + cy="75" + cx="29" + class="B ModeSwitch Button" + id="ButtonB" /> + <path + d="m 51,75 4,0" + class="B ModeSwitch Leader" + id="LeaderB" /> + <text + style="text-anchor:start" + y="75" + x="57" + class="B ModeSwitch Label" + id="LabelB">B</text> + </g> + <g> + <circle + id="ButtonC" + class="C ModeSwitch Button" + cx="29" + cy="94" + r="7.5" /> + <path + id="LeaderC" + class="C ModeSwitch Leader" + d="m 51,94 4,0" /> + <text + id="LabelC" + class="C ModeSwitch Label" + x="57" + y="94" + style="text-anchor:start">C</text> + </g> + <g> + <path + id="ButtonD" + class="D ModeSwitch Button" + d="m 18.056792,123.54602 c 0.300764,-2.53638 1.528708,-4.99316 3.165033,-6.65348 1.990614,-1.99061 4.740609,-3.22183 7.778175,-3.22183 3.037566,0 5.787566,1.23122 7.778174,3.22183 1.772939,2.1284 2.827481,4.24769 3.165034,6.65348 -10.929806,-3.03352 -12.689135,3.86 -21.886416,0 z"/> + <path + id="LeaderD" + class="D ModeSwitch Leader" + d="m 51,118 4,0" /> + <text + id="LabelD" + class="D ModeSwitch Label" + x="57" + y="118" + style="text-anchor:start">D</text> + </g> + <g> + <path + d="m 39.943205,125.91036 c -0.30076,2.53638 -1.5287,4.99316 -3.16503,6.65348 -1.99061,1.99061 -4.74061,3.22183 -7.77817,3.22183 -3.03757,0 -5.78757,-1.23122 -7.77818,-3.22183 -1.77294,-2.1284 -2.82748,-4.24769 -3.16503,-6.65348 10.9298,3.03352 12.68913,-3.86 21.88641,0 z" + id="ButtonE" + class="E ModeSwitch Button" /> + <path + id="LeaderE" + class="E ModeSwitch Leader" + d="m 51,132 4,0" /> + <text + id="LabelE" + class="E ModeSwitch Label" + x="57" + y="132" + style="text-anchor:start">E</text> + </g> + <g> + <circle + id="ButtonF" + class="F ModeSwitch Button" + cx="29" + cy="156" + r="7.5" /> + <path + id="LeaderF" + class="F ModeSwitch Leader" + d="m 51,156 4,0" /> + <text + id="LabelF" + class="F ModeSwitch Label" + x="57" + y="156" + style="text-anchor:start">F</text> + </g> + <g> + <circle + id="ButtonG" + class="G ModeSwitch Button" + cx="29" + cy="175" + r="7.5" /> + <path + id="LeaderG" + class="G ModeSwitch Leader" + d="m 51,175 4,0" /> + <text + id="LabelG" + class="G ModeSwitch Label" + x="57" + y="175" + style="text-anchor:start">G</text> + </g> + <g> + <circle + id="ButtonH" + class="H ModeSwitch Button" + cx="29" + cy="194" + r="7.5" /> + <path + id="LeaderH" + class="H ModeSwitch Leader" + d="m 51,194 4,0" /> + <text + id="LabelH" + class="H ModeSwitch Label" + x="57" + y="194" + style="text-anchor:start">H</text> + </g> +</svg> diff --git a/data/libwacom.stylus b/data/libwacom.stylus index f0c6c4e..aeaee81 100644 --- a/data/libwacom.stylus +++ b/data/libwacom.stylus @@ -13,6 +13,13 @@ Buttons=2 Axes=Tilt;Pressure;Distance; Type=General +[0xffffd] +Name=General Pen with no Eraser +HasEraser=false +Buttons=2 +Axes=Pressure; +Type=General + # Inking pen have no eraser [0x812] # Intuos and Intuos2 -- 2.3.1 |
|
From: Bastien N. <ha...@ha...> - 2015-03-13 20:38:53
|
On Fri, 2015-03-13 at 14:57 -0400, Benjamin Tissoires wrote:
> The match count (and update to the first correct) has to be done in
> libwacom_parse_tablet_keyfile() now.
> ---
>
> New in v2 (requested by Bastien)
>
> libwacom/libwacom-database.c | 76 +++++++++++++++++++++-------------
> ----------
> 1 file changed, 36 insertions(+), 40 deletions(-)
>
> diff --git a/libwacom/libwacom-database.c b/libwacom/libwacom-
> database.c index f4cb82a..8a2519a 100644
> --- a/libwacom/libwacom-database.c
> +++ b/libwacom/libwacom-database.c
> @@ -130,45 +130,31 @@ make_match_string (WacomBusType bus, int
> vendor_id, int product_id)
> }
>
> static int
Seeing as you end up returning 0 or 1, just return a gboolean (and
TRUE/FALSE) instead and...
> -libwacom_matchstr_to_matches(WacomDevice *device, const char *match)
> +libwacom_matchstr_to_match(WacomDevice *device, const char *match)
> <snip>
> + for (i = 0; string_list[i]; i++) {
> + nmatches += libwacom_matchstr_to_match
> (device, string_list[i]);
if (libwacom_matchstr_to_match (device, string_list[i]))
nmatches++;
etc.
Rest looks good.
|