From: Peter Hutterer Date: Mon, 14 Oct 2024 09:29:15 +0000 (+1000) Subject: test: fix uinput creation for the slotted devices with too many slots X-Git-Tag: 1.27.0~104 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aecfcf3d1ba25954ff44a8ff39a1ac40d828c5f8;p=platform%2Fupstream%2Flibinput.git test: fix uinput creation for the slotted devices with too many slots Kernel commit 206f533a0a7c "Input: uinput - reject requests with unreasonable number of slots" limits the number of slots to 99 - let's manually adjust that so we can keep creating uinput devices. Since these are just a test device and we don't use the slots here anyway (they're all fake MT devices) we can manually work around this. The real devices won't be affected by this since this is a limitation in uinput, not the input subsystem. Also move the comment one line up in the ms-surface device, the previous comment referred to the wrong event code. Part-of: --- diff --git a/test/litest-device-anker-mouse-kbd.c b/test/litest-device-anker-mouse-kbd.c index ef515364..1e315e3e 100644 --- a/test/litest-device-anker-mouse-kbd.c +++ b/test/litest-device-anker-mouse-kbd.c @@ -193,7 +193,10 @@ static struct input_absinfo absinfo[] = { { 0x2c, 0, 255, 0, 0, 0 }, { 0x2d, 0, 255, 0, 0, 0 }, { 0x2e, 0, 255, 0, 0, 0 }, - { ABS_MT_SLOT, 0, 255, 0, 0, 0 }, + /* Note: slot count artificially reduced for kernel + * commit 206f533a0a7c ("Input: uinput - reject requests with unreasonable number of slots") + */ + { ABS_MT_SLOT, 0, 64, 0, 0, 0 }, { ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0, 0 }, { ABS_MT_TOUCH_MINOR, 0, 255, 0, 0, 0 }, { ABS_MT_WIDTH_MINOR, 0, 255, 0, 0, 0 }, diff --git a/test/litest-device-keyboard-razer-blackwidow.c b/test/litest-device-keyboard-razer-blackwidow.c index 5dee7f46..5585ea46 100644 --- a/test/litest-device-keyboard-razer-blackwidow.c +++ b/test/litest-device-keyboard-razer-blackwidow.c @@ -309,7 +309,10 @@ static struct input_absinfo absinfo[] = { { 0x2c, 0, 255, 0, 0, 0 }, { 0x2d, 0, 255, 0, 0, 0 }, { 0x2e, 0, 255, 0, 0, 0 }, - { 0x2f, 0, 255, 0, 0, 0 }, + /* Note: slot count artificially reduced for kernel + * commit 206f533a0a7c ("Input: uinput - reject requests with unreasonable number of slots") + */ + { 0x2f, 0, 64, 0, 0, 0 }, { 0x30, 0, 255, 0, 0, 0 }, { 0x31, 0, 255, 0, 0, 0 }, { 0x32, 0, 255, 0, 0, 0 }, diff --git a/test/litest-device-keyboard-razer-blade-stealth.c b/test/litest-device-keyboard-razer-blade-stealth.c index b08ee433..b27af149 100644 --- a/test/litest-device-keyboard-razer-blade-stealth.c +++ b/test/litest-device-keyboard-razer-blade-stealth.c @@ -307,7 +307,10 @@ static struct input_absinfo absinfo[] = { { 0x2c, 0, 255, 0, 0, 0 }, { 0x2d, 0, 255, 0, 0, 0 }, { 0x2e, 0, 255, 0, 0, 0 }, - { 0x2f, 0, 255, 0, 0, 0 }, + /* Note: slot count artificially reduced for kernel + * commit 206f533a0a7c ("Input: uinput - reject requests with unreasonable number of slots") + */ + { 0x2f, 0, 64, 0, 0, 0 }, { 0x30, 0, 255, 0, 0, 0 }, { 0x31, 0, 255, 0, 0, 0 }, { 0x32, 0, 255, 0, 0, 0 }, diff --git a/test/litest-device-ms-surface-cover.c b/test/litest-device-ms-surface-cover.c index 31147211..77306fb5 100644 --- a/test/litest-device-ms-surface-cover.c +++ b/test/litest-device-ms-surface-cover.c @@ -63,9 +63,12 @@ static struct input_absinfo absinfo[] = { { 44, -127, 127, 0, 0, 0 }, { 45, -127, 127, 0, 0, 0 }, { 46, -127, 127, 0, 0, 0 }, - { 47, -127, 127, 0, 0, 0 }, /* ABS_MT range overlap starts here */ - { 48, -127, 127, 0, 0, 0 }, /* ABS_MT_SLOT */ + /* Note: slot count artificially reduced for kernel + * commit 206f533a0a7c ("Input: uinput - reject requests with unreasonable number of slots") + */ + { 47, 0, 64, 0, 0, 0 }, /* ABS_MT_SLOT */ + { 48, -127, 127, 0, 0, 0 }, { 49, -127, 127, 0, 0, 0 }, { 50, -127, 127, 0, 0, 0 }, { 51, -127, 127, 0, 0, 0 }, diff --git a/test/litest.c b/test/litest.c index 5c0c9070..7e6339b5 100644 --- a/test/litest.c +++ b/test/litest.c @@ -3451,6 +3451,15 @@ litest_create_uinput(const char *name, .flat = 0, .resolution = 100 }; + /* See kernel commit 206f533a0a7c ("Input: uinput - reject requests with unreasonable number of slots") */ + const struct input_absinfo default_abs_mt_slot = { + .value = 0, + .minimum = 0, + .maximum = 64, + .fuzz = 0, + .flat = 0, + .resolution = 100 + }; char buf[512]; dev = libevdev_new(); @@ -3483,8 +3492,10 @@ litest_create_uinput(const char *name, if (type == INPUT_PROP_MAX) { rc = libevdev_enable_property(dev, code); } else { + const struct input_absinfo *abs = + (code == ABS_MT_SLOT) ? &default_abs_mt_slot : &default_abs; rc = libevdev_enable_event_code(dev, type, code, - type == EV_ABS ? &default_abs : NULL); + type == EV_ABS ? abs : NULL); } litest_assert_int_eq(rc, 0); }