Skip to content
Kimplul edited this page Jul 13, 2023 · 6 revisions

Welcome to the hid-tmff2 wiki!

Installing the Windows drivers inside a proton prefix

  1. Install protontricks.

  2. Download the Thrustmaster drivers.

  3. Look up the ID of your game with protontricks -s NAME. For example:

    $ protontricks -s Dirt
    Found the following games:
    DiRT 3 Complete Edition (321040)
    DiRT 4 (421020)
    DiRT Rally (310560)
    DiRT Rally 2.0 (690790)
    
    To run Protontricks for the chosen game, run:
    $ protontricks APPID COMMAND
    
    NOTE: A game must be launched at least once before Protontricks can find the game.
    
  4. Run the driver installer with protontricks.

    protontricks -c 'wine ~/Downloads/DRIVER_INSTALL_EXE' APPID
    

    Dirt 4 for example:

    protontricks -c 'wine ~/Downloads/2022_TTRS_1.exe' 421020
    

Note that protontricks may change the working directory, so relative paths may end up not working as expected.

Installing the Windows drivers manually

Assuming you've already downloaded the installer:

WINE_PREFIX=/path/to/prefix wine ./DRIVER_INSTALL_EXE

Lutris is an excellent way to keep track of which non-steam games exist in which prefixes, and allows you to run executables in prefixes from a GUI if that's more your thing.

Structure of the Thrustmaster device 'stack'

  • hid-tmff

Driver for older Thrustmaster wheels, has existed in the Kernel for a long time and I have nothing to with it.

  • hid-thrustmaster

Driver for initializing newer Thrustmaster wheels, initially added in version 5.13. Essentially hid-tminit, with some modifications to better fit into the kernel.

  • hid-tminit

Driver for initializing newer Thrustmaster wheels, currently maintained over at https://github.com/scarburato/hid-tminit. All newer Thrustmaster wheels initially identify themselves as Thrustmaster FFB Wheel, and it is up to the hid-tminit driver to boot the wheel into its correct designation, after which the corresponding driver can take over. No FFB takes place while this driver is active.

  • hid-tmff-new

'Actual' driver module for T300RS and T248 wheels, responsible for handling FFB. At the moment only supports T300 RS and T248. Note that the T300 RS has a number of different modes, of which PS3, PS4, and PS3 F1 (advanced) mode are known to work (at least on some systems, please open up any issues you encounter.)

  • hid-tmff2

Name of this projects, initially I intended to write hid-tmff but for newer wheels, hence the name. Because of some slight weirdness in the Kernel build configuration, I couldn't use hid-tmff2 as the module name, so I chose hid-tmff-new.

I don't know exactly which wheels are 'newer' and which are 'older', but at least T150/T248/T300/T500 are in the 'newer' category.

Note that the T150 already has a driver (https://github.com/scarburato/t150_driver) and the T500 is under development (https://github.com/cazzoo/hid-tmff2). Contact these projects if you'd like to help with these wheels.

How to capture what effects a game sends to the driver

Use ffbwrap from ffbtools: https://github.com/berarma/ffbtools

The documentation gives good examples, but tl;dr; For steam, insert the following into a game's launch options:

ffbwrap --logger=/home/$USER/game.log /dev/input/by-id/usb-Thrustmaster_Thrustmaster_T300RS_Racing_wheel-event-joystick -- %command%

This will create a file called game.log (with additional timestamp) in your home directory. Preferably change the name to suit the game, but you do you.

Note that most fixes presented in the documentation are more or less obsolete by now, but the tool is still very useful for logging purposes.

How to capture what USB packets the driver sends to the device

I'd recommend wireshark: https://www.wireshark.org/

Usb capture setup is fairly straightforward: https://wiki.wireshark.org/CaptureSetup/USB#linux

Here's what I typically do when starting capturing:

  • Run sudo modprobe usbmon. This will load a kernel module that allows Wireshark to read the USB packets.
  • Open wireshark with root privileges. There are some ways to allow wireshark to access the packets with regular user privileges, I just haven't bothered with it.
  • Select usbmon0 from the view that opens up by default.
  • The screen will quickly fill up with noise from other devices connected to the computer, so you will have to filter out the noise.
    • Run lsusb in a terminal. Look for the T300 in the list, you should see something like Bus 001 Device 006: ID 044f:b66e ThrustMaster, Inc. Thrustmaster T300RS Racing wheel
    • From the previous command, the Bus and Device fields can be used to filter out only packets from/to the device. To see all packets coming from the wheel, add in a filter usb.src ~ "1\.6\..*", where 1 is in this case from the Bus field and 6 from the Device field. To see all packets coming from the device, use usb.dst.
    • This data is probably also filled with a lot of cruft. Data to/from endpoint 2 is button state info, which is probably unnecessary. To see FFB data being sent to the device, use endpoint 1, i.e. usb.dst == "1.6.1". ~ is a Perl-compliant regex operator, whereas == just matches the string directly. To see both data coming from the device and going to it, use usb.dst == "..." || usb.src == "...".
    • There is also endpoint 0, usb.src == "1.6.0" but it doesn't seem to be used for much.
  • Use the three buttons in the top left of the screen to start, stop and restart captures.
  • Do whatever you want with the device, packets should automatically be captured. When you want to save your capture to a file, stop the recording and go to File > Export Specified Packets and make sure Displayed is selected. This will apply the filter you've been using, and will only include the packets that are visible in Wireshark, i.e. it applies the filter you've specified.

Note that every time you unplug and replug your wheel, its Device field will probably change.

How to add in support for a new T-series wheel

Should probably not be too often that you need this info, but essentially use wireshark like in the previous example, but spin up a Windows virtual machine and install the Thrustmaster drivers on to it, and pass the device to the virtual machine. I prefer to use qemu with virt-manager as a frontend. With the wheel working under Windows, install fedit.exe (https://gimx.fr/download/b882e209a0ac023d03abbf560dfc3f25fe6367ca/fedit.zip) and methodically go through all effects the device supports and compare the USB packets the driver sends out. You should be able to build up a table of what each value in the USB packet means, see force-effects.txt for an example of what I found out about the T300.