From: "Paul A. Tessier" <phern...@gmail.com> For tablets connected through the wireless dongle, the dev_match sysfs attribute is read to get the correct tablet model.
Signed-off-by: Paul A. Tessier <phern...@gmail.com> --- libwacom/libwacom.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c index 574e6f3..e242ee2 100644 --- a/libwacom/libwacom.c +++ b/libwacom/libwacom.c @@ -47,6 +47,16 @@ #define INPUT_PROP_DIRECT 0x01 /* direct input devices */ #endif +#define WACOM_WIRELESS_KIT_VENDOR_ID 0x056a +#define WACOM_WIRELESS_KIT_PRODUCT_ID 0x0084 + +static gboolean +is_wireless(int vendor_id, int product_id) +{ + return vendor_id == WACOM_WIRELESS_KIT_VENDOR_ID && + product_id == WACOM_WIRELESS_KIT_PRODUCT_ID; +} + static const WacomDevice * libwacom_get_device(const WacomDeviceDatabase *db, const char *match) { @@ -207,7 +217,7 @@ get_device_info (const char *path, *bus = bus_from_str (bus_str); if (*bus == WBUSTYPE_USB) { - const char *vendor_str, *product_str; + const char *vendor_str, *product_str, *match_str; GUdevDevice *parent; vendor_str = g_udev_device_get_property (device, "ID_VENDOR_ID"); @@ -221,14 +231,33 @@ get_device_info (const char *path, if (parent) { vendor_str = g_udev_device_get_property (parent, "ID_VENDOR_ID"); product_str = g_udev_device_get_property (parent, "ID_MODEL_ID"); + g_object_unref (parent); } } *vendor_id = strtol (vendor_str, NULL, 16); *product_id = strtol (product_str, NULL, 16); - - if (parent) + + if (is_wireless (*vendor_id, *product_id)) { + parent = g_udev_device_get_parent_with_subsystem ( + device, "usb", "usb_interface"); + if (!parent) + goto bail; + match_str = g_udev_device_get_sysfs_attr (parent, + "dev_match"); g_object_unref (parent); + + if (!match_str) + goto bail; + + if (sscanf(match_str, "%x:%x", vendor_id, product_id) + != 2) { + libwacom_error_set(error, WERROR_UNKNOWN_MODEL, + "Unable to parse wireless tablet model"); + goto bail; + } + } + } else if (*bus == WBUSTYPE_BLUETOOTH || *bus == WBUSTYPE_SERIAL) { GUdevDevice *parent; const char *product_str; -- 1.8.3.2 ------------------------------------------------------------------------------ _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel