From patchwork Thu Mar 30 02:47:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vicki Pfau X-Patchwork-Id: 668726 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDFA8C74A5B for ; Thu, 30 Mar 2023 02:48:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229512AbjC3CsM (ORCPT ); Wed, 29 Mar 2023 22:48:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbjC3CsL (ORCPT ); Wed, 29 Mar 2023 22:48:11 -0400 Received: from endrift.com (endrift.com [173.255.198.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F7C84EE4 for ; Wed, 29 Mar 2023 19:48:09 -0700 (PDT) Received: from nebulosa.vulpes.eutheria.net (unknown [50.47.218.115]) by endrift.com (Postfix) with ESMTPSA id 6679EA276; Wed, 29 Mar 2023 19:48:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=endrift.com; s=2020; t=1680144488; bh=Y88uDpOFZ1q6410w736n3wXwIl0G+4VQrfHC0yZB+X4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MYgHp3XXmFtjzCOzjeOF94W5HkACXI/ufj4EGAbAcZl5QloI3uktyN/qZGcLeaile GJ34UnHrbkGbXtRqN8wBbXqnpN1EmooPMq5ZMSF5UaQLxwjIzrkfVmZxgF8Ee6gxS3 wptwlQyET2qFhYbqSIMtCWLCFMxfc5ahSZ/shtCSmnBzYFv779h+viQd2EGQhgaIQU Na1c1cYQ/hxsFpd+6r2fgMWDTSqPlEudyp6XjItjZmNYN4IeHm4LkWgVbJzi8yMYfH OzF+ASTXhyxuzVx06eLUbUTORgq7Z1dFQFOarAad3lSYtAncaeYHEaKlY9pn2EEPMs VApH9LXaVZEWg== From: Vicki Pfau To: Dmitry Torokhov , Benjamin Tissoires , linux-input@vger.kernel.org Cc: Vicki Pfau , Pavel Rojtberg Subject: [PATCH 1/2] Input: xpad - Add constants for GIP interface numbers Date: Wed, 29 Mar 2023 19:47:51 -0700 Message-Id: <20230330024752.2405603-2-vi@endrift.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230330024752.2405603-1-vi@endrift.com> References: <20230330024752.2405603-1-vi@endrift.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Wired GIP devices present multiple interfaces with the same USB identification other than the interface number. This adds constants for differentiating two of them and uses them where appropriate Signed-off-by: Vicki Pfau --- drivers/input/joystick/xpad.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 2d86ca0c1ace..698224e1948f 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -561,6 +561,9 @@ struct xboxone_init_packet { #define GIP_MOTOR_LT BIT(3) #define GIP_MOTOR_ALL (GIP_MOTOR_R | GIP_MOTOR_L | GIP_MOTOR_RT | GIP_MOTOR_LT) +#define GIP_WIRED_INTF_DATA 0 +#define GIP_WIRED_INTF_AUDIO 1 + /* * This packet is required for all Xbox One pads with 2015 * or later firmware installed (or present from the factory). @@ -2004,7 +2007,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id } if (xpad->xtype == XTYPE_XBOXONE && - intf->cur_altsetting->desc.bInterfaceNumber != 0) { + intf->cur_altsetting->desc.bInterfaceNumber != GIP_WIRED_INTF_DATA) { /* * The Xbox One controller lists three interfaces all with the * same interface class, subclass and protocol. Differentiate by From patchwork Thu Mar 30 02:47:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vicki Pfau X-Patchwork-Id: 669685 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6E1BC77B61 for ; Thu, 30 Mar 2023 02:48:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229457AbjC3CsM (ORCPT ); Wed, 29 Mar 2023 22:48:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229555AbjC3CsM (ORCPT ); Wed, 29 Mar 2023 22:48:12 -0400 Received: from endrift.com (endrift.com [173.255.198.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0253E4EEF for ; Wed, 29 Mar 2023 19:48:09 -0700 (PDT) Received: from nebulosa.vulpes.eutheria.net (unknown [50.47.218.115]) by endrift.com (Postfix) with ESMTPSA id 02410A280; Wed, 29 Mar 2023 19:48:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=endrift.com; s=2020; t=1680144489; bh=wXF75mBC21V+Gyo7A1yZ3wJPHDk6MzQPhcXOaRzqW2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N9EyX5PMzc3yAWK8IPA6Ct2ajXa27KrIsnKN6wK8Tc+D3RNaYKDYDwmGVS2ttG9C3 UaWmvrizQSkZTkdUY5tG0ZVqhsvMD/7h4s12toRz4BMJrucnqjbfieSLRu7nixXhjY OuwwxfWzrHS89haLTtJFdvcDG27V4TDsUTx9a1NDQMJrDhIDEgEUHGkMfucQJTTFIk ffs+UoH0w973WJFH0kl019lZjgT1Cu049U7oHdCDQX9KKDGWVHJBRMJ31lriZyltBY hTNElYmlIApOzwRSTM8vag1BJvpDGu6sVzIY3wg+14Opk+HSxiXMtw93STQQ4cTCbB Z9NryBS3bF2IQ== From: Vicki Pfau To: Dmitry Torokhov , Benjamin Tissoires , linux-input@vger.kernel.org Cc: Vicki Pfau , Pavel Rojtberg Subject: [PATCH 2/2] Input: xpad - fix PowerA EnWired Controller guide button Date: Wed, 29 Mar 2023 19:47:52 -0700 Message-Id: <20230330024752.2405603-3-vi@endrift.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230330024752.2405603-1-vi@endrift.com> References: <20230330024752.2405603-1-vi@endrift.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org This commit explicitly disables the audio interface the same way the official driver does. This is needed for some controllers, such as the PowerA Enhanced Wired Controller for Series X|S (0x20d6:0x200e) to report the guide button. Signed-off-by: Vicki Pfau --- drivers/input/joystick/xpad.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 698224e1948f..c31fc4e9b310 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -1396,6 +1396,14 @@ static int xpad_start_xbox_one(struct usb_xpad *xpad) unsigned long flags; int retval; + /* Explicitly disable the audio interface. This is needed for some + * controllers, such as the PowerA Enhanced Wired Controller + * for Series X|S (0x20d6:0x200e) to report the guide button */ + retval = usb_set_interface(xpad->udev, GIP_WIRED_INTF_AUDIO, 0); + if (retval) + dev_warn(&xpad->dev->dev, + "unable to disable audio interface: %d\n", retval); + spin_lock_irqsave(&xpad->odata_lock, flags); /*