From 8a82e06075628525e6dbffbcb6a277e864d183e1 Mon Sep 17 00:00:00 2001
From: Simon McVittie <[EMAIL REDACTED]>
Date: Thu, 8 Jun 2023 15:51:10 +0100
Subject: [PATCH] testevdev: Add test data for Microsoft Xbox Series S|X
Controller
Like the Stadia controller, this is unusual because it represents the
Share button as the Record key from a multimedia keyboard (as of Linux
6.2.11 with the xpad driver). Thanks to Jeremy Whiting.
Signed-off-by: Simon McVittie <smcv@collabora.com>
---
test/testevdev.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/test/testevdev.c b/test/testevdev.c
index 1a19e2c48237..f5852f6b7b05 100644
--- a/test/testevdev.c
+++ b/test/testevdev.c
@@ -717,6 +717,51 @@ static const GuessTest guess_tests[] =
/* 0x2c0 */ 0x0f, 0x00, 0x00, 0x00, ZEROx4,
},
},
+ {
+ .name = "Microsoft Xbox Series S|X Controller (model 1914) via USB",
+ /* Physically the same device as 0003:045e:0b13 v0515 below,
+ * but some functionality is mapped differently */
+ .bus_type = 0x0003,
+ .vendor_id = 0x045e,
+ .product_id = 0x0b12,
+ .version = 0x050f,
+ .expected = SDL_UDEV_DEVICE_JOYSTICK | SDL_UDEV_DEVICE_KEYBOARD,
+ .ev = { 0x0b },
+ /* X, Y, Z, RX, RY, RZ, hat 0 */
+ .abs = { 0x3f, 0x00, 0x03 },
+ .keys = {
+ /* 0x00 */ ZEROx8,
+ /* 0x40 */ ZEROx8,
+ /* Record */
+ /* 0x80 */ ZEROx4, 0x80, 0x00, 0x00, 0x00,
+ /* 0xc0 */ ZEROx8,
+ /* ABXY, TL, TR, SELECT, START, MODE, THUMBL, THUMBR */
+ /* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x7c,
+ },
+ },
+ {
+ .name = "Microsoft Xbox Series S|X Controller (model 1914) via Bluetooth",
+ /* Physically the same device as 0003:045e:0b12 v050f above,
+ * but some functionality is mapped differently */
+ .bus_type = 0x0003,
+ .vendor_id = 0x045e,
+ .product_id = 0x0b13,
+ .version = 0x0515,
+ .expected = SDL_UDEV_DEVICE_JOYSTICK | SDL_UDEV_DEVICE_KEYBOARD,
+ .ev = { 0x0b },
+ /* XYZ, RZ, gas, brake, hat0 */
+ .abs = { 0x27, 0x06, 0x03 },
+ .keys = {
+ /* 0x00 */ ZEROx8,
+ /* 0x40 */ ZEROx8,
+ /* Record */
+ /* 0x80 */ ZEROx4, 0x80, 0x00, 0x00, 0x00,
+ /* 0xc0 */ ZEROx8,
+ /* ABC, XYZ, TL, TR, TL2, TR2, select, start, mode, thumbl,
+ * thumbr */
+ /* 0x100 */ ZEROx4, 0x00, 0x00, 0xff, 0x7f,
+ },
+ },
{
.name = "Wiimote - buttons",
.bus_type = 0x0005,