Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp535581rdb; Thu, 18 Jan 2024 10:36:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IGGRfBmc5VbLrb/1Q/tgtgYtpfNI60Hk1aL61c9/Uh6GCqqvMF6VTCL2v3WhSnFUDUzR2pu X-Received: by 2002:a54:4895:0:b0:3bd:568c:8379 with SMTP id r21-20020a544895000000b003bd568c8379mr1230797oic.48.1705602982832; Thu, 18 Jan 2024 10:36:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705602982; cv=pass; d=google.com; s=arc-20160816; b=bjusPBMJcRTQahoc/XR/jbi4FyFKjFCf5rmNoXLtwjjxC60N9weSsg9KBBmXNfgIhM B7Ks/NKa+D0PbJRjPu2JNTPKMkKmKKonk5tDxv5LcP0IQa4eGJ2VL3D+m3/6dy9uQD4Y X4cfaQRUExFCIbOPUP8HlOIHaYfx3elLEEt92xUM/d6LunLhB8782fSjZ0EGZwcrH/Py HdelSUtIMhvALFUtIyaJJZCqBSzK589daDHzx/4IcuIhhcOTAb5rdd142JHri0JPgaiA EPmC6d/SZExmy8puyqYjpucFA7l1LQXksC8HbAbp0EmtYiJP5hZuF0iS7zzdcy21g1lb u01g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=aVvypQ50Ee91qtKLnKzhKC/cnaDZgrechO8IJ87aiGM=; fh=EsJ4wpQTdbo4v4kVqShAAupyCFF4TWQvRO4ok5sAtR8=; b=p3Fj08rYgspRH6q8O1FslgNlsw7fCAittPh2pgXsLAk0kng4EAJ19UWdwS4RfMDh9y Lr12xen8c9GY8nOgJv1Mhuzp3KA0msezRiOxhVVOjd5okjRYpzoskCuoXv+AWXoM3B4q T7e2txhbqkaR0nCUh8fGxd238JRNWqYxCeknUBMcFRQvnbqhp8hO6dzdMBSjafdeSOlm c3MAHYEWZ/5osV8kXUWzIDZ9a2s1651oZLqcvpo7zI7fC1pwAXVP3/9kGVSjzPqV4RIg FPiE+HqWc8Zw9/HSvD9suru6fHjDU2WT414d83C39WZ7INPGqCXp+mbgEuEIUNYnNbfg piAQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=zAEaP9Sr; arc=pass (i=1 spf=pass spfdomain=appsforartists-gmr.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-30476-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30476-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id g10-20020ac87f4a000000b0042a1e468bf1si1159634qtk.795.2024.01.18.10.36.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 10:36:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30476-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=zAEaP9Sr; arc=pass (i=1 spf=pass spfdomain=appsforartists-gmr.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-30476-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30476-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7B38B1C216A2 for ; Thu, 18 Jan 2024 18:36:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C69D2D7BD; Thu, 18 Jan 2024 18:36:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="zAEaP9Sr" Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB9DE2D7B6 for ; Thu, 18 Jan 2024 18:35:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705602961; cv=none; b=h8MmsdQLNdxM9BIwFqLJSIlcuYUO70tTP/cHg5+tGagZE15mrsiuCGrJsTKzCuJph3CdBGodrsXWDyuJ6bvC8rWJ8lEQU+3OYs8i0/f2IiCz2KtWeyEubTw0/4RKbvl13X53FPJkudF+pmf3qS3DVkXp13WIuxIiqNK9a2QVEwI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705602961; c=relaxed/simple; bh=20UxIykfYukj0g9j/eDNEQ/NSTxqxpi9uNhdtfcPpQk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=GYAX6+nvpo1pevip86VMhjcUhz3e7vUbGzDvAEBxr7ZmUq9Kv7E8znuyoy5LzpthKNgXsBHXS6eAFsMmFgRYKlSv0lgDkH+rezyf3SdyMb8cITw0QnzA7XzOzYAhgtAd0bA8hEIQriOdGd+9WuoFVtG5qfiu7e8vo4BOsgu7FPo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=appsforartists-gmr.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=zAEaP9Sr; arc=none smtp.client-ip=209.85.214.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=appsforartists-gmr.bounces.google.com Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-1d5e88f69d3so21570305ad.3 for ; Thu, 18 Jan 2024 10:35:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1705602959; x=1706207759; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=aVvypQ50Ee91qtKLnKzhKC/cnaDZgrechO8IJ87aiGM=; b=zAEaP9SrChv6sutIgvGznI9El+qygcbOHTT89aidpsBnwBU4wqPhqj5VHI7/CnDHmo O0UAz3bUa+F/wzGvAtOVVSSpUPdGdD2OQAGjynVr6KRYwZgqnpebEtW+Ub0z9A/2QAeO 7hUa7if3vb8mn2BFr2Ah+wdK+VPQ0O0BgdG/ZxnWhJ9jGwpXatnCx/+9494DIRTDiosT rL1HgMMZJaX9Ru/SKPxHVZdubC8acHpispIy/wNH++Qgiryzqx0RgmuM3kYgYl8A9O6/ kn7XG+MyXMvEGdfQfCptlu00TkXeuSjiccaQ0UHxPmIoCopLDuiiNXYdKWNkAzuMVt2o ckOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705602959; x=1706207759; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=aVvypQ50Ee91qtKLnKzhKC/cnaDZgrechO8IJ87aiGM=; b=JXKLdzHt2ifvRTaCTMb0/0MUzsQYcDGic0bjmU5AuxpyLScdgRXNflR5TKpNZmL/hg HtJOXutsZ/UxakpcFvCrruvm3iNSMmVSA2Omb85GQduJeIdD3EFG332xIJ/iTyqkpUfQ 1Cn5FJDQSmnj6+orasx/H2SFyXSKsNWZ2AaVaNeIni6glYvkxTdGu+P/SYgI8nBhCWd9 0fmVEFZQT3aI7ao/iT2ARgClzkacxWNyuRIZkHscaYbpLnNm2c4yc+A0SOAQNE11Ed4b yZcRf4OS7Y5sEBaQ4xnD4PRstX3DuK/md/DeRBqTh/t9MlRvNVKyz+aWmxwN+J5IENJZ 6DZQ== X-Gm-Message-State: AOJu0Yy/oqjeabM7JTHvpRl8kn7RSaqOYlI5ULiMD+QMeuO2e+kzP9M8 x6wqZbed8nf7+pZ4Gjp06mKHNrwGW+W6+oIBWQdYDNjps9A6FQ0HMd7yyadL43ZdPi35uwtDILv 8rQwj58XH3XrzW7INyiupKBQ19Q== X-Received: by 2002:a17:902:f683:b0:1d4:c27a:db7d with SMTP id l3-20020a170902f68300b001d4c27adb7dmr15102plg.0.1705602959193; Thu, 18 Jan 2024 10:35:59 -0800 (PST) Date: Thu, 18 Jan 2024 18:35:46 +0000 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Message-ID: <20240118183546.418064-1-appsforartists@google.com> Subject: [PATCH] Input: xpad - add Lenovo Legion Go controllers From: Brenton Simpson To: Dmitry Torokhov , Hans de Goede Cc: Cameron Gutman , Erica Taylor , Ismael Ferreras Morezuelas , Jonathan Frederick , Matthias Benkmann , Matthias Berndt , nate@yocom.org, Sam Lantinga , Vicki Pfau , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, trivial@kernel.org, Brenton Simpson Content-Type: text/plain; charset="UTF-8" The Lenovo Legion Go is a handheld gaming system, similar to a Steam Deck. It has a gamepad (including rear paddles), 3 gyroscopes, a trackpad, volume buttons, a power button, and 2 LED ring lights. The Legion Go firmware presents these controls as a USB hub with various devices attached. In its default state, the gamepad is presented as an Xbox controller connected to this hub. (By holding a combination of buttons, it can be changed to use the older DirectInput API.) This patch teaches the existing Xbox controller module `xpad` to bind to the controller in the Legion Go, which enables support for the: - directional pad, - analog sticks (including clicks), - X, Y, A, B, - start and select (or menu and capture), - shoulder buttons, and - rumble. The trackpad, touchscreen, volume controls, and power button are already supported via existing kernel modules. Two of the face buttons, the gyroscopes, rear paddles, and LEDs are not. After this patch lands, the Legion Go will be mostly functional in Linux, out-of-the-box. The various components of the USB hub can be synthesized into a single logical controller (including the additional buttons) in userspace with [Handheld Daemon](https://github.com/hhd-dev/hhd), which makes the Go fully functional. Signed-off-by: Brenton Simpson --- 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 f5c21565bb3c..ecfcea8740a0 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 Controller for Windows", 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 */ -- 2.43.0.275.g3460e3d667-goog