From patchwork Thu Nov 16 17:45:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brenton Simpson X-Patchwork-Id: 165907 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp523vqn; Thu, 16 Nov 2023 09:46:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IFRs9Z050nFUM3q8XXO8s9OUwQM+buqzEH6+TIqCSzT/B7qzdMkdtgIBZIpvrIW4TckcVZ1 X-Received: by 2002:a05:6a20:258f:b0:187:e3a5:b35d with SMTP id k15-20020a056a20258f00b00187e3a5b35dmr1634120pzd.13.1700156803658; Thu, 16 Nov 2023 09:46:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700156803; cv=none; d=google.com; s=arc-20160816; b=yw4grjCVpuwzXXFJWI+THyJBwhGqgItLDPcyrjy8s03RmTj9attO5Ru1odJzURnPW0 ptD0cd0Tfo8cv+k2WmPGDSvgMKz9CjWFguap7y4atICkpBX2HzT95hjcTtaQBqB63vPm bY3rwAitP93RKbm6mWFlVuHy1lxNi33f1b/sm37eP0K7tIMn+rT9+f0SIECHkqe6ypDx h0i+2belFxw3UEd+MZt5+YybpuZk5V0XW7E/wRxu5ukzBCCL4Y85/bxQrSLREfcuHjE7 KQx+EC+jhSsTybuimxKfqOUtVD5ilgGhHH9OGpG4YLtFLLUZL0UsJ39wPgrYPwv1yHOU ZOgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:mime-version :dkim-signature; bh=31lYSY2gScfJmzy6bBEtYXDpksRo7piXakrkacNysY0=; fh=I58+3tNMN+skl5KFOKjUPp+JiMAABj97zNzsaJzEh5Q=; b=Y+WuJr5HflUYNtbm9Vv72T+S711lJgHqSX6G9F8dLQvemdKLHAzpYGAzy3dkPJ8pKc DX3ob3ZXvjR6wvraC2bgb/SLhgXoFhy/xMfpBmwpak8nxRu681tMxGDZsgHNMzZPScaI I9hd4pqLu6N9KYtUKwIRdffkc++OXTn5UNaxhGDbZIF+egcWSmywlm4FyTkhbuG63MrW iLRPtBKvIHTmCXq4d5edW84flrb98YakuB2u6LdJddCbSdqIeoCRbcW9X2b/7kDcBs0u E/NWV+tiHMUZkR7yZsBZ6niFqYD7iJhYipFiu0nHP9pn+8adU0bWHlKXeU4vJ4Fu5+4O 4xaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=EMfToD67; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id jc39-20020a056a006ca700b006bca1443f29si13228484pfb.297.2023.11.16.09.46.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 09:46:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=EMfToD67; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 034D380A3118; Thu, 16 Nov 2023 09:46:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345367AbjKPRpu (ORCPT + 30 others); Thu, 16 Nov 2023 12:45:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbjKPRpt (ORCPT ); Thu, 16 Nov 2023 12:45:49 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 983581A8 for ; Thu, 16 Nov 2023 09:45:44 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-32f9268bf8cso822183f8f.0 for ; Thu, 16 Nov 2023 09:45:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1700156743; x=1700761543; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=31lYSY2gScfJmzy6bBEtYXDpksRo7piXakrkacNysY0=; b=EMfToD67FrdEb0AvzYukUrvxkA+b8TaYGG6CCqXEGsf3ocONPCh6Ki0NfH5ucIeXhz ExEpDMcdg2ysufqVtOyCbaB1b5jOdizmLsLU4oOSQjgZG6yW4n4JmTF6idIQr3zkjZBX bJIz01HQmYoMB6mYFvLkBPejwwvpEDr7wnKaJku9UZbn3t53XSKl+kVCyWu40IVMMHoz wA16K+AAPxpzxOXXv0thWjMAh55PN4GQzbR7NUh/SdaNIMo2URhe9yjAAAZT6GkxF7cq yUQ3OKNm3ZtH5q1qNMcfK8uBxoM1VkvvDqf254vK1KKDveUPaCqfHl/zfw4M5a0N+XkL NFKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700156743; x=1700761543; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=31lYSY2gScfJmzy6bBEtYXDpksRo7piXakrkacNysY0=; b=lrXOnx408OW2v28+3cFMCmDtv1ALYZP1CE+4MssQre087GffVBOZ1A76QFVjRIibKr O3BFkvBlojXuX0g7kEaKU2V3D0vleEs1xUUHj4N6X4xxX3DbhggGklpKDFo5uY6QVP6S hmtNB2m9THMuyEoYmUWg7kXW2zjC6QxN9JjZKeBPBZZC+nhbxgvfzmMTMtjsNg6o8evF 5XgQA//MOJn0Lw88E9fdnd6NaYTFesXGt5G4+vkXGIi3AdlWiMLxU06ekKPGTjfU/G7o j60RdTylDHd0szc0xjHyCZeYd2cQDD9BWEBFr3JYjPUlLqwb+K8k49uvc/vrnbqaNPCb CexQ== X-Gm-Message-State: AOJu0YxkrEEpnfT3qkeD1Bpm9zEIOx+nGF+YnnUi+j0xoMP1z/Nm5jTg gIRGd+BaQDtXYvAbKpaFMI04+SIa8FbMIoYRxvZVYQ== X-Received: by 2002:a05:6000:178f:b0:32d:84c7:2f56 with SMTP id e15-20020a056000178f00b0032d84c72f56mr13158051wrg.21.1700156742901; Thu, 16 Nov 2023 09:45:42 -0800 (PST) MIME-Version: 1.0 From: Brenton Simpson Date: Thu, 16 Nov 2023 09:45:31 -0800 Message-ID: Subject: [PATCH] Input: xpad - add Lenovo Legion Go controllers To: Dmitry Torokhov Cc: Erica Taylor , Vicki Pfau , nate@yocom.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Ismael Ferreras Morezuelas , Cameron Gutman , Hans de Goede X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 16 Nov 2023 09:46:04 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782743620739373425 X-GMAIL-MSGID: 1782743620739373425 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 --- 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 */