Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6653462rwr; Tue, 25 Apr 2023 01:27:41 -0700 (PDT) X-Google-Smtp-Source: AKy350Y6zQdefTHVWIlECHKXspLNmHULkOpSjEv590hasuImrpm1nQdfXXUakV+iVOltY6JX1aMK X-Received: by 2002:a17:90b:3b50:b0:246:57ba:ab28 with SMTP id ot16-20020a17090b3b5000b0024657baab28mr17987541pjb.2.1682411261486; Tue, 25 Apr 2023 01:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682411261; cv=none; d=google.com; s=arc-20160816; b=G6JAK/1tUvW4m/iERjy/Kpo/o9siFV2G/ulTRKO348kNbjPqO4IuQjDVJYt1lr3/bd fy6iG+nDGxAQyi/5T85ncWVWyHajvxjE2ksGAcX5otqCFdDS0VNd77MDfegOulpP/NfD wRDVYhp70nWtVAZaWIgXawJ2bHJeMq1gN/+nX1iB2h8fu9naMCdWOFCmxYTBsKiyxQoF d5WFkBDwlH+rMHgfgdo82qYXGDkOi70OCANc9gWHpH7Dh0xGf8KS1oir6CAVcb/7BjEF jNgj75ZDptbC06vZ9XEEemQJwMha1EhzNLgwFxHhtwQcE8rQLDXj7UMSwdGLJ5RafXTZ 0cgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:to:from :subject:message-id; bh=5HPl8JdkihxQG2TbRPuGlHj+lnPWDGW68bYe/l/gx4A=; b=qQxVGWdl+yQtxgBfiTglsvXZqBejT2xjrSq0/t8hVDJKvnBr4cdywZytcOG/zfHYvR 73Ev5IdMbYwgHhBTD+IweD0qcOCeha60j2xac1Ty8jLqDeoz7yh2DyMfS/nn2NgtTM0r Stdh7U1xMlj5P3K+OxZZWfHX6Ioj8YcwIfuQH00hzQMA025DqcZK+cbneGM3r2oiuy11 9CmXuzwt7N0rQb2/bvKjeuneR2nyr6Ml9HB7/8YKMt9gLrevbQ/tOdVXweh8XHq8MMHS uGwPzsYWcj63ShK9tewO2/AnGaaviolOA4ichnAyrkhr/FZFhunq+gQ7RMf9nQtsj440 SbOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id az24-20020a17090b029800b0024b6a8879c3si10453819pjb.68.2023.04.25.01.27.30; Tue, 25 Apr 2023 01:27:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233601AbjDYI0W convert rfc822-to-8bit (ORCPT + 99 others); Tue, 25 Apr 2023 04:26:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233238AbjDYI0V (ORCPT ); Tue, 25 Apr 2023 04:26:21 -0400 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 830FB5242; Tue, 25 Apr 2023 01:26:18 -0700 (PDT) Received: (Authenticated sender: hadess@hadess.net) by mail.gandi.net (Postfix) with ESMTPSA id D4CE52000F; Tue, 25 Apr 2023 08:26:15 +0000 (UTC) Message-ID: <6faea48203e5fe2f4c95106dd95ffceed8c5f236.camel@hadess.net> Subject: Re: [PATCH v3] Add rumble support to latest xbox controllers From: Bastien Nocera To: Siarhei Vishniakou , Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 25 Apr 2023 10:26:15 +0200 In-Reply-To: <20230425010618.2303982-1-svv@google.com> References: <20230425010618.2303982-1-svv@google.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.48.0 (3.48.0-1.fc38) MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2023-04-24 at 18:06 -0700, Siarhei Vishniakou wrote: > Currently, rumble is only supported via bluetooth on a single xbox > controller, called 'model 1708'. On the back of the device, it's named > 'wireless controller for xbox one'. However, in 2021, Microsoft released > a firmware update for this controller. As part of this update, the HID > descriptor of the device changed. The product ID was also changed from > 0x02fd to 0x0b20. On this controller, rumble was supported via > hid-microsoft, which matched against the old product id (0x02fd). As a > result, the firmware update broke rumble support on this controller. > > The hid-microsoft driver actually supports rumble on the new firmware, > as well. So simply adding new product id is sufficient to bring back > this support. > > After discussing further with the xbox team, it was pointed out that > another xbox controller, xbox elite series 2, can be supported in a > similar way. > > Add rumble support for all of these devices in this patch. Two of the > devices have received firmware updates that caused their product id's to > change. Both old and new firmware versions of these devices were tested. > > The tested controllers are: > > 1. 'wireless controller for xbox one', model 1708 > 2. 'xbox wireless controller', model 1914. This is also sometimes >    referred to as 'xbox series S|X'. > 3. 'elite series 2', model 1797. > > The tested configurations are: > 1. model 1708, pid 0x02fd (old firmware) > 2. model 1708, pid 0x0b20 (new firmware) > 3. model 1914, pid 0x0b13 > 4. model 1797, pid 0x0b05 (old firmware) > 5. model 1797, pid 0x0b22 (new firmware) > > I verified rumble support on both bluetooth and usb. > > Reviewed-by: Bastien Nocera > Signed-off-by: Siarhei Vishniakou > --- >  drivers/hid/hid-ids.h       |  8 +++++++- >  drivers/hid/hid-microsoft.c | 11 ++++++++++- >  2 files changed, 17 insertions(+), 2 deletions(-) > > diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h > index 053853a891c5..5d98b2a3a5e4 100644 > --- a/drivers/hid/hid-ids.h > +++ b/drivers/hid/hid-ids.h > @@ -903,7 +903,13 @@ >  #define USB_DEVICE_ID_MS_TYPE_COVER_2    0x07a9 >  #define USB_DEVICE_ID_MS_POWER_COVER     0x07da >  #define USB_DEVICE_ID_MS_SURFACE3_COVER                0x07de > -#define USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER 0x02fd > +// For a description of the Xbox controller models, refer to: > +// https://en.wikipedia.org/wiki/Xbox_Wireless_Controller#Summary The kernel doesn't use C++ style comments, but C-style comments. Checking your patch with checkpatch.pl should warn about it: https://docs.kernel.org/process/submitting-patches.html#style-check-your-changes > +#define USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1708    0x02fd > +#define USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1708_BLE        0x0b20 The 1708 model uses Bluetooth Classic, not Bluetooth LE. > +#define USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1914    0x0b13 > +#define USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1797    0x0b05 > +#define USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1797_BLE        0x0b22 >  #define USB_DEVICE_ID_MS_PIXART_MOUSE    0x00cb >  #define USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS      0x02e0 >   > diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c > index 071fd093a5f4..9345e2bfd56e 100644 > --- a/drivers/hid/hid-microsoft.c > +++ b/drivers/hid/hid-microsoft.c > @@ -446,7 +446,16 @@ static const struct hid_device_id ms_devices[] = { >                 .driver_data = MS_PRESENTER }, >         { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, 0x091B), >                 .driver_data = MS_SURFACE_DIAL }, > -       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER), > + > +       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1708), > +               .driver_data = MS_QUIRK_FF }, > +       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1708_BLE), > +               .driver_data = MS_QUIRK_FF }, > +       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1914), > +               .driver_data = MS_QUIRK_FF }, > +       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1797), > +               .driver_data = MS_QUIRK_FF }, > +       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1797_BLE), >                 .driver_data = MS_QUIRK_FF }, >         { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS), >                 .driver_data = MS_QUIRK_FF },