Skip to content
Snippets Groups Projects
Commit 4c898686 authored by Simon McVittie's avatar Simon McVittie
Browse files

tests/input-device: Verify most Wii devices against real hardware

Some of the test data previously seen here was guessed from kernel
source code, and not all of it was correct. The following devices have
now been verified against `evemu-describe` output with Linux 6.3
(thanks to Jeremy Whiting for collecting this):

- basic Wiimote
    - buttons
    - 3-axis accelerometer
    - infra-red sensor for Sensor Bar location (precise aim)
- Motion Plus accessory (3-axis gyroscope)
- Nunchuck accessory (joystick, 2 buttons, second 3-axis accelerometer)
- Classic Controller accessory (a complete traditional gamepad)

Origin: https://github.com/libsdl-org/SDL/pull/7816


Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 6ddbc281
No related branches found
No related tags found
1 merge request!566Add more device test data
......@@ -1540,14 +1540,14 @@ static const GuessTest guess_tests[] =
.bus_type = 0x0005,
.vendor_id = 0x057e,
.product_id = 0x0306,
.version = 0x8600,
.version = 0x0600,
/* This one is a bit weird because some of the buttons are mapped
* to the arrow, page up and page down keys, so it's a joystick
* with a subset of a keyboard attached */
* with a subset of a keyboard attached. */
.expected = (SRT_INPUT_DEVICE_TYPE_FLAGS_JOYSTICK
| SRT_INPUT_DEVICE_TYPE_FLAGS_HAS_KEYS),
/* SYN, KEY */
.ev = { 0x03 },
/* SYN, KEY, FF */
.ev = { 0x03, 0x00, 0x20 },
.keys = {
/* 0x00 */ ZEROx8,
/* left, right, up down */
......@@ -1562,15 +1562,21 @@ static const GuessTest guess_tests[] =
},
},
{
/* The accelerometer and the Motion Plus gyro report as the same
* vendor, product, version and axes, just with different
* min/max/fuzz/flat parameters (not shown here). A Wiimote with an
* attached Motion Plus reports the accelerometer and gyro as separate
* evdev devices. */
.name = "Wiimote - Motion Plus or accelerometer",
.bus_type = 0x0005,
.vendor_id = 0x057e,
.product_id = 0x0306,
.version = 0x8600,
.version = 0x0600,
.expected = SRT_INPUT_DEVICE_TYPE_FLAGS_ACCELEROMETER,
/* SYN, ABS */
.ev = { 0x09 },
/* RX, RY, RZ */
/* RX, RY, RZ - even for the accelerometer, which would more
* conventionally be X, Y, Z */
.abs = { 0x38 },
},
{
......@@ -1578,23 +1584,25 @@ static const GuessTest guess_tests[] =
.bus_type = 0x0005,
.vendor_id = 0x057e,
.product_id = 0x0306,
.version = 0x8600,
.version = 0x0600,
.expected = SRT_INPUT_DEVICE_TYPE_FLAGS_JOYSTICK,
/* SYN, ABS */
.ev = { 0x09 },
/* HAT0 to HAT3 */
.abs = { 0x00, 0x1f },
/* HAT0X, Y to HAT3X, Y */
.abs = { 0x00, 0x00, 0xff },
},
{
.name = "Wiimote - Nunchuck",
.bus_type = 0x0005,
.vendor_id = 0x057e,
.product_id = 0x0306,
.version = 0x8600,
.version = 0x0600,
.expected = SRT_INPUT_DEVICE_TYPE_FLAGS_JOYSTICK,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* RX, RY, RZ, hat 0 */
/* RX, RY, RZ, hat 0 - even though this is an accelerometer, which
* would more conventionally be X, Y, Z, and a left joystick, which
* would more conventionally be X, Y */
.abs = { 0x38, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
......@@ -1603,14 +1611,13 @@ static const GuessTest guess_tests[] =
},
},
{
/* Flags guessed from kernel source code */
.name = "Wiimote - Classic Controller",
.expected = (SRT_INPUT_DEVICE_TYPE_FLAGS_JOYSTICK
| SRT_INPUT_DEVICE_TYPE_FLAGS_HAS_KEYS),
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* Hat 1-3 */
.abs = { 0x00, 0x1c },
/* Hat 1-3 X and Y */
.abs = { 0x00, 0x00, 0xfc },
.keys = {
/* 0x00 */ ZEROx8,
/* left, right, up down */
......@@ -1618,7 +1625,7 @@ static const GuessTest guess_tests[] =
/* 0x80 */ ZEROx8,
/* 0xc0 */ ZEROx8,
/* A, B, X, Y, MODE, TL, TL2, TR, TR2 */
/* 0x100 */ ZEROx4, 0x00, 0x13, 0xdb, 0x10,
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x13,
/* 0x140 */ ZEROx8,
/* next (keyboard page down), previous (keyboard page up) */
/* 0x180 */ 0x00, 0x00, 0x80, 0x10, ZEROx4,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment