From 063382670f9997672c066b3b837f1749ef4a11c9 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 11 Apr 2023 18:12:59 +0100 Subject: [PATCH 1/2] testevdev: Add the ability to mark a device entry as unimplemented There are some devices for which SDL's device classification heuristic is known not to give the ideal result. Add a way to incorporate these into our test data, so that when the heuristic is improved we can detect them as their intended device type, without making the test fail before that has been implemented. Signed-off-by: Simon McVittie --- test/testevdev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/testevdev.c b/test/testevdev.c index 0393b308e1acc..1b465e017980a 100644 --- a/test/testevdev.c +++ b/test/testevdev.c @@ -71,6 +71,7 @@ typedef struct uint8_t ff[(FF_MAX + 1) / 8]; uint8_t props[INPUT_PROP_MAX / 8]; int expected; + const char *todo; } GuessTest; /* @@ -1029,7 +1030,12 @@ run_test(void) } } - success = 0; + if (t->todo) { + printf("\tKnown issue, ignoring: %s\n", t->todo); + } else { + printf("\tFailed\n"); + success = 0; + } } } From c810cc69deea4105d6c19834d82be0535bb21d7e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 11 Apr 2023 18:16:24 +0100 Subject: [PATCH 2/2] testevdev: Add some driving sim controllers from Proton issue reports Ideally we'd detect these as "joysticks" (or more generally, gaming controllers), but in most cases their evdev flags are indistinguishable from an accelerometer or gyro, so the only way to achieve this would be a table of known devices that doesn't currently exist. One exception is the one that reports a THROTTLE axis and TRIGGER, THUMB buttons, which would be reasonable to detect via the joystick heuristic. Signed-off-by: Simon McVittie --- test/testevdev.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/test/testevdev.c b/test/testevdev.c index 1b465e017980a..e3e8fcfa26473 100644 --- a/test/testevdev.c +++ b/test/testevdev.c @@ -942,6 +942,74 @@ static const GuessTest guess_tests[] = /* 0x180 */ ZEROx4, 0x00, 0x00, 0x40, 0x00, }, }, + { /* https://github.com/ValveSoftware/Proton/issues/5126 */ + .name = "Smarty Co. VRS DirectForce Pro Pedals", + .bus_type = 0x0003, + .vendor_id = 0x0483, /* STMicroelectronics */ + .product_id = 0xa3be, /* VRS DirectForce Pro Pedals */ + .version = 0x0111, + /* TODO: Ideally we would identify this as a joystick, but there + * isn't currently enough information to do that without a table + * of known devices. */ + .expected = SDL_UDEV_DEVICE_JOYSTICK, + .todo = "https://github.com/ValveSoftware/Proton/issues/5126", + /* SYN, ABS */ + .ev = { 0x09 }, + /* X, Y, Z */ + .abs = { 0x07 }, + }, + { /* https://github.com/ValveSoftware/Proton/issues/5126 */ + .name = "Heusinkveld Heusinkveld Sim Pedals Ultimate", + .bus_type = 0x0003, + .vendor_id = 0x30b7, /* Heusinkveld Engineering */ + .product_id = 0x1003, /* Heusinkveld Sim Pedals Ultimate */ + .version = 0x0000, + /* TODO: Ideally we would identify this as a joystick, but there + * isn't currently enough information to do that without a table + * of known devices. */ + .expected = SDL_UDEV_DEVICE_JOYSTICK, + .todo = "https://github.com/ValveSoftware/Proton/issues/5126", + /* SYN, ABS */ + .ev = { 0x09 }, + /* RX, RY, RZ */ + .abs = { 0x38 }, + }, + { /* https://github.com/ValveSoftware/Proton/issues/5126 */ + .name = "Vitaly [mega_mozg] Naidentsev ODDOR-handbrake", + .bus_type = 0x0003, + .vendor_id = 0x0000, + .product_id = 0x0000, + .version = 0x0001, + /* TODO: Ideally we would identify this as a joystick by it having + * the joystick-specific THROTTLE axis and TRIGGER/THUMB buttons */ + .expected = SDL_UDEV_DEVICE_JOYSTICK, + .todo = "https://github.com/ValveSoftware/Proton/issues/5126", + /* SYN, KEY, ABS, MSC */ + .ev = { 0x1b }, + /* THROTTLE only */ + .abs = { 0x40 }, + .keys = { + /* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8, + /* TRIGGER = 0x120, THUMB = 0x121 */ + /* 0x100 */ ZEROx4, 0x03, 0x00, 0x00, 0x00, + }, + }, + { /* https://github.com/ValveSoftware/Proton/issues/5126 */ + .name = "Leo Bodnar Logitech® G25 Pedals", + .bus_type = 0x0003, + .vendor_id = 0x1dd2, /* Leo Bodnar Electronics Ltd */ + .product_id = 0x100c, + .version = 0x0110, + /* TODO: Ideally we would identify this as a joystick, but there + * isn't currently enough information to do that without a table + * of known devices. */ + .expected = SDL_UDEV_DEVICE_JOYSTICK, + .todo = "https://github.com/ValveSoftware/Proton/issues/5126", + /* SYN, ABS */ + .ev = { 0x09 }, + /* RX, RY, RZ */ + .abs = { 0x38 }, + }, { .name = "No information", .expected = SDL_UDEV_DEVICE_UNKNOWN,