linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Input: xpad - Additional third-party controller support
@ 2023-03-24  4:04 Vicki Pfau
  2023-03-24  4:04 ` [PATCH v2 1/2] Input: xpad - Treat Qanba controllers as Xbox360 controllers Vicki Pfau
  2023-03-24  4:04 ` [PATCH v2 2/2] Input: xpad - fix support for some third-party controllers Vicki Pfau
  0 siblings, 2 replies; 4+ messages in thread
From: Vicki Pfau @ 2023-03-24  4:04 UTC (permalink / raw)
  To: Dmitry Torokhov, Lyude Paul, Benjamin Tissoires, linux-input
  Cc: Vicki Pfau, Pavel Rojtberg

This fixes some issues that came up in v1, including fixing the signed-off-by
in one patch, and properly initializing a variable that was added in another.

One of the other patches was dropped from this series as it appears to have
had a compatible version already applied, and the other patch has been
temporarily dropped pending further testing and fixes.

Pierre-Loup A. Griffais (1):
  Input: xpad - Treat Qanba controllers as Xbox360 controllers

Vicki Pfau (1):
  Input: xpad - fix support for some third-party controllers

 drivers/input/joystick/xpad.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

-- 
2.40.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] Input: xpad - Treat Qanba controllers as Xbox360 controllers
  2023-03-24  4:04 [PATCH v2 0/2] Input: xpad - Additional third-party controller support Vicki Pfau
@ 2023-03-24  4:04 ` Vicki Pfau
  2023-03-24 17:40   ` Dmitry Torokhov
  2023-03-24  4:04 ` [PATCH v2 2/2] Input: xpad - fix support for some third-party controllers Vicki Pfau
  1 sibling, 1 reply; 4+ messages in thread
From: Vicki Pfau @ 2023-03-24  4:04 UTC (permalink / raw)
  To: Dmitry Torokhov, Lyude Paul, Benjamin Tissoires, linux-input
  Cc: Pierre-Loup A. Griffais, Vicki Pfau

From: "Pierre-Loup A. Griffais" <pgriffais@valvesoftware.com>

They act that way in PC mode.

Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Pierre-Loup A. Griffais <pgriffais@valvesoftware.com>
Signed-off-by: Vicki Pfau <vi@endrift.com>
---
 drivers/input/joystick/xpad.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 49ae963e5f9d..c2c688156b2e 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -493,6 +493,7 @@ static const struct usb_device_id xpad_table[] = {
 	XPAD_XBOXONE_VENDOR(0x24c6),		/* PowerA Controllers */
 	XPAD_XBOX360_VENDOR(0x2563),		/* OneXPlayer Gamepad */
 	XPAD_XBOX360_VENDOR(0x260d),		/* Dareu H101 */
+	XPAD_XBOX360_VENDOR(0x2c22),		/* Qanba Controllers */
 	XPAD_XBOX360_VENDOR(0x2dc8),            /* 8BitDo Pro 2 Wired Controller */
 	XPAD_XBOXONE_VENDOR(0x2dc8),		/* 8BitDo Pro 2 Wired Controller for Xbox */
 	XPAD_XBOXONE_VENDOR(0x2e24),		/* Hyperkin Duke X-Box One pad */
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] Input: xpad - fix support for some third-party controllers
  2023-03-24  4:04 [PATCH v2 0/2] Input: xpad - Additional third-party controller support Vicki Pfau
  2023-03-24  4:04 ` [PATCH v2 1/2] Input: xpad - Treat Qanba controllers as Xbox360 controllers Vicki Pfau
@ 2023-03-24  4:04 ` Vicki Pfau
  1 sibling, 0 replies; 4+ messages in thread
From: Vicki Pfau @ 2023-03-24  4:04 UTC (permalink / raw)
  To: Dmitry Torokhov, Lyude Paul, Benjamin Tissoires, linux-input
  Cc: Vicki Pfau, Pavel Rojtberg, Andrey Smirnov

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>
---
 drivers/input/joystick/xpad.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index c2c688156b2e..2d86ca0c1ace 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -264,6 +264,7 @@ static const struct xpad_device {
 	{ 0x0f0d, 0x0067, "HORIPAD ONE", 0, XTYPE_XBOXONE },
 	{ 0x0f0d, 0x0078, "Hori Real Arcade Pro V Kai Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
 	{ 0x0f0d, 0x00c5, "Hori Fighting Commander ONE", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
+	{ 0x0f0d, 0x00dc, "HORIPAD FPS for Nintendo Switch", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
 	{ 0x0f30, 0x010b, "Philips Recoil", 0, XTYPE_XBOX },
 	{ 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX },
 	{ 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX },
@@ -2013,6 +2014,25 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
 		goto err_free_in_urb;
 	}
 
+	if (xpad->xtype == XTYPE_XBOX360) {
+		/* Some third-party controllers Xbox 360-style controllers
+		 * require this message to finish initialization */
+		uint8_t dummy[20];
+		int ret = usb_control_msg_recv(udev, 0,
+					       /* bRequest */ 0x01,
+					       /* bmRequestType */
+					       USB_TYPE_VENDOR | USB_DIR_IN |
+					       USB_RECIP_INTERFACE,
+					       /* wValue */ 0x100,
+					       /* wIndex */ 0x00,
+					       dummy, sizeof(dummy),
+					       25,
+					       GFP_KERNEL);
+		if (ret)
+			dev_warn(&xpad->dev->dev,
+				 "unable to receive magic message: %d\n", ret);
+	}
+
 	ep_irq_in = ep_irq_out = NULL;
 
 	for (i = 0; i < 2; i++) {
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] Input: xpad - Treat Qanba controllers as Xbox360 controllers
  2023-03-24  4:04 ` [PATCH v2 1/2] Input: xpad - Treat Qanba controllers as Xbox360 controllers Vicki Pfau
@ 2023-03-24 17:40   ` Dmitry Torokhov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2023-03-24 17:40 UTC (permalink / raw)
  To: Vicki Pfau
  Cc: Lyude Paul, Benjamin Tissoires, linux-input,
	Pierre-Loup A. Griffais

On Thu, Mar 23, 2023 at 09:04:45PM -0700, Vicki Pfau wrote:
> From: "Pierre-Loup A. Griffais" <pgriffais@valvesoftware.com>
> 
> They act that way in PC mode.
> 
> Reviewed-by: Lyude Paul <lyude@redhat.com>
> Signed-off-by: Pierre-Loup A. Griffais <pgriffais@valvesoftware.com>
> Signed-off-by: Vicki Pfau <vi@endrift.com>

Applied, thank you.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-24 17:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-24  4:04 [PATCH v2 0/2] Input: xpad - Additional third-party controller support Vicki Pfau
2023-03-24  4:04 ` [PATCH v2 1/2] Input: xpad - Treat Qanba controllers as Xbox360 controllers Vicki Pfau
2023-03-24 17:40   ` Dmitry Torokhov
2023-03-24  4:04 ` [PATCH v2 2/2] Input: xpad - fix support for some third-party controllers Vicki Pfau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).