MiSTer-devel / Linux-Kernel_MiSTer

Other
12 stars 17 forks source link

Add Fanatec wheel driver #24

Closed coolbho3k closed 2 years ago

coolbho3k commented 2 years ago

This PR adds support for Fanatec steering wheels. I'm planning on using this support to help add support to MiSTer for playing arcade racing games and console racing games like Gran Turismo on PSX with all steering wheels, as I have this device on hand.

The driver is hid-fanatecff by gotzl: https://github.com/gotzl/hid-fanatecff

Notes

Steering wheels don't work very well with MiSTer, because MiSTer assumes wheels are generic joysticks, but I'm planning on making a contribution to improve support for all racing wheels in the Main_MiSTer project.

Currently, the plan is to detect steering wheel vendor/device IDs using a quirk and provide a way to map the steering axis to left stick left/right (right now, it's defaulting to up/down and cannot be remapped), the accelerator axis to R2 or right stick, and the brake axis to L2 or right stick. Most of the buttons can already be mapped in the menu just fine.

Test plan

When plugging in the wheel, the driver initializes correctly:

[ 2888.089175] input: Fanatec FANATEC Podium Wheel Base DD1 as /devices/platform/soc/ffb40000.usb/usb1/1-1/1-1.6/1-1.6:1.0/0003:0EB7:0004.000B/input/input14
[ 2888.093746] ftec_csl_elite 0003:0EB7:0004.000B: input,hiddev1,hidraw1: USB HID v1.11 Joystick [Fanatec FANATEC Podium Wheel Base DD1] on usb-ffb40000.usb-1.6/input0
[ 2888.094915] ftec_csl_elite 0003:0EB7:0004.000B: Hires timer: period = 2 ms

The last two log lines are from the driver.

The main MiSTer binary is detecting all axes and buttons on the wheel just fine, including all pedals and buttons on the wheel. This is what is printed when you turn the wheel, for example:

0eb7:0004:00 P0 Input event: type=EV_ABS, Axis=0 [0...65535], Offset=51148
0eb7:0004:00 P0 Input event: type=EV_ABS, Axis=0 [0...65535], Offset=51050