diff mbox series

[v2,1/2] Input: xpad - Add constants for GIP interface numbers

Message ID 20230411031650.960322-2-vi@endrift.com
State Accepted
Commit f9b2e603c6216824e34dc9a67205d98ccc9a41ca
Headers show
Series Improve GIP support | expand

Commit Message

Vicki Pfau April 11, 2023, 3:16 a.m. UTC
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>
---
 drivers/input/joystick/xpad.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Dmitry Torokhov April 14, 2023, 7:05 a.m. UTC | #1
On Mon, Apr 10, 2023 at 08:16:49PM -0700, Vicki Pfau wrote:
> 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>

Applied, thank you.
diff mbox series

Patch

diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 260f91fef427..6ea9c10dfb8a 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -561,6 +561,9 @@  struct xboxone_init_packet {
 #define GIP_MOTOR_LT BIT(3)
 #define GIP_MOTOR_ALL (GIP_MOTOR_R | GIP_MOTOR_L | GIP_MOTOR_RT | GIP_MOTOR_LT)
 
+#define GIP_WIRED_INTF_DATA 0
+#define GIP_WIRED_INTF_AUDIO 1
+
 /*
  * This packet is required for all Xbox One pads with 2015
  * or later firmware installed (or present from the factory).
@@ -2004,7 +2007,7 @@  static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
 	}
 
 	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