Skip to content

Commit 05e6329

Browse files
endriftndreys
authored andcommitted
Input: xpad - fix support for some third-party controllers
Some third-party controllers, such as the HORPIAD FPS for Nintendo Switch and Gamesir-G3w, require a specific packet that the first-party XInput driver sends before it will start sending reports. It's not currently known what this packet does, but since the first-party driver always sends it's unlikely that this could cause issues with existing controllers. Co-authored-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Vicki Pfau <vi@endrift.com> Link: https://lore.kernel.org/r/20230607012812.379640-2-vi@endrift.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 1680ac7 commit 05e6329

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

drivers/input/joystick/xpad.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ static const struct xpad_device {
264264
{ 0x0f0d, 0x0067, "HORIPAD ONE", 0, XTYPE_XBOXONE },
265265
{ 0x0f0d, 0x0078, "Hori Real Arcade Pro V Kai Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
266266
{ 0x0f0d, 0x00c5, "Hori Fighting Commander ONE", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
267+
{ 0x0f0d, 0x00dc, "HORIPAD FPS for Nintendo Switch", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
267268
{ 0x0f30, 0x010b, "Philips Recoil", 0, XTYPE_XBOX },
268269
{ 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX },
269270
{ 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX },
@@ -1720,6 +1721,27 @@ static int xpad_start_input(struct usb_xpad *xpad)
17201721
return error;
17211722
}
17221723
}
1724+
if (xpad->xtype == XTYPE_XBOX360) {
1725+
/*
1726+
* Some third-party controllers Xbox 360-style controllers
1727+
* require this message to finish initialization.
1728+
*/
1729+
u8 dummy[20];
1730+
1731+
error = usb_control_msg_recv(xpad->udev, 0,
1732+
/* bRequest */ 0x01,
1733+
/* bmRequestType */
1734+
USB_TYPE_VENDOR | USB_DIR_IN |
1735+
USB_RECIP_INTERFACE,
1736+
/* wValue */ 0x100,
1737+
/* wIndex */ 0x00,
1738+
dummy, sizeof(dummy),
1739+
25, GFP_KERNEL);
1740+
if (error)
1741+
dev_warn(&xpad->dev->dev,
1742+
"unable to receive magic message: %d\n",
1743+
error);
1744+
}
17231745

17241746
return 0;
17251747
}

0 commit comments

Comments
 (0)