Blob Blame History Raw
From f9b2e603c6216824e34dc9a67205d98ccc9a41ca Mon Sep 17 00:00:00 2001
From: Vicki Pfau <vi@endrift.com>
Date: Thu, 13 Apr 2023 23:57:42 -0700
Subject: [PATCH] Input: xpad - add constants for GIP interface numbers
Git-commit: f9b2e603c6216824e34dc9a67205d98ccc9a41ca
References: git-fixes
Patch-mainline: v6.4-rc1

Wired GIP devices present multiple interfaces with the same USB identification
other than the interface number. This adds constants for differentiating two of
them and uses them where appropriate

Signed-off-by: Vicki Pfau <vi@endrift.com>
Link: https://lore.kernel.org/r/20230411031650.960322-2-vi@endrift.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/input/joystick/xpad.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -561,6 +561,9 @@ static const u8 xboxone_rumblebegin_init
 	0x1D, 0x1D, 0xFF, 0x00, 0x00
 };
 
+#define GIP_WIRED_INTF_DATA 0
+#define GIP_WIRED_INTF_AUDIO 1
+
 /*
  * A rumble packet with zero FF intensity will immediately
  * terminate the rumbling required to init PowerA pads.
@@ -1830,7 +1833,7 @@ static int xpad_probe(struct usb_interfa
 	}
 
 	if (xpad->xtype == XTYPE_XBOXONE &&
-	    intf->cur_altsetting->desc.bInterfaceNumber != 0) {
+	    intf->cur_altsetting->desc.bInterfaceNumber != GIP_WIRED_INTF_DATA) {
 		/*
 		 * The Xbox One controller lists three interfaces all with the
 		 * same interface class, subclass and protocol. Differentiate by