mirror of https://github.com/libsdl-org/SDL
testevdev: Add X-Box One S controller via xpadneo 0.9.x
This is an out-of-tree driver providing an alternative interface to X-Box gamepads. Compared with the in-kernel driver, it adds four pseudo-buttons used to indicate which profile is active, and an optional "misc" axis that combines the two triggers into a rudder. Partially addresses libsdl-org/SDL#7823 Thanks: @kakra Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
2804f92eff
commit
53eff7f903
|
@ -340,6 +340,47 @@ static unsigned char fanatec_handbrake_hid_report_descriptor[] =
|
|||
};
|
||||
SDL_COMPILE_TIME_ASSERT (fanatec_handbrake, sizeof (fanatec_handbrake_hid_report_descriptor) == 046);
|
||||
|
||||
static unsigned char xpadneo09_xb1s_hid_report_descriptor[] =
|
||||
{
|
||||
0x05, 0x01, 0x09, 0x05, 0xa1, 0x01, 0x85, 0x01,
|
||||
0x09, 0x01, 0xa1, 0x00, 0x09, 0x30, 0x09, 0x31,
|
||||
0x15, 0x00, 0x27, 0xff, 0xff, 0x00, 0x00, 0x95,
|
||||
0x02, 0x75, 0x10, 0x81, 0x02, 0xc0, 0x09, 0x01,
|
||||
0xa1, 0x00, 0x09, 0x33, 0x09, 0x34, 0x15, 0x00,
|
||||
0x27, 0xff, 0xff, 0x00, 0x00, 0x95, 0x02, 0x75,
|
||||
0x10, 0x81, 0x02, 0xc0, 0x05, 0x01, 0x09, 0x32,
|
||||
0x15, 0x00, 0x26, 0xff, 0x03, 0x95, 0x01, 0x75,
|
||||
0x0a, 0x81, 0x02, 0x15, 0x00, 0x25, 0x00, 0x75,
|
||||
0x06, 0x95, 0x01, 0x81, 0x03, 0x05, 0x01, 0x09,
|
||||
0x35, 0x15, 0x00, 0x26, 0xff, 0x03, 0x95, 0x01,
|
||||
0x75, 0x0a, 0x81, 0x02, 0x15, 0x00, 0x25, 0x00,
|
||||
0x75, 0x06, 0x95, 0x01, 0x81, 0x03, 0x05, 0x01,
|
||||
0x09, 0x39, 0x15, 0x01, 0x25, 0x08, 0x35, 0x00,
|
||||
0x46, 0x3b, 0x01, 0x66, 0x14, 0x00, 0x75, 0x04,
|
||||
0x95, 0x01, 0x81, 0x42, 0x75, 0x04, 0x95, 0x01,
|
||||
0x15, 0x00, 0x25, 0x00, 0x35, 0x00, 0x45, 0x00,
|
||||
0x65, 0x00, 0x81, 0x03, 0x05, 0x09, 0x19, 0x01,
|
||||
0x29, 0x0c, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01,
|
||||
0x95, 0x0c, 0x81, 0x02, 0x15, 0x00, 0x25, 0x00,
|
||||
0x75, 0x01, 0x95, 0x04, 0x81, 0x03, 0x05, 0x0c,
|
||||
0x0a, 0xb2, 0x00, 0x15, 0x00, 0x25, 0x01, 0x95,
|
||||
0x01, 0x75, 0x01, 0x81, 0x02, 0x15, 0x00, 0x25,
|
||||
0x00, 0x75, 0x07, 0x95, 0x01, 0x81, 0x03, 0x05,
|
||||
0x0f, 0x09, 0x21, 0x85, 0x03, 0xa1, 0x02, 0x09,
|
||||
0x97, 0x15, 0x00, 0x25, 0x01, 0x75, 0x04, 0x95,
|
||||
0x01, 0x91, 0x02, 0x15, 0x00, 0x25, 0x00, 0x75,
|
||||
0x04, 0x95, 0x01, 0x91, 0x03, 0x09, 0x70, 0x15,
|
||||
0x00, 0x25, 0x64, 0x75, 0x08, 0x95, 0x04, 0x91,
|
||||
0x02, 0x09, 0x50, 0x66, 0x01, 0x10, 0x55, 0x0e,
|
||||
0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95,
|
||||
0x01, 0x91, 0x02, 0x09, 0xa7, 0x15, 0x00, 0x26,
|
||||
0xff, 0x00, 0x75, 0x08, 0x95, 0x01, 0x91, 0x02,
|
||||
0x65, 0x00, 0x55, 0x00, 0x09, 0x7c, 0x15, 0x00,
|
||||
0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x01, 0x91,
|
||||
0x02, 0xc0, 0xc0,
|
||||
};
|
||||
SDL_COMPILE_TIME_ASSERT (xpadneo09_xb1s, sizeof (xpadneo09_xb1s_hid_report_descriptor) == 283);
|
||||
|
||||
/* Test-cases derived from real devices or from Linux kernel source */
|
||||
/* *INDENT-OFF* */ /* clang-format off */
|
||||
static const GuessTest guess_tests[] =
|
||||
|
@ -475,6 +516,37 @@ static const GuessTest guess_tests[] =
|
|||
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x7c,
|
||||
},
|
||||
},
|
||||
{
|
||||
.name = "X-Box One S via xpadneo 0.9.x",
|
||||
/* Reference: https://github.com/libsdl-org/SDL/issues/7823 */
|
||||
.eviocgname = "Xbox Wireless Controller",
|
||||
.bus_type = 0x0005,
|
||||
.vendor_id = 0x045e,
|
||||
.product_id = 0x028e,
|
||||
.version = 0x1130,
|
||||
.expected = SDL_UDEV_DEVICE_JOYSTICK,
|
||||
/* SYN, KEY, ABS, MSC, FF */
|
||||
.ev = { 0x1b },
|
||||
/* X, Y, Z, RX, RY, RZ, HAT0X, HAT0Y
|
||||
* plus MISC as a deprecated axis reporting (rz - z) */
|
||||
.abs = { 0x3f, 0x00, 0x03, 0x00, 0x00, 0x01 },
|
||||
.keys = {
|
||||
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
|
||||
/* A, B, X, Y, TL, TR, SELECT, START, MODE, THUMBL, THUMBR */
|
||||
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x7c,
|
||||
/* 0x140 */ ZEROx8,
|
||||
/* 0x180 */ ZEROx8,
|
||||
/* 0x1c0 */ ZEROx8,
|
||||
/* 0x200 */ ZEROx8,
|
||||
/* 0x240 */ ZEROx8,
|
||||
/* 0x280 */ ZEROx8,
|
||||
/* BTN_TRIGGER_HAPPY33 up to BTN_TRIGGER_HAPPY36 inclusive:
|
||||
* used to represent the current profile */
|
||||
/* 0x2c0 */ ZEROx4, 0xf0,
|
||||
},
|
||||
.hid_report_descriptor_length = sizeof (xpadneo09_xb1s_hid_report_descriptor),
|
||||
.hid_report_descriptor = &xpadneo09_xb1s_hid_report_descriptor[0],
|
||||
},
|
||||
{
|
||||
.name = "DualSense (PS5) - gamepad",
|
||||
.bus_type = 0x0003,
|
||||
|
|
Loading…
Reference in New Issue