diff mbox series

Input: xpad - add Lenovo Legion Go controllers

Message ID CAAL3-=88exVfuL1Y-kvPNbsU+d-UTfDLFViWVObFLtbC4xueeA@mail.gmail.com
State Superseded
Headers show
Series Input: xpad - add Lenovo Legion Go controllers | expand

Commit Message

Brenton Simpson Nov. 16, 2023, 5:45 p.m. UTC
When the controllers are both attached (or detached), they appear as
0x17ef, 0x6182.  When only one is attached, they appear as
0x17ef, 0x6184.

84 (mixed attachment) is already recognized as a gamepad by Linux.  This
patch adds 82 (both attached/detached).

These controllers have many more buttons than is typical.  With this
patch, here's what's functional when it presents as 82:

Recognized:

- X, Y, A, B
- both analog sticks, including L3/R3
- D-pad
- menu and capture buttons
- rumble

Not yet recognized:

- start, select
- 4 rear paddle buttons (Y1, Y2, Y3, M3)
- gyroscope

(There are also non-functional buttons when reporting as 84 that are
out-of-scope for this patch.)

Signed-off-by: Brenton Simpson <appsforartists@google.com>
---
 drivers/input/joystick/xpad.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Hans de Goede Nov. 16, 2023, 6:20 p.m. UTC | #1
Hi Brenton,

On 11/16/23 18:45, Brenton Simpson wrote:
> When the controllers are both attached (or detached), they appear as
> 0x17ef, 0x6182.  When only one is attached, they appear as
> 0x17ef, 0x6184.
> 
> 84 (mixed attachment) is already recognized as a gamepad by Linux.  This
> patch adds 82 (both attached/detached).
> 
> These controllers have many more buttons than is typical.  With this
> patch, here's what's functional when it presents as 82:
> 
> Recognized:
> 
> - X, Y, A, B
> - both analog sticks, including L3/R3
> - D-pad
> - menu and capture buttons
> - rumble
> 
> Not yet recognized:
> 
> - start, select
> - 4 rear paddle buttons (Y1, Y2, Y3, M3)
> - gyroscope
> 
> (There are also non-functional buttons when reporting as 84 that are
> out-of-scope for this patch.)
> 
> Signed-off-by: Brenton Simpson <appsforartists@google.com>
> ---
>  drivers/input/joystick/xpad.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
> index f5c21565bb3cec..ecfcea8740a009 100644
> --- a/drivers/input/joystick/xpad.c
> +++ b/drivers/input/joystick/xpad.c
> @@ -127,6 +127,7 @@ static const struct xpad_device {
>   u8 mapping;
>   u8 xtype;
>  } xpad_device[] = {

It looks like your workflow of copy-pasting this into your
email client has turned the tabs in the patch into a single space
character.

This and possibly other issues (line-wrapping, wrong end-of-line type)
is why using git send-email is the preferred way to submit kernel
patches.

Maybe try using Brenton Simpson <appsforartists+kernel@google.com>

for both the author and signed-off-by fields and then use
git send-email ?

Regards,

Hans

p.s.

Might be best to send the next attempt just to me, until you've
figured out a working email setup. And then once we have things
working, re-submit to the right people ?





> + { 0x17ef, 0x6182, "Lenovo Legion Go Controller (unified)", 0, XTYPE_XBOX360 },
>   { 0x0079, 0x18d4, "GPD Win 2 X-Box Controller", 0, XTYPE_XBOX360 },
>   { 0x03eb, 0xff01, "Wooting One (Legacy)", 0, XTYPE_XBOX360 },
>   { 0x03eb, 0xff02, "Wooting Two (Legacy)", 0, XTYPE_XBOX360 },
> @@ -459,6 +460,7 @@ static const signed short xpad_btn_paddles[] = {
> 
>  static const struct usb_device_id xpad_table[] = {
>   { USB_INTERFACE_INFO('X', 'B', 0) }, /* Xbox USB-IF not-approved class */
> + XPAD_XBOX360_VENDOR(0x17ef), /* Lenovo */
>   XPAD_XBOX360_VENDOR(0x0079), /* GPD Win 2 controller */
>   XPAD_XBOX360_VENDOR(0x03eb), /* Wooting Keyboards (Legacy) */
>   XPAD_XBOXONE_VENDOR(0x03f0), /* HP HyperX Xbox One controllers */
>
diff mbox series

Patch

diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index f5c21565bb3cec..ecfcea8740a009 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -127,6 +127,7 @@  static const struct xpad_device {
  u8 mapping;
  u8 xtype;
 } xpad_device[] = {
+ { 0x17ef, 0x6182, "Lenovo Legion Go Controller (unified)", 0, XTYPE_XBOX360 },
  { 0x0079, 0x18d4, "GPD Win 2 X-Box Controller", 0, XTYPE_XBOX360 },
  { 0x03eb, 0xff01, "Wooting One (Legacy)", 0, XTYPE_XBOX360 },
  { 0x03eb, 0xff02, "Wooting Two (Legacy)", 0, XTYPE_XBOX360 },
@@ -459,6 +460,7 @@  static const signed short xpad_btn_paddles[] = {

 static const struct usb_device_id xpad_table[] = {
  { USB_INTERFACE_INFO('X', 'B', 0) }, /* Xbox USB-IF not-approved class */
+ XPAD_XBOX360_VENDOR(0x17ef), /* Lenovo */
  XPAD_XBOX360_VENDOR(0x0079), /* GPD Win 2 controller */
  XPAD_XBOX360_VENDOR(0x03eb), /* Wooting Keyboards (Legacy) */
  XPAD_XBOXONE_VENDOR(0x03f0), /* HP HyperX Xbox One controllers */