[PATCH libinput 2/9] test: send orientation and touch size on the Apple touchpads

Peter Hutterer peter.hutterer at who-t.net
Wed Mar 29 04:59:01 UTC 2017


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 test/litest-device-bcm5974.c        | 12 ++++++++++++
 test/litest-device-magic-trackpad.c | 26 ++++++++++++++++++++++----
 2 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/test/litest-device-bcm5974.c b/test/litest-device-bcm5974.c
index 7d87285..f3dd65f 100644
--- a/test/litest-device-bcm5974.c
+++ b/test/litest-device-bcm5974.c
@@ -40,6 +40,9 @@ static struct input_event down[] = {
 	{ .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN },
 	{ .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN },
 	{ .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_ABS, .code = ABS_MT_ORIENTATION, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_ABS, .code = ABS_MT_TOUCH_MAJOR, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_ABS, .code = ABS_MT_TOUCH_MINOR, .value = LITEST_AUTO_ASSIGN },
 	{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
 	{ .type = -1, .code = -1 },
 };
@@ -51,6 +54,9 @@ static struct input_event move[] = {
 	{ .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN  },
 	{ .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN },
 	{ .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_ABS, .code = ABS_MT_ORIENTATION, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_ABS, .code = ABS_MT_TOUCH_MAJOR, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_ABS, .code = ABS_MT_TOUCH_MINOR, .value = LITEST_AUTO_ASSIGN },
 	{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
 	{ .type = -1, .code = -1 },
 };
@@ -63,6 +69,12 @@ get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value)
 	case ABS_MT_PRESSURE:
 		*value = 30;
 		return 0;
+	case ABS_MT_TOUCH_MAJOR:
+	case ABS_MT_TOUCH_MINOR:
+		*value = 1000;
+		return 0;
+	case ABS_MT_ORIENTATION:
+		return 0;
 	}
 	return 1;
 }
diff --git a/test/litest-device-magic-trackpad.c b/test/litest-device-magic-trackpad.c
index cc37163..efc4e1a 100644
--- a/test/litest-device-magic-trackpad.c
+++ b/test/litest-device-magic-trackpad.c
@@ -37,10 +37,11 @@ static struct input_event down[] = {
 	{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
 	{ .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN },
 	{ .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN },
-	{ .type = EV_ABS, .code = ABS_MT_TOUCH_MAJOR, .value = 272 },
-	{ .type = EV_ABS, .code = ABS_MT_TOUCH_MINOR, .value = 400 },
+	{ .type = EV_ABS, .code = ABS_MT_TOUCH_MAJOR, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_ABS, .code = ABS_MT_TOUCH_MINOR, .value = LITEST_AUTO_ASSIGN },
 	{ .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN },
 	{ .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_ABS, .code = ABS_MT_ORIENTATION, .value = LITEST_AUTO_ASSIGN },
 	{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
 	{ .type = -1, .code = -1 },
 };
@@ -49,17 +50,34 @@ static struct input_event move[] = {
 	{ .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN },
 	{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
 	{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
-	{ .type = EV_ABS, .code = ABS_MT_TOUCH_MAJOR, .value = 272 },
-	{ .type = EV_ABS, .code = ABS_MT_TOUCH_MINOR, .value = 400 },
+	{ .type = EV_ABS, .code = ABS_MT_TOUCH_MAJOR, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_ABS, .code = ABS_MT_TOUCH_MINOR, .value = LITEST_AUTO_ASSIGN },
 	{ .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN },
 	{ .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN },
+	{ .type = EV_ABS, .code = ABS_MT_ORIENTATION, .value = LITEST_AUTO_ASSIGN },
 	{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
 	{ .type = -1, .code = -1 },
 };
 
+static int
+get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value)
+{
+	switch (evcode) {
+	case ABS_MT_TOUCH_MAJOR:
+	case ABS_MT_TOUCH_MINOR:
+		*value = 400;
+		return 0;
+	case ABS_MT_ORIENTATION:
+		return 0;
+	}
+	return 1;
+}
+
 static struct litest_device_interface interface = {
 	.touch_down_events = down,
 	.touch_move_events = move,
+
+	.get_axis_default = get_axis_default,
 };
 
 static struct input_absinfo absinfo[] = {
-- 
2.9.3



More information about the wayland-devel mailing list