linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brenton Simpson <appsforartists@google.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Erica Taylor <rickytaylor26@gmail.com>,
	Vicki Pfau <vi@endrift.com>,
	nate@yocom.org,  linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	 Ismael Ferreras Morezuelas <swyterzone@gmail.com>,
	Cameron Gutman <aicommander@gmail.com>,
	 Hans de Goede <hdegoede@redhat.com>
Subject: [PATCH] Input: xpad - add Lenovo Legion Go controllers
Date: Thu, 16 Nov 2023 09:45:31 -0800	[thread overview]
Message-ID: <CAAL3-=88exVfuL1Y-kvPNbsU+d-UTfDLFViWVObFLtbC4xueeA@mail.gmail.com> (raw)

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[] = {
+ { 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 */

             reply	other threads:[~2023-11-16 17:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-16 17:45 Brenton Simpson [this message]
2023-11-16 18:20 ` [PATCH] Input: xpad - add Lenovo Legion Go controllers Hans de Goede
2024-01-18 18:35 ` Brenton Simpson
2024-01-18 18:41   ` Brenton Simpson
2024-01-19  6:16   ` Vicki Pfau
2024-01-19  8:22     ` Brenton Simpson
2024-01-30 22:32       ` Dmitry Torokhov
2024-01-30 23:19         ` [PATCH] Input: xpad - sort xpad_device by vendor and product ID Brenton Simpson
2024-02-09 18:56           ` Dmitry Torokhov
2024-02-09 19:27             ` Brenton Simpson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAL3-=88exVfuL1Y-kvPNbsU+d-UTfDLFViWVObFLtbC4xueeA@mail.gmail.com' \
    --to=appsforartists@google.com \
    --cc=aicommander@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nate@yocom.org \
    --cc=rickytaylor26@gmail.com \
    --cc=swyterzone@gmail.com \
    --cc=vi@endrift.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).