From 9c3f0916ffea701532f3512651792d5f87833330 Mon Sep 17 00:00:00 2001 From: Dorian Stoll Date: Sat, 27 Jun 2020 18:21:11 +0200 Subject: [PATCH 01/11] Add support for BUS_VIRTUAL This is needed to support IPTS devices through the iptsd userspace daemon. It exposes the touchscreen / stylus as uinput, since the parsing of raw IPTS data needs to happen in userspace. Because these devices are not backed by an actual bus, they are created as BUS_VIRTUAL. Signed-off-by: Dorian Stoll --- libwacom/libwacom-database.c | 4 ++++ libwacom/libwacom.c | 5 +++++ libwacom/libwacom.h | 1 + test/test-tablet-validity.c | 1 + test/test_data_files.py | 2 +- 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libwacom/libwacom-database.c b/libwacom/libwacom-database.c index a8987f7..3c7d0de 100644 --- a/libwacom/libwacom-database.c +++ b/libwacom/libwacom-database.c @@ -128,6 +128,8 @@ bus_from_str (const char *str) return WBUSTYPE_BLUETOOTH; if (g_str_equal(str, "i2c")) return WBUSTYPE_I2C; + if (g_str_equal(str, "virt")) + return WBUSTYPE_VIRTUAL; return WBUSTYPE_UNKNOWN; } @@ -146,6 +148,8 @@ bus_to_str (WacomBusType bus) return "bluetooth"; case WBUSTYPE_I2C: return "i2c"; + case WBUSTYPE_VIRTUAL: + return "virt"; } g_assert_not_reached (); } diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c index 935344c..88d0777 100644 --- a/libwacom/libwacom.c +++ b/libwacom/libwacom.c @@ -149,6 +149,10 @@ get_bus_vid_pid (GUdevDevice *device, *bus = WBUSTYPE_I2C; retval = TRUE; break; + case 6: + *bus = WBUSTYPE_VIRTUAL; + retval = TRUE; + break; } out: @@ -797,6 +801,7 @@ static void print_match(int fd, const WacomMatch *match) case WBUSTYPE_USB: bus_name = "usb"; break; case WBUSTYPE_SERIAL: bus_name = "serial"; break; case WBUSTYPE_I2C: bus_name = "i2c"; break; + case WBUSTYPE_VIRTUAL: bus_name = "virt"; break; case WBUSTYPE_UNKNOWN: bus_name = "unknown"; break; default: g_assert_not_reached(); break; } diff --git a/libwacom/libwacom.h b/libwacom/libwacom.h index 1b9bc2c..24e99cd 100644 --- a/libwacom/libwacom.h +++ b/libwacom/libwacom.h @@ -117,6 +117,7 @@ typedef enum { WBUSTYPE_SERIAL, /**< Serial tablet */ WBUSTYPE_BLUETOOTH, /**< Bluetooth tablet */ WBUSTYPE_I2C, /**< I2C tablet */ + WBUSTYPE_VIRTUAL, /**< Virtual (uinput) tablet */ } WacomBusType; /** diff --git a/test/test-tablet-validity.c b/test/test-tablet-validity.c index 2095089..da5fe07 100644 --- a/test/test-tablet-validity.c +++ b/test/test-tablet-validity.c @@ -177,6 +177,7 @@ assert_vidpid(WacomBusType bus, int vid, int pid) break; case WBUSTYPE_BLUETOOTH: case WBUSTYPE_I2C: + case WBUSTYPE_VIRTUAL: g_assert_cmpint(vid, >, 0); g_assert_cmpint(pid, >, 0); break; diff --git a/test/test_data_files.py b/test/test_data_files.py index 3953b1e..734463f 100755 --- a/test/test_data_files.py +++ b/test/test_data_files.py @@ -41,7 +41,7 @@ def test_device_match(tabletfile): continue bus, vid, pid = match.split(':')[:3] # skip the name part of the match - assert bus in ['usb', 'bluetooth', 'i2c', 'serial'], f'{tabletfile}: unknown bus type' + assert bus in ['usb', 'bluetooth', 'i2c', 'serial', 'virt'], f'{tabletfile}: unknown bus type' assert re.match('[0-9a-f]{4}', vid), f'{tabletfile}: {vid} must be lowercase hex' assert re.match('[0-9a-f]{4}', pid), f'{tabletfile}: {pid} must be lowercase hex' -- 2.32.0