linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add rumble support to latest xbox controllers
@ 2022-10-20 16:14 Siarhei Vishniakou
  2022-10-20 17:33 ` Bastien Nocera
  0 siblings, 1 reply; 4+ messages in thread
From: Siarhei Vishniakou @ 2022-10-20 16:14 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires, linux-input, linux-kernel
  Cc: Siarhei Vishniakou

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(+)

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 },
 	{ }
-- 
2.38.0.135.g90850a2211-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add rumble support to latest xbox controllers
  2022-10-20 16:14 [PATCH] Add rumble support to latest xbox controllers Siarhei Vishniakou
@ 2022-10-20 17:33 ` Bastien Nocera
  2022-10-20 20:48   ` Siarhei Vishniakou
  0 siblings, 1 reply; 4+ messages in thread
From: Bastien Nocera @ 2022-10-20 17:33 UTC (permalink / raw)
  To: Siarhei Vishniakou, Jiri Kosina, Benjamin Tissoires, linux-input,
	linux-kernel

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?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add rumble support to latest xbox controllers
  2022-10-20 17:33 ` Bastien Nocera
@ 2022-10-20 20:48   ` Siarhei Vishniakou
  0 siblings, 0 replies; 4+ messages in thread
From: Siarhei Vishniakou @ 2022-10-20 20:48 UTC (permalink / raw)
  To: Bastien Nocera
  Cc: Jiri Kosina, Benjamin Tissoires, linux-input, linux-kernel,
	Android Framework Input

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?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add rumble support to latest xbox controllers
@ 2023-02-15 20:46 Edward Matijevic
  0 siblings, 0 replies; 4+ messages in thread
From: Edward Matijevic @ 2023-02-15 20:46 UTC (permalink / raw)
  To: svv
  Cc: android-framework-input, benjamin.tissoires, hadess, jikos,
	linux-input, linux-kernel

Using _BLE instead of _FIRMWARE_2021 would be more descriptive for why
there needs to be a secondary ID for the same device.
"_FIRMWARE_2021" is a bit ambiguous as the firmware version with the
change is 5.13 and later firmwares.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-15 20:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-20 16:14 [PATCH] Add rumble support to latest xbox controllers Siarhei Vishniakou
2022-10-20 17:33 ` Bastien Nocera
2022-10-20 20:48   ` Siarhei Vishniakou
2023-02-15 20:46 Edward Matijevic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).