From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8EA0A15834C; Wed, 7 Feb 2024 21:25:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707341131; cv=none; b=exrR8pKHzGQ22Teo2CS7Aefi8fyYmgovFDqyeRznyx6vndaTsML7bn0CfjcKSxe12N4gcuHShTjR/JRFLYKe/2sn7Zb/fbTdHToOCq9GC++kGJOIrY5YthkLXbCQhRz7iwY6sxq1AJd8ikIhoW6zb6hjGCvZnongz2DcvhBRUYk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707341131; c=relaxed/simple; bh=G7iCaHlA7Oz0rW1vGnMZr5iEOwhTncPPYDCbXFk5Rio=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G0BmZDazPnmjJSA1WTQuR3HKa0THG2mz6FDLCfzxVyKj4jnm+rzLR2rEb+6qA3d0/iyUZ9lkxoudNqmDFlo148jjFSJcQRFhD7Y3GXLvB4rRsCz95SGtVTZAEVgWa0Oq13OLnt3GJ883ygQIEF8jJMDFsCn9n0iRv50SXuwceMw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ib7KbE5m; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ib7KbE5m" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBB04C433C7; Wed, 7 Feb 2024 21:25:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707341131; bh=G7iCaHlA7Oz0rW1vGnMZr5iEOwhTncPPYDCbXFk5Rio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ib7KbE5meQB7RM8XnjQksCUq4lvhgFl4Kcp+cdyHNE3Q1Egkf1XnOUddUBCskmWoq lSccnDMoguffVioDqSaIDb7Vyzac3Kn1zKbuPtSrri2TWZrDHJ2ic0Yf9QdIOzt/uA zruF5hMabkXAYCTRRrE8ysrGYwvH4NZJGUTnkk+Xwoz5c/OBYx+kezkCCU4skOumml 0X9kU+XuZRVvh28kTHXlbt6ZgLshnCyT36ae8/xP9VpcXaqK/Oc28IN6jqaFlLr20n cre71Oigbi5j09mnnAjURsa+j5lMYtSZyA5vtlaBZ80hhGYy8ELhq9Bz9B+BFlWWXJ D0Shhxl+SEVnw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Brenton Simpson , Dmitry Torokhov , Sasha Levin , vi@endrift.com, swyterzone@gmail.com, aicommander@gmail.com, luca@z3ntu.xyz, pgriffais@valvesoftware.com, doublej472@gmail.com, linux-input@vger.kernel.org Subject: [PATCH AUTOSEL 6.1 13/29] Input: xpad - add Lenovo Legion Go controllers Date: Wed, 7 Feb 2024 16:24:38 -0500 Message-ID: <20240207212505.3169-13-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240207212505.3169-1-sashal@kernel.org> References: <20240207212505.3169-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.1.77 Content-Transfer-Encoding: 8bit From: Brenton Simpson [ Upstream commit 80441f76ee67002437db61f3b317ed80cce085d2 ] 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 Link: https://lore.kernel.org/r/20240118183546.418064-1-appsforartists@google.com Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin --- 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 e8011d70d079..02f3bc4e4895 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -294,6 +294,7 @@ static const struct xpad_device { { 0x1689, 0xfd00, "Razer Onza Tournament Edition", 0, XTYPE_XBOX360 }, { 0x1689, 0xfd01, "Razer Onza Classic Edition", 0, XTYPE_XBOX360 }, { 0x1689, 0xfe00, "Razer Sabertooth", 0, XTYPE_XBOX360 }, + { 0x17ef, 0x6182, "Lenovo Legion Controller for Windows", 0, XTYPE_XBOX360 }, { 0x1949, 0x041a, "Amazon Game Controller", 0, XTYPE_XBOX360 }, { 0x1bad, 0x0002, "Harmonix Rock Band Guitar", 0, XTYPE_XBOX360 }, { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, @@ -489,6 +490,7 @@ static const struct usb_device_id xpad_table[] = { XPAD_XBOX360_VENDOR(0x15e4), /* Numark X-Box 360 controllers */ XPAD_XBOX360_VENDOR(0x162e), /* Joytech X-Box 360 controllers */ XPAD_XBOX360_VENDOR(0x1689), /* Razer Onza */ + XPAD_XBOX360_VENDOR(0x17ef), /* Lenovo */ XPAD_XBOX360_VENDOR(0x1949), /* Amazon controllers */ XPAD_XBOX360_VENDOR(0x1bad), /* Harminix Rock Band Guitar and Drums */ XPAD_XBOX360_VENDOR(0x20d6), /* PowerA Controllers */ -- 2.43.0