From patchwork Tue Apr 11 03:16:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vicki Pfau X-Patchwork-Id: 13206974 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 17B79C76196 for ; Tue, 11 Apr 2023 03:17:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229864AbjDKDRO (ORCPT ); Mon, 10 Apr 2023 23:17:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229973AbjDKDRL (ORCPT ); Mon, 10 Apr 2023 23:17:11 -0400 Received: from endrift.com (endrift.com [173.255.198.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B104F2D5A for ; Mon, 10 Apr 2023 20:17:04 -0700 (PDT) Received: from nebulosa.vulpes.eutheria.net (unknown [50.47.218.115]) by endrift.com (Postfix) with ESMTPSA id 96F06A282; Mon, 10 Apr 2023 20:17:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=endrift.com; s=2020; t=1681183024; bh=UDI5JU/S6ZbGF6XM6UJU1TNOgPF0Mku6CnHDJBsRTt8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fRgAgNjyoRtI/oJVgj2IlAGv+D/V7SPQ6GdUV5xWIg6zN+DRlQ11yTnqpOx7q03Lu zZoktovF7UEhRvIpAfBL8uFhT20DV5CIbW3cLcp9TrLyHIkxiqdVzKa6LLBjYHmTQU qP1Hkw8CmYwwchJFGCXDoEc0ln2tYqN0GnT2EVdSBYVNxxZIrAKa2AoFnp/Nh/2oLM BBm6jNgitGJXUw1lAeZwy0IdB4ZFr3A6b+g0ffbZ9BfQnzhvBKE6lKEHqvIAFCUxK7 QqIW8gLK/YrhA4of5Qd5RCECvaZNQF1ARfdpVZV/0iQAzxXkw0cpXoDbzVvLlmamMG ftYULSsRBu32g== From: Vicki Pfau To: Dmitry Torokhov , linux-input@vger.kernel.org Cc: Vicki Pfau , Pavel Rojtberg Subject: [PATCH v2 1/2] Input: xpad - Add constants for GIP interface numbers Date: Mon, 10 Apr 2023 20:16:49 -0700 Message-Id: <20230411031650.960322-2-vi@endrift.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230411031650.960322-1-vi@endrift.com> References: <20230411031650.960322-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 260f91fef427..6ea9c10dfb8a 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 Tue Apr 11 03:16:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vicki Pfau X-Patchwork-Id: 13206975 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 2A3D9C77B61 for ; Tue, 11 Apr 2023 03:17:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229941AbjDKDRR (ORCPT ); Mon, 10 Apr 2023 23:17:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229981AbjDKDRL (ORCPT ); Mon, 10 Apr 2023 23:17:11 -0400 Received: from endrift.com (endrift.com [173.255.198.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C8492D62 for ; Mon, 10 Apr 2023 20:17:05 -0700 (PDT) Received: from nebulosa.vulpes.eutheria.net (unknown [50.47.218.115]) by endrift.com (Postfix) with ESMTPSA id 2BBC1A286; Mon, 10 Apr 2023 20:17:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=endrift.com; s=2020; t=1681183024; bh=Ttk2m5AvoSX9qu9WZHopMD6RQeOqeriupwHUH6TNIqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W0kzwg5Rs/Z1b3jP469mM/3OE0SuW4mjCLNlrD8cOzfYKlACnIQyrJ1e5LIS3ZAo0 t6FAYRYHHhyOjLIpaX68CMocRk1T6kzfGaAoPMGoKBXh8YXYAysJ0GGpiMd2sfoCP5 rvqr0QNAcODBrJCp8AFiyCiZcONbaHWhBi4CmAQs2UjEzgHlwwuYnKU8Fx+FAA0fk0 4sfAaTWxrD/DiUCVpRE0JtqBo3LOyOk4G7lI/HqLiWggaDAUpyHHqRuGCsnxRzWXMz 47O12NhorVixZvRutMI041oTLdSriJq3130L4XDp+MOXXqMnYVaTAfHxUjxmS0j0IR H9xRvvtPLkPZA== From: Vicki Pfau To: Dmitry Torokhov , linux-input@vger.kernel.org Cc: Vicki Pfau , Pavel Rojtberg Subject: [PATCH v2 2/2] Input: xpad - fix PowerA EnWired Controller guide button Date: Mon, 10 Apr 2023 20:16:50 -0700 Message-Id: <20230411031650.960322-3-vi@endrift.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230411031650.960322-1-vi@endrift.com> References: <20230411031650.960322-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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 6ea9c10dfb8a..175fcba7f92d 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -1396,6 +1396,16 @@ static int xpad_start_xbox_one(struct usb_xpad *xpad) unsigned long flags; int retval; + if (usb_ifnum_to_if(xpad->udev, GIP_WIRED_INTF_AUDIO)) { + /* 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); /*