Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 libwacom/libwacom.c    |   17 ++++++++++++-----
 libwacom/libwacomint.h |    2 ++
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
index 5b9bdd2..05ac6f1 100644
--- a/libwacom/libwacom.c
+++ b/libwacom/libwacom.c
@@ -100,6 +100,7 @@ get_device_info (const char   *path,
                sysfs_path = g_build_filename ("/sys/class/input", devname, 
"device/properties", NULL);
                if (g_file_get_contents (sysfs_path, &contents, NULL, NULL)) {
                        int flag;
+
                        /* 0x01: POINTER flag
                         * 0x02: DIRECT flag */
                        flag = atoi(contents);
@@ -255,11 +256,7 @@ libwacom_new_from_path(WacomDeviceDatabase *db, const char 
*path, int fallback,
                    g_free (ret->name);
                    ret->name = name;
            }
-           ret->vendor_id = vendor_id;
-           ret->product_id = product_id;
-           ret->bus = bus;
-           g_free (ret->match);
-           ret->match = g_strdup_printf ("%s:0x%x:0x%x", bus_to_str (bus), 
vendor_id, product_id);
+           libwacom_update_match(ret, bus, vendor_id, product_id);
     } else {
            g_free (name);
     }
@@ -339,6 +336,16 @@ libwacom_destroy(WacomDevice *device)
        g_free (device);
 }
 
+void
+libwacom_update_match(WacomDevice *device, WacomBusType bus, int vendor_id, 
int product_id)
+{
+       device->vendor_id = vendor_id;
+       device->product_id = product_id;
+       device->bus = bus;
+       g_free(device->match);
+       device->match = g_strdup_printf("%s:0x%x:0x%x", bus_to_str (bus), 
vendor_id, product_id);
+}
+
 int libwacom_get_vendor_id(WacomDevice *device)
 {
     return device->vendor_id;
diff --git a/libwacom/libwacomint.h b/libwacom/libwacomint.h
index 5dcff6a..9d5ed7a 100644
--- a/libwacom/libwacomint.h
+++ b/libwacom/libwacomint.h
@@ -120,10 +120,12 @@ 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);
 
 WacomBusType  bus_from_str (const char *str);
 const char   *bus_to_str   (WacomBusType bus);
 
+
 #endif /* _LIBWACOMINT_H_ */
 
 /* vim: set noexpandtab shiftwidth=8: */
-- 
1.7.10


------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to