Input: xpad - fix PowerA EnWired Controller guide button
authorVicki Pfau <vi@endrift.com>
Fri, 14 Apr 2023 06:58:12 +0000 (23:58 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 14 Apr 2023 07:02:55 +0000 (00:02 -0700)
This commit explicitly disables the audio interface the same way the official
driver does. This is needed for some controllers, such as the PowerA Enhanced
Wired Controller for Series X|S (0x20d6:0x200e) to report the guide button.

Signed-off-by: Vicki Pfau <vi@endrift.com>
Link: https://lore.kernel.org/r/20230411031650.960322-3-vi@endrift.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/joystick/xpad.c

index 6ea9c10dfb8a6c20f48d2c8bb51d3227742396b4..138e4a9f341f79ad36c2b505a5865d3ab79804ce 100644 (file)
@@ -1396,6 +1396,21 @@ static int xpad_start_xbox_one(struct usb_xpad *xpad)
        unsigned long flags;
        int retval;
 
+       if (usb_ifnum_to_if(xpad->udev, GIP_WIRED_INTF_AUDIO)) {
+               /*
+                * Explicitly disable the audio interface. This is needed
+                * for some controllers, such as the PowerA Enhanced Wired
+                * Controller for Series X|S (0x20d6:0x200e) to report the
+                * guide button.
+                */
+               retval = usb_set_interface(xpad->udev,
+                                          GIP_WIRED_INTF_AUDIO, 0);
+               if (retval)
+                       dev_warn(&xpad->dev->dev,
+                                "unable to disable audio interface: %d\n",
+                                retval);
+       }
+
        spin_lock_irqsave(&xpad->odata_lock, flags);
 
        /*