2024-08-26 21:24:44 -07:00
|
|
|
From b89d3ac556baafbf88b34ae2feadbcffc87bc3e4 Mon Sep 17 00:00:00 2001
|
2021-07-27 12:35:19 -07:00
|
|
|
From: Dorian Stoll <dorian.stoll@tmsp.io>
|
|
|
|
Date: Sat, 27 Jun 2020 18:21:11 +0200
|
2024-08-26 21:24:44 -07:00
|
|
|
Subject: [PATCH 01/16] Add support for BUS_VIRTUAL
|
2021-07-27 12:35:19 -07:00
|
|
|
|
|
|
|
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 <dorian.stoll@tmsp.io>
|
|
|
|
---
|
|
|
|
libwacom/libwacom-database.c | 4 ++++
|
|
|
|
libwacom/libwacom.c | 5 +++++
|
|
|
|
libwacom/libwacom.h | 1 +
|
|
|
|
test/test-tablet-validity.c | 1 +
|
2024-08-26 21:24:44 -07:00
|
|
|
test/test_data_files.py | 1 +
|
|
|
|
tools/debug-device.c | 1 +
|
|
|
|
6 files changed, 13 insertions(+)
|
2021-07-27 12:35:19 -07:00
|
|
|
|
|
|
|
diff --git a/libwacom/libwacom-database.c b/libwacom/libwacom-database.c
|
2024-08-26 21:24:44 -07:00
|
|
|
index eb47510..c5e2fcf 100644
|
2021-07-27 12:35:19 -07:00
|
|
|
--- a/libwacom/libwacom-database.c
|
|
|
|
+++ b/libwacom/libwacom-database.c
|
|
|
|
@@ -130,6 +130,8 @@ bus_from_str (const char *str)
|
|
|
|
return WBUSTYPE_BLUETOOTH;
|
2024-08-26 21:24:44 -07:00
|
|
|
if (g_str_equal(str, "i2c"))
|
2021-07-27 12:35:19 -07:00
|
|
|
return WBUSTYPE_I2C;
|
2024-08-26 21:24:44 -07:00
|
|
|
+ if (g_str_equal(str, "virt"))
|
2021-07-27 12:35:19 -07:00
|
|
|
+ return WBUSTYPE_VIRTUAL;
|
|
|
|
return WBUSTYPE_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -148,6 +150,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
|
2024-08-26 21:24:44 -07:00
|
|
|
index 1ffb910..c028bde 100644
|
2021-07-27 12:35:19 -07:00
|
|
|
--- a/libwacom/libwacom.c
|
|
|
|
+++ b/libwacom/libwacom.c
|
2024-08-26 21:24:44 -07:00
|
|
|
@@ -149,6 +149,10 @@ get_bus_vid_pid (GUdevDevice *device,
|
2021-07-27 12:35:19 -07:00
|
|
|
*bus = WBUSTYPE_I2C;
|
|
|
|
retval = TRUE;
|
|
|
|
break;
|
|
|
|
+ case 6:
|
|
|
|
+ *bus = WBUSTYPE_VIRTUAL;
|
|
|
|
+ retval = TRUE;
|
|
|
|
+ break;
|
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
2024-08-26 21:24:44 -07:00
|
|
|
@@ -1022,6 +1026,7 @@ static void print_match(int fd, const WacomMatch *match)
|
2021-07-27 12:35:19 -07:00
|
|
|
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
|
2024-08-26 21:24:44 -07:00
|
|
|
index c0d380c..a4fbb17 100644
|
2021-07-27 12:35:19 -07:00
|
|
|
--- a/libwacom/libwacom.h
|
|
|
|
+++ b/libwacom/libwacom.h
|
2024-08-26 21:24:44 -07:00
|
|
|
@@ -154,6 +154,7 @@ typedef enum {
|
2021-07-27 12:35:19 -07:00
|
|
|
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
|
2024-08-26 21:24:44 -07:00
|
|
|
index 69d34c8..964fce0 100644
|
2021-07-27 12:35:19 -07:00
|
|
|
--- a/test/test-tablet-validity.c
|
|
|
|
+++ b/test/test-tablet-validity.c
|
2024-08-26 21:24:44 -07:00
|
|
|
@@ -177,6 +177,7 @@ assert_vidpid(WacomBusType bus, int vid, int pid)
|
2021-07-27 12:35:19 -07:00
|
|
|
break;
|
|
|
|
case WBUSTYPE_BLUETOOTH:
|
|
|
|
case WBUSTYPE_I2C:
|
|
|
|
+ case WBUSTYPE_VIRTUAL:
|
|
|
|
g_assert_cmpint(vid, >, 0);
|
|
|
|
g_assert_cmpint(pid, >, 0);
|
|
|
|
break;
|
2024-08-26 21:24:44 -07:00
|
|
|
diff --git a/test/test_data_files.py b/test/test_data_files.py
|
|
|
|
index 9385b1c..f76c3f3 100755
|
|
|
|
--- a/test/test_data_files.py
|
|
|
|
+++ b/test/test_data_files.py
|
|
|
|
@@ -47,6 +47,7 @@ def test_device_match(tabletfile):
|
|
|
|
"bluetooth",
|
|
|
|
"i2c",
|
|
|
|
"serial",
|
|
|
|
+ "virt",
|
|
|
|
], f"{tabletfile}: unknown bus type"
|
|
|
|
assert re.match(
|
|
|
|
"[0-9a-f]{4}", vid
|
|
|
|
diff --git a/tools/debug-device.c b/tools/debug-device.c
|
|
|
|
index 2cdac20..51ec53e 100644
|
|
|
|
--- a/tools/debug-device.c
|
|
|
|
+++ b/tools/debug-device.c
|
|
|
|
@@ -122,6 +122,7 @@ handle_device(WacomDeviceDatabase *db, const char *path)
|
|
|
|
case WBUSTYPE_SERIAL: busstr = "SERIAL"; break;
|
|
|
|
case WBUSTYPE_BLUETOOTH: busstr = "BLUETOOTH"; break;
|
|
|
|
case WBUSTYPE_I2C: busstr = "I2C"; break;
|
|
|
|
+ case WBUSTYPE_VIRTUAL: busstr = "VIRTUAL"; break;
|
|
|
|
}
|
|
|
|
func(libwacom_get_bustype, "%s", busstr);
|
|
|
|
}
|
2021-07-27 12:35:19 -07:00
|
|
|
--
|
2024-08-26 21:24:44 -07:00
|
|
|
2.45.1
|
2021-07-27 12:35:19 -07:00
|
|
|
|