From c5f393947859c6fb9466e8bf73e760808e6972c6 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 30 Mar 2017 12:50:13 +1000 Subject: [PATCH] test: unset MOUSE_DPI for the apple magic mouse As of systemd commit f013e99e160f385a0c02793c612ef4c8a8ffc4d7, ID_BUS is now set for all bluetooth devices, not just those with subsystem bluetooth. This affects the Apple Magic Mouse and sets the systemd hwdb's MOUSE_DPI value. That value is different to the test results we currently have, causing some tests to fail because different deltas are generated (e.g. pointer_scroll_button). Our udev rules are prefixed 99 and thus apply after the various system rules. So we can't easily set ID_BUS in our rule because it'll apply after 70-mouse.rules checks for the bustype. So we'd have to detect systemd version or so, but the easy way is to simply force MOUSE_DPI to the empty value. For our test cases it doesn't matter if the DPI is set correctly anyway. Signed-off-by: Peter Hutterer (cherry picked from commit 4030959f35a3178aa395339637e357af527da0ad) --- test/litest-device-apple-magicmouse.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/litest-device-apple-magicmouse.c b/test/litest-device-apple-magicmouse.c index 29d3b987..0ba84a56 100644 --- a/test/litest-device-apple-magicmouse.c +++ b/test/litest-device-apple-magicmouse.c @@ -88,6 +88,24 @@ static struct input_absinfo absinfo[] = { { .value = -1 } }; +/* Force MOUSE_DPI to the empty string. As of systemd commit f013e99e160f + * ID_BUS=bluetooth now triggers the hwdb entry for this device. This causes + * test case failures because deltas change. Detecting old vs new systemd is + * hard, and because our rules are 99-prefixed we can't set ID_BUS ourselves + * on older systemd. + * So let's go the easy way and unset MOUSE_DPI so we can continue to use + * the current tests. + */ +static const char udev_rule[] = +"ACTION==\"remove\", GOTO=\"mouse_end\"\n" +"KERNEL!=\"event*\", GOTO=\"mouse_end\"\n" +"ENV{ID_INPUT_MOUSE}==\"\", GOTO=\"mouse_end\"\n" +"\n" +"ATTRS{name}==\"litest Apple Magic Mouse\"," +" ENV{MOUSE_DPI}=\"\"" +"\n" +"LABEL=\"mouse_end\""; + struct litest_test_device litest_magicmouse_device = { .type = LITEST_MAGICMOUSE, .features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_WHEEL, @@ -99,4 +117,5 @@ struct litest_test_device litest_magicmouse_device = { .id = &input_id, .events = events, .absinfo = absinfo, + .udev_rule = udev_rule, };