aboutsummarylogtreecommitdiffstats
path: root/0001-Add-support-for-BUS_VIRTUAL.patch
blob: 9c2f897218b30d627f53538e935c86a8262a9d13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
From 232486e70e95297ac1e5f9cb32974f69e762c93f Mon Sep 17 00:00:00 2001
From: Dorian Stoll <dorian.stoll@tmsp.io>
Date: Sat, 27 Jun 2020 18:21:11 +0200
Subject: [PATCH 01/12] 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 <dorian.stoll@tmsp.io>
---
 libwacom/libwacom-database.c | 4 ++++
 libwacom/libwacom.c          | 5 +++++
 libwacom/libwacom.h          | 1 +
 test/test-tablet-validity.c  | 1 +
 4 files changed, 11 insertions(+)

diff --git a/libwacom/libwacom-database.c b/libwacom/libwacom-database.c
index 9f2657b..7be5247 100644
--- a/libwacom/libwacom-database.c
+++ b/libwacom/libwacom-database.c
@@ -130,6 +130,8 @@ bus_from_str (const char *str)
 		return WBUSTYPE_BLUETOOTH;
 	if (streq(str, "i2c"))
 		return WBUSTYPE_I2C;
+	if (streq(str, "virt"))
+		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
index 062b313..7b97bb1 100644
--- a/libwacom/libwacom.c
+++ b/libwacom/libwacom.c
@@ -147,6 +147,10 @@ get_bus_vid_pid (GUdevDevice  *device,
 		*bus = WBUSTYPE_I2C;
 		retval = TRUE;
 		break;
+	case 6:
+		*bus = WBUSTYPE_VIRTUAL;
+		retval = TRUE;
+		break;
 	}
 
 out:
@@ -765,6 +769,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 9e5b02f..3883341 100644
--- a/test/test-tablet-validity.c
+++ b/test/test-tablet-validity.c
@@ -179,6 +179,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;
-- 
2.29.2