* [PATCH v2] Input: xpad - add support for generic clone X-Input gamepads
@ 2026-07-26 17:15 Ishaan Dandekar
2026-07-26 17:27 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Ishaan Dandekar @ 2026-07-26 17:15 UTC (permalink / raw)
To: linux-input; +Cc: dmitry.torokhov, gregkh, Ishaan Dandekar
This device exposes a vendor-specific Xbox 360 interface (0283:0001)
but was previously ignored by the driver, causing it to fall back to
a generic hid interface. Adding its ID to xpad_device and xpad_table
allows it to initialize correctly as an X-Input gamepad.
Signed-off-by: Ishaan Dandekar <ishaan.dandekar@gmail.com>
---
Note to maintainers:
This device exposes a vendor-specific Xbox 360 interface (0283:0001).
Adding its ID to xpad_device and xpad_table allows it to initialize
correctly as an X-Input gamepad with full rumble support.
Context: This patch is a companion to a 2-patch series submitted to
the linux-usb subsystem (v2: "Fix initialization for Generic Clone
X-Input Gamepads"). The USB patches apply a 255-byte config request
quirk to prevent this device's firmware from crashing. Once stabilized
by the USB core, this xpad patch is required to actually route it
properly. Both can be merged independently.
Changes in v2:
- Wrapped commit message at 72 columns.
- Separated from the USB series to target the input subsystem directly.
drivers/input/joystick/xpad.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index feb8f368f..c0a15db03 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -99,6 +99,7 @@ static const struct xpad_device {
} xpad_device[] = {
/* Please keep this list sorted by vendor and product ID. */
{ 0x0079, 0x18d4, "GPD Win 2 X-Box Controller", 0, XTYPE_XBOX360 },
+ { 0x0283, 0x0001, "Generic X-Input Gamepad", 0, XTYPE_XBOX360 },
{ 0x0351, 0x1000, "CRKD LP Blueberry Burst Pro Edition (Xbox)", 0, XTYPE_XBOX360 },
{ 0x0351, 0x2000, "CRKD LP Black Tribal Edition (Xbox) ", 0, XTYPE_XBOX360 },
{ 0x03eb, 0xff01, "Wooting One (Legacy)", 0, XTYPE_XBOX360 },
@@ -496,6 +497,7 @@ static const struct usb_device_id xpad_table[] = {
*/
{ USB_INTERFACE_INFO('X', 'B', 0) }, /* Xbox USB-IF not-approved class */
XPAD_XBOX360_VENDOR(0x0079), /* GPD Win 2 controller */
+ { USB_DEVICE(0x0283, 0x0001) }, /* Generic X-Input Gamepad */
XPAD_XBOX360_VENDOR(0x0351), /* CRKD Controllers */
XPAD_XBOX360_VENDOR(0x03eb), /* Wooting Keyboards (Legacy) */
XPAD_XBOX360_VENDOR(0x03f0), /* HP HyperX Xbox 360 controllers */
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] Input: xpad - add support for generic clone X-Input gamepads
2026-07-26 17:15 [PATCH v2] Input: xpad - add support for generic clone X-Input gamepads Ishaan Dandekar
@ 2026-07-26 17:27 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-07-26 17:27 UTC (permalink / raw)
To: Ishaan Dandekar; +Cc: dmitry.torokhov, linux-input
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Using `USB_DEVICE()` matches all interfaces on the composite device, causing `xpad` to improperly bind to the generic HID interface alongside the vendor-specific interface.
--
--- Patch [1]: [PATCH v2] Input: xpad - add support for generic clone X-Input gamepads ---
commit 00ab3ea53016b88e3489cabeb13695b6e3ca4191
Author: Ishaan Dandekar <ishaan.dandekar@gmail.com>
Input: xpad - add support for generic clone X-Input gamepads
This patch adds the vendor and product ID (0283:0001) for a generic clone
X-Input gamepad to xpad_device and xpad_table. This allows the device to
be recognized and initialized as an X-Input gamepad instead of falling back
to a generic HID interface.
> diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
> index feb8f368f834e..c0a15db032963 100644
> --- a/drivers/input/joystick/xpad.c
> +++ b/drivers/input/joystick/xpad.c
[ ... ]
> @@ -496,6 +497,7 @@ static const struct usb_device_id xpad_table[] = {
> */
> { USB_INTERFACE_INFO('X', 'B', 0) }, /* Xbox USB-IF not-approved class */
> XPAD_XBOX360_VENDOR(0x0079), /* GPD Win 2 controller */
> + { USB_DEVICE(0x0283, 0x0001) }, /* Generic X-Input Gamepad */
[Severity: High]
Will using USB_DEVICE() here cause the driver to incorrectly bind to the
device's generic HID interface as well?
Since USB_DEVICE() only matches by Vendor and Product ID without checking
the interface class, this appears to match all interfaces on the composite
device.
Because the device is found in the xpad_device table, xpad_probe() will set
the xtype to XTYPE_XBOX360. This bypasses the XTYPE_UNKNOWN check later in
xpad_probe() that normally verifies if the interface class is
USB_CLASS_VENDOR_SPEC.
If xpad binds to the standard HID interface, it could steal it from usbhid,
create a ghost input device, and send invalid X-Input packets to the generic
HID OUT endpoint. Could this be avoided by using the XPAD_XBOX360_VENDOR()
macro or specifying the interface match flags directly?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260726171526.43071-1-ishaan.dandekar@gmail.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-26 17:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-26 17:15 [PATCH v2] Input: xpad - add support for generic clone X-Input gamepads Ishaan Dandekar
2026-07-26 17:27 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox