Message ID | 20221020161401.941927-1-svv@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp203666wrr; Thu, 20 Oct 2022 09:28:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4+isk5NQgZLfXmJqlWtmq3zvfkbU221cghEQGfwO5iZv0MaGY4BSNgTye2zi04c/+7M3u6 X-Received: by 2002:a05:6402:510c:b0:45d:50f:f65 with SMTP id m12-20020a056402510c00b0045d050f0f65mr12670869edd.313.1666283280329; Thu, 20 Oct 2022 09:28:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666283280; cv=none; d=google.com; s=arc-20160816; b=lMZ/PyUM55hsDVKQ633fKgrtAFi68PEFphlkkElz0flx1dl7lFbj58Ie47gj0nNXYL CcM3wTloX0GLFEbIzO7MoIbwKvog4wMr0U5ckoBYRn/muA1IfaXRebHk2igQ0zsy6Cd6 XK9sAAM/1GR73U+/MnyWstFB9UT5PYgqmwgEZfF7zbsHCu9TkH0c+MAir9ZAB7Rks8Xn 71DB2HfatRdCzC9CZfgRzicCbKhmjJ4JaT+C8lkhuJXjCxDFH5d2uG3uqwqStRenlDIT 4PH1I4EGDES/Tjy8phS42v17eyqP6cP/bzhlnfweVbGd/CwYxa1S4YBlEyRhU4qfGfqx Brwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=hkX5nKlhQ/TrI2mbSx0miDUCy9S+/kM4hXZnMa/gNZs=; b=DRvrnKb9UQWtzpikWLU2hXOvnFkG0kD/HNOv2kNp0esg1wma6kJEdW7J2yflwXkGTv aOY7X6sqZMQP0Qn5GNca7N88XDry9d3wgnxdnj0XMnTsM+LZOHQKjD127/a9x7XNhOkQ OQS7SMkehjWCvywqc5R9wio7pWky53cPRiULLlcfVGBDEZcYmz94aY9yTlm6FwqGBvhs obj5T/Q9st6mWV0JgE0pXO3kMcmz7it22Pt6a61Diq9NNl/gDOGyRm+gG0fItI/oxCuK iXg7D5rnXwg+nNzAYK7ZBqMrJnxpU0CLCUgI/CNJACD8bLtVmoIwvnB7tOaJFEXV1jHo YK2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=LBnxNhJE; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv12-20020a17090760cc00b0078c4a772ea7si19425323ejc.11.2022.10.20.09.27.32; Thu, 20 Oct 2022 09:28:00 -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; dkim=pass header.i=@google.com header.s=20210112 header.b=LBnxNhJE; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230024AbiJTQOd (ORCPT <rfc822;ruipengqi7@gmail.com> + 99 others); Thu, 20 Oct 2022 12:14:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229876AbiJTQOb (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 20 Oct 2022 12:14:31 -0400 Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43DF4DEE7 for <linux-kernel@vger.kernel.org>; Thu, 20 Oct 2022 09:14:29 -0700 (PDT) Received: by mail-pj1-x104a.google.com with SMTP id z9-20020a17090a468900b00202fdb32ba1so1871499pjf.1 for <linux-kernel@vger.kernel.org>; Thu, 20 Oct 2022 09:14:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=hkX5nKlhQ/TrI2mbSx0miDUCy9S+/kM4hXZnMa/gNZs=; b=LBnxNhJE5Ik9FjyUR6Uw01rjCvO4wgUO+BCw9GX/+ayIWVLOkx3bCwr2ETERe66Eo+ xjw2IWH2V+0nl0rgUX0g7s6bB4mse2E6XRC29GHmSomTfJJnwZALGJJyhZWPlZnaOZbx BKct+2L7uWOeyL4tjBBeTYYBbY6rjB2eo+KXrTrBolSW44U+lnfuAEu6ocrjyNl19XZX L3juAmNUi4GcF/a6PTXdQzPkajHgX0q7QPkKU7HONItJzoHwF7fLbiDJdyd0oIAyw3se ACdAJkywSHGKPGkez3dkCufZwGl18lQGMliWsWm46z7CQByMCxwvjnGklzglEROIlTvT RotQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=hkX5nKlhQ/TrI2mbSx0miDUCy9S+/kM4hXZnMa/gNZs=; b=H2ualglaD6NGS/5Fan7/lkPEX6S6fxOc6oJabQ2LSd8FmlRu0pA2G7oJ4tvA+4ozco p4fv4mhrm3XXr7fiYcuIEPwJQj9GchyUGyx7OJ3t+ppU1FvQhRRcoDZVtOk6PkJWLV2w y7xPLGe6ZKZGvDc7dQFZ+t8uyVy80Bs+3KpMnTD7j7EbC4AKF/OPD+39ZbGwJ8c+Aaex SMhY3tHNl5jrBMWY/YTegEgB32tSF76h4wxzPRA+VawB9DqZSIeKyM+nNE9qg0wGzis2 JhanlvZ/fghBzp3I5+z6eZKydgSb4nqSivuIASVxhbhlGm8/AUBXnMJACnpo6hFsKegX E+Qg== X-Gm-Message-State: ACrzQf0LOPqtI34HnIr4xIDbbInMQJbyX1cP78JlH7Zzww+IGmFbipji H8hfFue9g/8Zdd6XjvZcg4zaUsQ= X-Received: from svv0.mtv.corp.google.com ([2620:15c:211:202:b62c:23f0:d55a:5c42]) (user=svv job=sendgmr) by 2002:a63:6b83:0:b0:460:c07c:553b with SMTP id g125-20020a636b83000000b00460c07c553bmr12370283pgc.209.1666282468718; Thu, 20 Oct 2022 09:14:28 -0700 (PDT) Date: Thu, 20 Oct 2022 09:14:01 -0700 Mime-Version: 1.0 X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog Message-ID: <20221020161401.941927-1-svv@google.com> Subject: [PATCH] Add rumble support to latest xbox controllers From: Siarhei Vishniakou <svv@google.com> To: Jiri Kosina <jikos@kernel.org>, Benjamin Tissoires <benjamin.tissoires@redhat.com>, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Siarhei Vishniakou <svv@google.com> Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747224656904120571?= X-GMAIL-MSGID: =?utf-8?q?1747224656904120571?= |
Series |
Add rumble support to latest xbox controllers
|
|
Commit Message
Siarhei Vishniakou
Oct. 20, 2022, 4:14 p.m. UTC
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
other xbox controllers, such as xbox elite, should also be possible to
support in a similar way. However, I could only verify this on 2
controllers so far.
In this patch, add rumble support for the following 2 controllers:
1. 'wireless controller for xbox one', model 1708, after applying the
most recent firmware update as of 2022-10-20.
2. 'xbox wireless controller', model 1914. This is also sometimes
referred to as 'xbox series S|X'.
I verified rumble support on both bluetooth and usb.
Signed-off-by: Siarhei Vishniakou <svv@google.com>
---
drivers/hid/hid-ids.h | 2 ++
drivers/hid/hid-microsoft.c | 4 ++++
2 files changed, 6 insertions(+)
Comments
On Thu, 2022-10-20 at 09:14 -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 > other xbox controllers, such as xbox elite, should also be possible > to > support in a similar way. However, I could only verify this on 2 > controllers so far. > > In this patch, add rumble support for the following 2 controllers: > 1. 'wireless controller for xbox one', model 1708, after applying the > most recent firmware update as of 2022-10-20. > 2. 'xbox wireless controller', model 1914. This is also sometimes > referred to as 'xbox series S|X'. This is a good summary of the different models: https://en.wikipedia.org/wiki/Xbox_Wireless_Controller#Summary You can remove the mention of the other names it might have, or the names at the back of the joypad, and use the model numbers instead. I think I have a model of each one of the devices in the list (except 1797 and 1537 IIRC), so I could test this if needed. Do you have a good test case for the various forces of rumble that would exercise both motors?
Hi Bastien, I prefer to keep the various names in the commit message, just so that it's easier to find the commit later when searching for the patch. I found that various teams refer to various controllers in a different way. Happy to rename the variables in the code, though. How about something like: USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1708 USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1708_FIRMWARE_2021 USB_DEVICE_ID_MS_XBOX_CONTROLLER_MODEL_1914 ? I tested this on an Android device, with a simple rumble test app that I wrote. A better way would probably be to write some EV_FF events to /dev/input/eventX node. You could try the "python-evdev" module, which provides a sample rumble script: https://python-evdev.readthedocs.io/en/latest/tutorial.html#injecting-an-ff-event-into-first-ff-capable-device-found I haven't tried that since there's no python on Android. Here's the list of controllers where this could also work: Controller VID PID Classic/BLE Xbox One S 0x045E 0x02E0 Classic Xbox One S 0x045E 0x02FD Classic Xbox One S 0x045E 0x0B20 BLE Xbox Elite Series 2 0x045E 0x0B05 Classic Xbox Elite Series 2 0x045E 0x0B22 BLE Xbox Series S|X 0x045E 0x0B13 BLE On Thu, Oct 20, 2022 at 10:33 AM Bastien Nocera <hadess@hadess.net> wrote: > > On Thu, 2022-10-20 at 09:14 -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 > > other xbox controllers, such as xbox elite, should also be possible > > to > > support in a similar way. However, I could only verify this on 2 > > controllers so far. > > > > In this patch, add rumble support for the following 2 controllers: > > 1. 'wireless controller for xbox one', model 1708, after applying the > > most recent firmware update as of 2022-10-20. > > 2. 'xbox wireless controller', model 1914. This is also sometimes > > referred to as 'xbox series S|X'. > > This is a good summary of the different models: > https://en.wikipedia.org/wiki/Xbox_Wireless_Controller#Summary > > You can remove the mention of the other names it might have, or the > names at the back of the joypad, and use the model numbers instead. > > I think I have a model of each one of the devices in the list (except > 1797 and 1537 IIRC), so I could test this if needed. Do you have a good > test case for the various forces of rumble that would exercise both > motors?
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index da86565f04d4..e9c7eae849b6 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -914,6 +914,8 @@ #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 +#define USB_DEVICE_ID_MS_XBOX_ONE_S_2021_FIRMWARE 0x0b20 +#define USB_DEVICE_ID_MS_XBOX_WIRELESS_CONTROLLER 0x0b13 #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..2973e91fc7a1 100644 --- a/drivers/hid/hid-microsoft.c +++ b/drivers/hid/hid-microsoft.c @@ -448,6 +448,10 @@ static const struct hid_device_id ms_devices[] = { .driver_data = MS_SURFACE_DIAL }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER), .driver_data = MS_QUIRK_FF }, + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_ONE_S_2021_FIRMWARE), + .driver_data = MS_QUIRK_FF }, + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_WIRELESS_CONTROLLER), + .driver_data = MS_QUIRK_FF }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS), .driver_data = MS_QUIRK_FF }, { }