scarburato / hid-tminit

Linux driver to properly initialize some Thrustmaster Wheels
GNU General Public License v2.0
30 stars 9 forks source link

Support for Thrustmaster TS-PC Racer #13

Closed Penguio closed 2 years ago

Penguio commented 2 years ago

I have an Thrustmaster TS-PC Racer Steering wheel with attached Pedals. Right now in Raceroom (with Proton) it is working as input device with autocentering but there is no FFB. I just saw issue 12 and know that this module is not to add support for FFB but I don't know where/how to start adding these support. The output of lsusb is Bus 005 Device 016: ID 044f:b689 ThrustMaster, Inc. Thrustmaster TS-PC Racer I poked a little bit around in sys/bus and found this

user@user-tower:~$ cd /sys/bus/hid/devices/0003\:044F\:B689.000D
user@user-tower:/sys/bus/hid/devices/0003:044F:B689.000D$ ls -l
total 0
-r--r--r-- 1 root root 4096 22. Feb 18:56 country
lrwxrwxrwx 1 root root    0 22. Feb 18:48 driver -> ../../../../../../../../../../../../bus/hid/drivers/hid-generic
drwxr-xr-x 3 root root    0 22. Feb 18:48 hidraw
drwxr-xr-x 3 root root    0 22. Feb 18:48 input
-r--r--r-- 1 root root 4096 22. Feb 18:56 modalias
drwxr-xr-x 2 root root    0 22. Feb 18:56 power
-r--r--r-- 1 root root 4096 22. Feb 18:48 report_descriptor
lrwxrwxrwx 1 root root    0 22. Feb 18:48 subsystem -> ../../../../../../../../../../../../bus/hid
-rw-r--r-- 1 root root 4096 22. Feb 18:48 uevent
user@user-tower:/sys/bus/hid/devices/0003:044F:B689.000D$ cd driver
user@user-tower:/sys/bus/hid/devices/0003:044F:B689.000D/driver$ ls -l
total 0
lrwxrwxrwx 1 root root    0 22. Feb 18:57 0003:044F:B689.000D -> ../../../../devices/pci0000:40/0000:40:07.1/0000:45:00.3/usb5/5-3/5-3.2/5-3.2.1/5-3.2.1.3/5-3.2.1.3.3/5-3.2.1.3.3:1.0/0003:044F:B689.000D
lrwxrwxrwx 1 root root    0 22. Feb 18:57 0003:04D9:1503.000B -> ../../../../devices/pci0000:40/0000:40:07.1/0000:45:00.3/usb5/5-3/5-3.2/5-3.2.1/5-3.2.1.3/5-3.2.1.3.4/5-3.2.1.3.4:1.0/0003:04D9:1503.000B
lrwxrwxrwx 1 root root    0 22. Feb 18:57 0003:04D9:1503.000C -> ../../../../devices/pci0000:40/0000:40:07.1/0000:45:00.3/usb5/5-3/5-3.2/5-3.2.1/5-3.2.1.3/5-3.2.1.3.4/5-3.2.1.3.4:1.1/0003:04D9:1503.000C
--w------- 1 root root 4096 22. Feb 18:57 bind
lrwxrwxrwx 1 root root    0 22. Feb 18:57 module -> ../../../../module/hid_generic
--w------- 1 root root 4096 22. Feb 18:57 new_id
--w------- 1 root root 4096 12. Feb 20:47 uevent
--w------- 1 root root 4096 22. Feb 18:57 unbind
user@user-tower:/sys/bus/hid/devices/0003:044F:B689.000D/driver$ cd module
user@user-tower:/sys/bus/hid/devices/0003:044F:B689.000D/driver/module$ ls -l
total 0
-r--r--r-- 1 root root 4096 12. Feb 20:49 coresize
drwxr-xr-x 2 root root    0 22. Feb 18:57 drivers
drwxr-xr-x 2 root root    0 12. Feb 20:49 holders
-r--r--r-- 1 root root 4096 22. Feb 18:57 initsize
-r--r--r-- 1 root root 4096 12. Feb 20:47 initstate
drwxr-xr-x 2 root root    0 22. Feb 18:57 notes
-r--r--r-- 1 root root 4096 12. Feb 20:49 refcnt
drwxr-xr-x 2 root root    0 22. Feb 18:57 sections
-r--r--r-- 1 root root 4096 22. Feb 18:57 taint
--w------- 1 root root 4096 12. Feb 20:47 uevent

so it's already recognized correctly but where do I have to search/ask what I could do to make FFB working? Thanks in advance

scarburato commented 2 years ago

so it's already recognized correctly but where do I have to search/ask what I could do to make FFB working?

Sorry for the late response. Basically you have to sniff USB traffic between a Windows host (ideally running in a VM) and the wheel, see the package structure for ffb requests and write a reverse engineered driver. If you're lucky and package structure is similar or equal to the T150 or T300 then you can directly use the t150_driver or hid_tmff2

Alternatively you can try to directly load those drivers anyway and see if ffb works, just add the wheel in the (hid_device_id array)[https://github.com/Kimplul/hid-tmff2/blob/37f0f4bbeddc4a1d1b885a89f08a2921fb3e0d30/hid-tmt300rs.c#L1598], for the t150 use the hid branch. Very unlikely, but it might work.

Also you can use fftest to test ffb under Linux. There are some infos spread around in closed issues in those repos and of course there's the Linux documentation for writing the driver