Improve GIP support
Subsystems (2)
cover Improve GIP support
This series contains a new version of the previously submitted "fix PowerA EnWired Controller guide button" patch to make the failure soft instead of hard, as well as a further patch to add (and use) constants for the interface names, based on information gleaned from the xone project.
Vicki Pfau (2):
Input: xpad - Add constants for GIP interface numbers
Input: xpad - fix PowerA EnWired Controller guide button
drivers/input/joystick/xpad.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
Signature · 1 line
2.40.0
PATCH 1/2 Input: xpad - Add constants for GIP interface numbers
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
--- drivers/input/joystick/xpad.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/input/joystick/xpad.c +4 -1
@@ -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
Signature · 1 line
2.40.0
PATCH 2/2 Input: xpad - fix PowerA EnWired Controller guide button
In reply to Vicki PfauThis 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.
--- drivers/input/joystick/xpad.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/input/joystick/xpad.c +8 -0
@@ -1396,6 +1396,14 @@ static int xpad_start_xbox_one(struct usb_xpad *xpad)unsigned long flags;int retval; +/* 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);/*
Signature · 1 line
2.40.0
Dmitry Torokhov
maintainerRe: [PATCH 2/2] Input: xpad - fix PowerA EnWired Controller guide button
Quoted 14 lines · Vicki Pfau
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 <[email protected]>--- drivers/input/joystick/xpad.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/input/joystick/xpad.c +0
-0
drivers/input/joystick/xpad.c static int xpad_start_xbox_one(struct usb_xpad *xpad) · line 1405
Quoted 10 lines
drivers/input/joystick/xpad.c +7
-0@@ -1396,6 +1396,14 @@ static int xpad_start_xbox_one(struct usb_xpad *xpad)unsigned long flags;int retval; +/* 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);
I would prefer if we first validated that the interface is in fact present. Can we do something like:
if (usb_ifnum_to_if(xpad->udev, GIP_WIRED_INTF_AUDIO)) {
error = usb_set_interface(xpad->udev, GIP_WIRED_INTF_AUDIO, 0);
if (error)
...
}Quoted 7 lines
drivers/input/joystick/xpad.c +1
-0+spin_lock_irqsave (&xpad->odata_lock, flags);/* Signature · 1 line
2.40.0
Thanks.
Signature · 1 line
Dmitry
Re: [PATCH 2/2] Input: xpad - fix PowerA EnWired Controller guide button
Quoted 29 lines · Dmitry Torokhov
Quoted 14 lines · Vicki Pfau
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 <[email protected]>--- drivers/input/joystick/xpad.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/input/joystick/xpad.c +0
-0drivers/input/joystick/xpad.c static int xpad_start_xbox_one(struct usb_xpad *xpad) · line 1405
Quoted 10 lines
drivers/input/joystick/xpad.c +7
-0@@ -1396,6 +1396,14 @@ static int xpad_start_xbox_one(struct usb_xpad *xpad)unsigned long flags;int retval; +/* 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);I would prefer if we first validated that the interface is in fact present. Can we do something like:
Quoted 6 lines
if (usb_ifnum_to_if(xpad->udev, GIP_WIRED_INTF_AUDIO)) {
error = usb_set_interface(xpad->udev, GIP_WIRED_INTF_AUDIO, 0);
if (error)
...
}Yup, that makes sense. Wasn't sure what the cleanest way to do that was, though I'm unconvinced that the first party driver would work without this interface. It can't hurt to add the check.
Should I resubmit both patches in the series, or just this one?
Quoted 10 lines
Quoted 7 lines
drivers/input/joystick/xpad.c +1
-0+spin_lock_irqsave (&xpad->odata_lock, flags);/* Signature · 1 line
2.40.0Thanks.
Thanks,
Vicki
Dmitry Torokhov
maintainerRe: [PATCH 2/2] Input: xpad - fix PowerA EnWired Controller guide button
Quoted 39 lines · Vicki Pfau
Quoted 29 lines · Dmitry Torokhov
Quoted 14 lines · Vicki Pfau
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 <[email protected]>--- drivers/input/joystick/xpad.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/input/joystick/xpad.c +0
-0drivers/input/joystick/xpad.c static int xpad_start_xbox_one(struct usb_xpad *xpad) · line 1405
Quoted 10 lines
drivers/input/joystick/xpad.c +7
-0@@ -1396,6 +1396,14 @@ static int xpad_start_xbox_one(struct usb_xpad *xpad)unsigned long flags;int retval; +/* 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);I would prefer if we first validated that the interface is in fact present. Can we do something like:
Quoted 6 lines
if (usb_ifnum_to_if(xpad->udev, GIP_WIRED_INTF_AUDIO)) { error = usb_set_interface(xpad->udev, GIP_WIRED_INTF_AUDIO, 0); if (error) ... }
Quoted 3 lines
Yup, that makes sense. Wasn't sure what the cleanest way to do that was, though I'm unconvinced that the first party driver would work without this interface. It can't hurt to add the check.
Should I resubmit both patches in the series, or just this one?
Both please.
Thanks.
Signature · 1 line
Dmitry