From 762ea1563c120ea67467b8d9f98c05a60b11659e Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 16 Jun 2016 09:42:56 +1000 Subject: [PATCH] test: when creating an abs test device, force the abs->value to the mimimum Otherwise the abs->value could lie outside the [min, max] range of the axis. This isn't much of an issue for actual axes but in the case of ABS_MT_SLOT (value 47) it causes errors when libevdev sanitises the event into the allowed slot range. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede (cherry picked from commit 5f55d717744e37216d3c1ac5741e0f4d9154e2de) --- test/litest.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/litest.c b/test/litest.c index 48569d6d..ab59b0ff 100644 --- a/test/litest.c +++ b/test/litest.c @@ -2248,8 +2248,12 @@ litest_create_uinput(const char *name, abs = abs_info; while (abs && abs->value != -1) { - rc = libevdev_enable_event_code(dev, EV_ABS, - abs->value, abs); + struct input_absinfo a = *abs; + + /* abs_info->value is used for the code and may be outside + of [min, max] */ + a.value = abs->minimum; + rc = libevdev_enable_event_code(dev, EV_ABS, abs->value, &a); litest_assert_int_eq(rc, 0); abs++; }