summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2012-02-06 17:02:40 +0000
committerBastien Nocera <hadess@hadess.net>2012-02-06 17:34:23 +0000
commitd143dd86e5ba17b76edaac9af213388658c64654 (patch)
treecd158c470135231daeab50fcdef666f2b6e72d57
parentf02b77757f36016636cfa5cc2bf489ceb4708643 (diff)
lib: Add basic serial device support
Fixes a crash with those devices, and detect the Wacf004 somehow. Tested by Jakub Steiner on a Thinkpad x201. udev db: P: /devices/pnp0/00:0b/tty/ttyS0 N: ttyS0 E: UDEV_LOG=3 E: DEVPATH=/devices/pnp0/00:0b/tty/ttyS0 E: MAJOR=4 E: MINOR=64 E: DEVNAME=/dev/ttyS0 E: SUBSYSTEM=tty E: ID_MODEL=Serial Wacom Tablet WACf004 E: ID_INPUT=1 E: ID_INPUT_TABLET=1 E: NAME=Serial Wacom Tablet WACf004 E: ID_MM_CANDIDATE=1 E: TAGS=:systemd:
-rw-r--r--data/serial-wacf004.tablet2
-rw-r--r--libwacom/libwacom.c15
2 files changed, 13 insertions, 4 deletions
diff --git a/data/serial-wacf004.tablet b/data/serial-wacf004.tablet
index 0afca33..3d2f0e3 100644
--- a/data/serial-wacf004.tablet
+++ b/data/serial-wacf004.tablet
@@ -1,6 +1,6 @@
[Device]
Name=Wacom Serial Tablet WACf004
-DeviceMatch=serial:0:0
+DeviceMatch=serial:0000:0000
[Features]
Stylus=true
diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
index edf88bf..b7adbd9 100644
--- a/libwacom/libwacom.c
+++ b/libwacom/libwacom.c
@@ -72,6 +72,11 @@ get_device_info (const char *path,
}
bus_str = g_udev_device_get_property (device, "ID_BUS");
+ /* Serial devices are weird */
+ if (bus_str == NULL) {
+ if (g_strcmp0 (g_udev_device_get_subsystem (device), "tty") == 0)
+ bus_str = "serial";
+ }
/* Poke the parent device for Bluetooth models */
if (bus_str == NULL) {
GUdevDevice *parent;
@@ -135,9 +140,10 @@ get_device_info (const char *path,
goto bail;
}
} else if (*bus == WBUSTYPE_SERIAL) {
- /* FIXME implement */
- libwacom_error_set(error, WERROR_UNKNOWN_MODEL, "Unimplemented serial bus");
- goto bail;
+ /* FIXME This matches the declaration in serial-wacf004.tablet
+ * Might not be good enough though */
+ vendor_id = 0;
+ product_id = 0;
} else {
libwacom_error_set(error, WERROR_UNKNOWN_MODEL, "Unsupported bus '%s'", bus_str);
goto bail;
@@ -147,6 +153,9 @@ get_device_info (const char *path,
vendor_id != 0 &&
product_id != 0)
retval = TRUE;
+ /* The serial bus uses 0:0 as the vid/pid */
+ if (*bus == WBUSTYPE_SERIAL)
+ retval = TRUE;
bail:
if (retval == FALSE)