xpad: Add support for Thrustmaster, Inc. Ferrari 458 Spider Racing Wheel
Subsystems (2)
cover xpad: Add support for Thrustmaster, Inc. Ferrari 458 Spider Racing Wheel
Hello,
This patch series adds support for the Thrustmaster, Inc. Ferrari 458 Spider Racing Wheel (USB ID 044f:b671) to the xpad driver. The implementation is inspired by the work in https://github.com/Capure/xpad.
The wheel reports steering and pedal data at non-standard offsets, so custom axis mapping is introduced via a new mapping flag. I have tested the changes with the actual hardware on Fedora 42 (kernel 6.15.7-200.fc42.x86_64), and confirmed correct input reporting.
If you prefer a different name for the mapping flag, please let me know.
Please consider this for upstream inclusion.
Pär Eriksson (3):
Input: xpad - Add MAP_FERRARI_458_CUSTOM_AXES mapping flag
Input: xpad - Add Thrustmaster Ferrari 458 Spider (044f:b671) device
entry
Input: xpad - Implement custom axis mapping for Ferrari 458 Spider
drivers/input/joystick/xpad.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-)
Signature · 1 line
2.50.1
PATCH 1/3 Input: xpad - Add MAP_FERRARI_458_CUSTOM_AXES mapping flag
Introduce MAP_FERRARI_458_CUSTOM_AXES to support custom axis mapping for the Thrustmaster Ferrari 458 Spider wheel and pedals.
--- drivers/input/joystick/xpad.c | 1 + 1 file changed, 1 insertion(+)
drivers/input/joystick/xpad.c +1 -0
@@ -84,6 +84,7 @@#define MAP_PADDLES BIT(4)#define MAP_PROFILE_BUTTON BIT(5)#define MAP_SHARE_OFFSET BIT(6) +#define MAP_FERRARI_458_CUSTOM_AXES BIT(7)#define DANCEPAD_MAP_CONFIG (MAP_DPAD_TO_BUTTONS | \ MAP_TRIGGERS_TO_BUTTONS | MAP_STICKS_TO_NULL)
Signature · 1 line
2.50.1
PATCH 2/3 Input: xpad - Add Thrustmaster Ferrari 458 Spider (044f:b671) device entry
In reply to Pär ErikssonAdd the USB ID for the Thrustmaster Ferrari 458 Spider (044f:b671) to the device table, using the MAP_FERRARI_458_CUSTOM_AXES mapping flag.
--- drivers/input/joystick/xpad.c | 1 + 1 file changed, 1 insertion(+)
drivers/input/joystick/xpad.c +1 -0
@@ -147,6 +147,7 @@ static const struct xpad_device { { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX }, { 0x044f, 0x0f10, "Thrustmaster Modena GT Wheel", 0, XTYPE_XBOX }, { 0x044f, 0xb326, "Thrustmaster Gamepad GP XID", 0, XTYPE_XBOX360 }, + { 0x044f, 0xb671, "Thrustmaster, Inc. Ferrari 458 Spider Racing Wheel", MAP_FERRARI_458_CUSTOM_AXES, XTYPE_XBOXONE }, { 0x044f, 0xd01e, "ThrustMaster, Inc. ESWAP X 2 ELDEN RING EDITION", 0, XTYPE_XBOXONE }, { 0x045e, 0x0202, "Microsoft X-Box pad v1 (US)", 0, XTYPE_XBOX }, { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)", 0, XTYPE_XBOX },
Signature · 1 line
2.50.1
PATCH 3/3 Input: xpad - Implement custom axis mapping for Ferrari 458 Spider
In reply to Pär ErikssonUpdate xpadone_process_packet to handle steering and pedal data at non-standard offsets for devices with MAP_FERRARI_458_CUSTOM_AXES.
--- drivers/input/joystick/xpad.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-)
drivers/input/joystick/xpad.c +22 -11
@@ -1135,17 +1135,23 @@ static void xpadone_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned charinput_report_key (dev,BTN_THUMBR , data[5 ] &BIT (7 ));if (!(xpad->mapping &MAP_STICKS_TO_NULL )) { -/* left stick */ -input_report_abs (dev,ABS_X , - (__s16 )le16_to_cpup ((__le16 *)(data +10 ))); -input_report_abs (dev,ABS_Y , - ~(__s16 )le16_to_cpup ((__le16 *)(data +12 ))); - -/* right stick */ -input_report_abs (dev,ABS_RX , - (__s16 )le16_to_cpup ((__le16 *)(data +14 ))); -input_report_abs (dev,ABS_RY , - ~(__s16 )le16_to_cpup ((__le16 *)(data +16 ))); +if (xpad->mapping &MAP_FERRARI_458_CUSTOM_AXES ) { +/* steering wheel */ +input_report_abs (dev,ABS_X , + ((__u16 )le16_to_cpup ((__le16 *)(data +6 ))) -S16_MAX ); + }else { +/* left stick */ +input_report_abs (dev,ABS_X , + (__s16 )le16_to_cpup ((__le16 *)(data +10 ))); +input_report_abs (dev,ABS_Y , + ~(__s16 )le16_to_cpup ((__le16 *)(data +12 ))); + +/* right stick */ +input_report_abs (dev,ABS_RX , + (__s16 )le16_to_cpup ((__le16 *)(data +14 ))); +input_report_abs (dev,ABS_RY , + ~(__s16 )le16_to_cpup ((__le16 *)(data +16 ))); + } }/* triggers left/right */
@@ -1154,6 +1160,11 @@ static void xpadone_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char (__u16) le16_to_cpup((__le16 *)(data + 6)));input_report_key (dev,BTN_TR2 , (__u16 )le16_to_cpup ((__le16 *)(data +8 ))); + }else if (xpad->mapping &MAP_FERRARI_458_CUSTOM_AXES ) { +input_report_abs (dev,ABS_Z , + (__u16 )le16_to_cpup ((__le16 *)(data +10 ))); +input_report_abs (dev,ABS_RZ , + (__u16 )le16_to_cpup ((__le16 *)(data +8 ))); }else {input_report_abs (dev,ABS_Z , (__u16 )le16_to_cpup ((__le16 *)(data +6 )));
Signature · 1 line
2.50.1
Hi Pär,
Quoted 11 lines · Pär Eriksson
Hello,
This patch series adds support for the Thrustmaster, Inc. Ferrari 458 Spider Racing Wheel (USB ID 044f:b671) to the xpad driver. The implementation is inspired by the work in https://github.com/Capure/xpad.
The wheel reports steering and pedal data at non-standard offsets, so custom axis mapping is introduced via a new mapping flag. I have tested the changes with the actual hardware on Fedora 42 (kernel 6.15.7-200.fc42.x86_64), and confirmed correct input reporting.
If you prefer a different name for the mapping flag, please let me know.
Please consider this for upstream inclusion.
Quoted 9 lines
Pär Eriksson (3):
Input: xpad - AddMAP_FERRARI_458_CUSTOM_AXESmapping flag
Input: xpad - Add Thrustmaster Ferrari 458 Spider (044f:b671) device
entry
Input: xpad - Implement custom axis mapping for Ferrari 458 Spiderdrivers/input/joystick/xpad.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-)
So I have several concerns with this series in general. First of all, it should be just one patch, but more importantly, the device *does* have standard offsets...just not standard *gamepad* offsets. GIP, the Xbox One controller protocol, uses GUIDs to specify the type of device in question. Most devices you're familiar with use the gamepad GUID, but the wheels use a different one which have a different set of mappings. So ideally, the name of the flag would be MAP_WHEEL.
However, the problem runs deeper. This is all easily detectable from the metadata. xpad *in general* does not support the metadata parsing, so we can't autodetect it without parsing it. Unfortunately, the metadata message is fragmented. xpad *in general* does not support fragmented messages. xpad is based on a very rudimentary understanding of the protocol, which is very obsolete at this point.
I have a new driver I've been working on for a few months that supports all of this stuff properly, including wheels, that I am hoping to support for the 6.17 merge window. I may be too late, but if I submit it soon you can at least pull it downstream while waiting for the 6.18 merge window. I'll see if I can get it ready before the end of the week.
Vicki
Dmitry Torokhov
maintainerHi Vicki,
Quoted 3 lines · Vicki Pfau
I have a new driver I've been working on for a few months that supports all of this stuff properly, including wheels, that I am hoping to support for the 6.17 merge window.
6.17 merge window is closing this weekend so no new drivers can go into it anymore, only what was in maintainer trees/linux-next.
6.18 is the earliest option.
Thanks.
Signature · 1 line
Dmitry
Hi Dmitry
Quoted 10 lines · Dmitry Torokhov
Hi Vicki,
Quoted 3 lines · Vicki Pfau
I have a new driver I've been working on for a few months that supports all of this stuff properly, including wheels, that I am hoping to support for the 6.17 merge window.
6.17 merge window is closing this weekend so no new drivers can go into it anymore, only what was in maintainer trees/linux-next.
I see. I haven't been paying attention to how merge window timing works until now, so that's on me for not cleaning it up sooner for this cycle. My other concerns for this patchset still stand, though.
Quoted 2 lines
6.18 is the earliest option.
That gives me more time to clean it up and generally get it working better, so I guess it's a trade-off here. It's still missing some features I'd like to get in so I don't have to do significant refactoring later.
Quoted 3 lines
Thanks.
Thanks,
Vicki