Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thrustmaster TS-PC (TS Racer) support #65

Open
solarisfire opened this issue May 7, 2023 · 16 comments
Open

Thrustmaster TS-PC (TS Racer) support #65

solarisfire opened this issue May 7, 2023 · 16 comments

Comments

@solarisfire
Copy link

Any chance this wheelbase could be supported?

Should be similar to some of the other bases.

Currently just getting:

[ 308.587876] usb 3-2.3: new full-speed USB device number 10 using xhci_hcd
[ 308.714187] usb 3-2.3: New USB device found, idVendor=044f, idProduct=b65d, bcdDevice= 7.00
[ 308.714189] usb 3-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 308.714191] usb 3-2.3: Product: Thrustmaster FFB Wheel
[ 308.714192] usb 3-2.3: Manufacturer: Thrustmaster
[ 308.814269] input: Thrustmaster Thrustmaster FFB Wheel as /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:07:00.3/usb3/3-2/3-2.3/3-2.3:1.0/0003:044F:B65D.0013/input/input30
[ 308.814347] hid-tminit 0003:044F:B65D.0013: input,hidraw17: USB HID v1.00 Gamepad [Thrustmaster Thrustmaster FFB Wheel] on usb-0000:07:00.3-2.3/input0
[ 308.834183] hid-tminit 0003:044F:B65D.0013: Unknown wheel's model id 0x6, unable to proceed further with wheel init

@Kimplul
Copy link
Owner

Kimplul commented May 7, 2023

Any chance this wheelbase could be supported?

Supported, probably yes, but how much work that would take is hard to say. Unfortunately thrustmaster wheels
don't seem to really follow any consistent APIs, so two seemingly similar wheels may require wildly different implementations.

Did you already read https://github.com/Kimplul/hid-tmff2/wiki#how-to-add-in-support-for-a-new-t-series-wheel?
In addition to the stuff in the wiki, it seems that the TS-PC's initialization value is unknown, so we'd need some USB packet
captures of plugging the wheel in as well. The value would have to be added to the wheel table in hid-tminit.

@solarisfire
Copy link
Author

I am going to try and get the USB traces for this... just struggling to find some free time to do it!

@Potajito
Copy link

I also have a TS-PC would love to give a hand.

@Kimplul
Copy link
Owner

Kimplul commented Oct 21, 2023

@Potajito thanks for showing interest. As far as I'm aware, no USB packet captures have been made, so the general outline in #65 (comment) still applies. Please read through https://github.com/Kimplul/hid-tmff2/wiki#how-to-add-in-support-for-a-new-t-series-wheel and if you feel up for, try doing some captured and seeing if you can find some patterns in the data.

@solarisfire
Copy link
Author

Could do with some guidance when capturing.

It just seems to be a stream of URB_INTERRUPT and URB_CONTROL packets.

It did come back with some data on unplug/replug but not sure which bits would be the initialization value.

DEVICE DESCRIPTOR
bLength: 18
bDescriptorType: 0x01 (DEVICE)
bcdUSB: 0x0100
bDeviceClass: Device (0x00)
bDeviceSubClass: 0
bDeviceProtocol: 0 (Use class code info from Interface Descriptors)
bMaxPacketSize0: 8
idVendor: ThrustMaster, Inc. (0x044f)
idProduct: Unknown (0xb65d)
bcdDevice: 0x0700
iManufacturer: 1
iProduct: 2
iSerialNumber: 0
bNumConfigurations: 1

https://drive.google.com/file/d/13odXGOEfqU_Wfi7NfChZVsW5YsEGFQTp/view?usp=share_link

Not sure where I'd start trying to work out any sort of values for force feedback values. I think I need to find a tutorial for FEdit1...

@Kimplul
Copy link
Owner

Kimplul commented Oct 23, 2023

Sure, thanks for the capture. Just to start off with, the initial wheel state is with idProduct 0xb65d, and the Windows driver then sends out a packet to restart the wheel. After the restart, the wheel reconnects with idProduct 0xb689, as can be seen at packet no. 156 in your capture. So there should be at least one URB_CONTROL out from host to 3.1.0 in the first 150 or so packets that approximately matches
https://github.com/scarburato/hid-tminit/blob/9375f6c7d83af5dd6c8b8fe30351d0f36043b20a/hid-tminit.c#L140

In this case, it seems to be packet number 151, and from this we can see that the wValue used is 0x0009. This is the switch_value in struct tm_wheel_info.

Then we need to find another packet with the wheel's IDs. The wheel sends a packet to the computer, which should contain a number of bytes, two of which we're mainly interested in: one for the base model and one for the steering wheel attachment. These correspond to model and attachment in struct tm_wheel_info. This data should be found in a packet with bRequest == 73.
There are actually multiple of these packets for some reason (I'm guessing the Windows driver queries different parameters from different parts of the codebase, and it doesn't cache these parameters anywhere so it just requests them multiple times).

Anycase, looking at the data in packet 68, we see that the response data is 49 00 03 04 01 00 09 06 f9 01 00 00 09 01 00 00. This more or less looks like the other captures (some examples can be seen in the README in hid-tminit). Bytes 6 and 7 should be the attachment and model, respectively, so in this case model = 0x06 and attachment = 0x09. Adding an element to tm_wheel_infos[] should get hid-tminit to initialize wheel properly, something like

[...]
{0x06, 0x09, 0x0009, "Thrustmaster TS-PC"},
[...]

With my T300, for some reason I also had to send out a number of other packets, see
https://github.com/scarburato/hid-tminit/blob/9375f6c7d83af5dd6c8b8fe30351d0f36043b20a/hid-tminit.c#L26,

but other wheels don't seem to require this so I would expect that the TS-PC doesn't either.

Not sure where I'd start trying to work out any sort of values for force feedback values. I think I need to find a tutorial for FEdit1...

If you find one, let me know, not aware of any. Probably the biggest individual hurdle is the fact that you have to set the direction of the effect, the default of 'straight up' effectively translates to multiplying the force's magnitude by 0, i.e. makes the effect impossible to detect. Try dragging the direction pointer all the way to the right for example, and then go from there. Maybe go for studying just one effect at a time, i.e. press the effect button and drag it to the timeline. Note that the location on the timeline effectively adds a delay, i.e. to immediately feel an effect drag it as far left as possible.

Other than that, I guess it's worth keeping in mind that wheels typically have a couple different kinds of packets, ones that upload effects to the device and ones that modify already uploaded effects. Took me a while to figure that one out, but essentially when close the effect modification window, you should see the effect get uploaded with all possible configuration values initialized. After that, if you open up the modification window again and tweak one parameter, you should see a number of packets that each modify only the parameter you've just tweaked. If the packets you capture look like ones in https://github.com/Kimplul/hid-tmff2/blob/master/docs/FFBEFFECTS.md,

then it should be fairly straightforward to just add the wheel's USB product ID to the list of supported devices for this driver. Otherwise, you'll have to try and reverse engineer the packets yourself.

I encourage playing around with FEdit, it's ultimately not a particularly complicated program, as it more or less one-to-one maps parameters in the GUI to parameters that get sent to the wheel. The interface is just a bit daunting.

Feel free to ask questions, I'll try to help as best as I can.

@svenliekens
Copy link

svenliekens commented Jan 20, 2024

Hi

I have recently switched to Fedora from Windows and have been trying to get my TS-PC RACER to work on Linux.

I started playing with FEdit and wireshark on a spare laptop with the wheel connected.
Have managed to capture the Spring effect. It looks like it uses the same parameters as listed in the FFBEFFECTS doc.
See the attached capture file (packet no. 5) spring_effect_capture2.zip

At this point I made the quick assumption that the rest of the FFB effects would be the same.
I decided to try to build the kernel module.

  • cloned this repo
  • added {0x06, 0x09, 0x0009, "Thrustmaster TS-PC"}, to hid-tmff2/deps/hid-tminit/hid-tminit.c
  • from hid-tmff2, ran make and sudo make install

This resulted in the following output

~/hid-tmff2$ sudo make
[sudo] password for sven: 
make -C deps/hid-tminit KDIR="/lib/modules/6.6.11-200.fc39.x86_64/build" 
make[1]: Entering directory '/home/sven/hid-tmff2/deps/hid-tminit'
make -C /lib/modules/6.6.11-200.fc39.x86_64/build M=/home/sven/hid-tmff2/deps/hid-tminit modules
make[2]: Entering directory '/usr/src/kernels/6.6.11-200.fc39.x86_64'
make[2]: Leaving directory '/usr/src/kernels/6.6.11-200.fc39.x86_64'
make[1]: Leaving directory '/home/sven/hid-tmff2/deps/hid-tminit'
make -C /lib/modules/6.6.11-200.fc39.x86_64/build M=/home/sven/hid-tmff2 modules
make[1]: Entering directory '/usr/src/kernels/6.6.11-200.fc39.x86_64'
make[1]: Leaving directory '/usr/src/kernels/6.6.11-200.fc39.x86_64'
~/hid-tmff2$ sudo make install
make -C deps/hid-tminit KDIR="/lib/modules/6.6.11-200.fc39.x86_64/build" install
make[1]: Entering directory '/home/sven/hid-tmff2/deps/hid-tminit'
make -C /lib/modules/6.6.11-200.fc39.x86_64/build M=/home/sven/hid-tmff2/deps/hid-tminit modules_install
make[2]: Entering directory '/usr/src/kernels/6.6.11-200.fc39.x86_64'
  INSTALL /lib/modules/6.6.11-200.fc39.x86_64/updates/hid-tminit.ko
  SIGN    /lib/modules/6.6.11-200.fc39.x86_64/updates/hid-tminit.ko
At main.c:167:
- SSL error:FFFFFFFF80000002:system library::No such file or directory: crypto/bio/bss_file.c:67
- SSL error:10000080:BIO routines::no such file: crypto/bio/bss_file.c:75
sign-file: ./certs/signing_key.pem
  DEPMOD  /lib/modules/6.6.11-200.fc39.x86_64
make[2]: Leaving directory '/usr/src/kernels/6.6.11-200.fc39.x86_64'
make[1]: Leaving directory '/home/sven/hid-tmff2/deps/hid-tminit'
make -C /lib/modules/6.6.11-200.fc39.x86_64/build M=/home/sven/hid-tmff2 modules_install
make[1]: Entering directory '/usr/src/kernels/6.6.11-200.fc39.x86_64'
  INSTALL /lib/modules/6.6.11-200.fc39.x86_64/updates/hid-tmff-new.ko
  SIGN    /lib/modules/6.6.11-200.fc39.x86_64/updates/hid-tmff-new.ko
At main.c:167:
- SSL error:FFFFFFFF80000002:system library::No such file or directory: crypto/bio/bss_file.c:67
- SSL error:10000080:BIO routines::no such file: crypto/bio/bss_file.c:75
sign-file: ./certs/signing_key.pem
  DEPMOD  /lib/modules/6.6.11-200.fc39.x86_64
make[1]: Leaving directory '/usr/src/kernels/6.6.11-200.fc39.x86_64'
depmod -A

I think something went wrong at the SIGN step, so I'm not sure if the build succeeded or not...

~/hid-tmff2$ lsmod | grep thrust
hid_thrustmaster       16384  0

It seems like the kernel module is loaded.

When I start Assetto Corsa (via proton-ge) my wheel is not recognised.

How should I proceed? I will test some more of the FFB effects in the mean time and compare them to the FFBEFFECTS doc.

@Kimplul
Copy link
Owner

Kimplul commented Jan 20, 2024

I think something went wrong at the SIGN step, so I'm not sure if the build succeeded or not...

Signing the module is an optional step that has to be done by whoever builds the module. The error messages are pretty scary but generally don't stop the module from functioning. There's a separate kernel configuration parameter that can disable loading unsigned modules, but it tends to not be enabled on major distros. There's a short note about it in the README.

It seems like the kernel module is loaded.

The naming is a bit messy here, hid-thrustmaster is the in-kernel counterpart of hid-tminit which is a separate module just to initialize different Thrustmaster wheels. For whatever reason Thrustmaster wheels have to be reminded which model they are, and only after that is done can FFB be used, which is what this module handles. This (hid-tmff2) module would actually show up as hid-tmff-new in lsmod because of some name handling limitations in Kbuild.

Anycase, once the wheel is told which model it is, it restarts itself and reconnects under a new USB id, which you will have to add to

static const struct hid_device_id tmff2_devices[] = {

and

switch (tmff2->hdev->product) {

It's possible that the TS-PC differs in some subtle ways from other wheels supported (different wheel range, init commands, rdesc, whatever), so you might have to add a new subdir in src. Just copy one of the existing ones and tweak values found therein. Remember to point src/Kbuild to the new dir. Unfortunately I can't really help much in figuring out which bits (if any) might have to be flipped, it was a lot of trial and error when I went through it with the T300. Mostly I just tried to get the USB traffic to resemble the captures as close as possible.

Check out sudo dmesg -w when you plug the wheel in, should show the USB product ID and (typically) helpful error messages.

@svenliekens
Copy link

svenliekens commented Jan 24, 2024

The changes I have made to hid-tminit

~/hid-tmff2/deps/hid-tminit$ git diff
diff --git a/hid-tminit.c b/hid-tminit.c
index 266086e..05e35c3 100644
--- a/hid-tminit.c
+++ b/hid-tminit.c
@@ -70,11 +70,12 @@ static const struct tm_wheel_info tm_wheels_infos[] = {
        ...
        {0x02, 0x04, 0x0005, "Thrustmaster T300 Ferrari Alcantara Edition"},
        {0x02, 0x06, 0x0005, "Thrustmaster T300RS"},
        {0x02, 0x09, 0x0005, "Thrustmaster T300RS (Open Wheel Attachment)"},
-       {0x03, 0x06, 0x0006, "Thrustmaster T150RS"}
+       {0x03, 0x06, 0x0006, "Thrustmaster T150RS"},
+       {0x06, 0x09, 0x0009, "Thrustmaster TS-PC"},
        //{0x04, 0x07, 0x0001, "Thrustmaster TMX"}
 };
 
-static const uint8_t tm_wheels_infos_length = 7;
+static const uint8_t tm_wheels_infos_length = 8;

The changes I have made to hid-tmff2

~/hid-tmff2$ git diff
--- a/src/hid-tmff2.c
+++ b/src/hid-tmff2.c
@@ -616,6 +616,7 @@ static int tmff2_probe(struct hid_device *hdev, const struct hid_device_id *id)
        hid_set_drvdata(tmff2->hdev, tmff2);
 
        switch (tmff2->hdev->product) {
+               case TMTS_PC_RACER_ID: 
                case TMT300RS_PS3_NORM_ID:
                case TMT300RS_PS3_ADV_ID:
                case TMT300RS_PS4_NORM_ID:
@@ -727,7 +728,8 @@ static const struct hid_device_id tmff2_devices[] = {
        {HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, TMT248_PC_ID)},
        /* tx */
        {HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, TX_ACTIVE)},
-
+       /* TS-PC RACER */
+       {HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, TMTS_PC_RACER_ID)},
        {}
 };
 MODULE_DEVICE_TABLE(hid, tmff2_devices);
diff --git a/src/hid-tmff2.h b/src/hid-tmff2.h
index 1eb3546..822a598 100644
--- a/src/hid-tmff2.h
+++ b/src/hid-tmff2.h
@@ -111,6 +111,8 @@ int tx_populate_api(struct tmff2_device_entry *tmff2);
 
 #define TX_ACTIVE               0xb669
 
+#define TMTS_PC_RACER_ID 0xb689
+

After sudo make && sudo make install I plug in the wheel and get the following output in dmesg. I tried some things but I'm not sure how to fix this 😬

[21716.528256] usb 3-3.1: new full-speed USB device number 6 using xhci_hcd
[21716.642259] usb 3-3.1: New USB device found, idVendor=044f, idProduct=b65d, bcdDevice= 7.00
[21716.642264] usb 3-3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[21716.642267] usb 3-3.1: Product: Thrustmaster FFB Wheel
[21716.642269] usb 3-3.1: Manufacturer: Thrustmaster
[21716.725411] input: Thrustmaster Thrustmaster FFB Wheel as /devices/pci0000:00/0000:00:08.1/0000:09:00.3/usb3/3-3/3-3.1/3-3.1:1.0/0003:044F:B65D.000B/input/input20
[21716.725549] hid-thrustmaster 0003:044F:B65D.000B: input,hidraw9: USB HID v1.00 Gamepad [Thrustmaster Thrustmaster FFB Wheel] on usb-0000:09:00.3-3.1/input0
[21716.745230] hid-thrustmaster 0003:044F:B65D.000B: Unknown wheel's model id 0x609, unable to proceed further with wheel init
[21716.759400] Error: Driver 'hid-thrustmaster' is already registered, aborting...

Seems like the wheel connects as id 0xb65d, but it doesn't get to the part where it restarts and uses new ID 0xb689.

I'm not even sure where wheel's model id 0x609 is coming from.

I have confirmed in my USB captures that on the Windows driver it uses the above IDs (0xb65d -> 0xb689, as you already figured out in a previous comment)

@Kimplul
Copy link
Owner

Kimplul commented Jan 24, 2024

After sudo make && sudo make install I plug in the wheel and get the following output in dmesg. I tried some things but I'm not sure how to fix this 😬

Oh right, you'll have to blacklist the in-kernel module:

echo 'blacklist hid_thrustmaster' > /etc/modprobe.d/hid_thrustmaster.conf

There's some weird name clash that happens otherwise, meaning the changes you've made haven't actually been run yet.

I'm not even sure where wheel's model id 0x609 is coming from.

Here: https://elixir.bootlin.com/linux/latest/source/drivers/hid/hid-thrustmaster.c#L240 Essentially, the wheel sends a response to a init driver query, and the 'actual' wheel ID is in that response. You'd think the USB id was the main ID but nah, that would be too easy. Anyway, you've already added it to the driver as 0x6, 0x9, it just gets printed differently in the in-kernel module.

@svenliekens
Copy link

[  100.396525] usb 3-3.1: new full-speed USB device number 5 using xhci_hcd
[  100.510157] usb 3-3.1: New USB device found, idVendor=044f, idProduct=b65d, bcdDevice= 7.00
[  100.510165] usb 3-3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  100.510169] usb 3-3.1: Product: Thrustmaster FFB Wheel
[  100.510171] usb 3-3.1: Manufacturer: Thrustmaster
[  100.595651] input: Thrustmaster Thrustmaster FFB Wheel as /devices/pci0000:00/0000:00:08.1/0000:09:00.3/usb3/3-3/3-3.1/3-3.1:1.0/0003:044F:B65D.000A/input/input18
[  100.595787] hid-thrustmaster 0003:044F:B65D.000A: input,hidraw9: USB HID v1.00 Gamepad [Thrustmaster Thrustmaster FFB Wheel] on usb-0000:09:00.3-3.1/input0
[  100.616128] hid-thrustmaster 0003:044F:B65D.000A: Wheel with (model, attachment) = (0x6, 0x9) is a Thrustmaster TS-PC. attachment_found=1
[  100.618320] hid-thrustmaster 0003:044F:B65D.000A: Success?! The wheel should have been initialized!
[  100.711616] usb 3-3.1: USB disconnect, device number 5
[  101.419230] usb 3-3.1: new full-speed USB device number 6 using xhci_hcd
[  101.536158] usb 3-3.1: New USB device found, idVendor=044f, idProduct=b689, bcdDevice= 7.00
[  101.536167] usb 3-3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  101.536170] usb 3-3.1: Product: Thrustmaster TS-PC Racer
[  101.536173] usb 3-3.1: Manufacturer: Thrustmaster
[  101.612400] input: Thrustmaster Thrustmaster TS-PC Racer as /devices/pci0000:00/0000:00:08.1/0000:09:00.3/usb3/3-3/3-3.1/3-3.1:1.0/0003:044F:B689.000B/input/input19
[  101.612579] hid-generic 0003:044F:B689.000B: input,hidraw9: USB HID v1.11 Joystick [Thrustmaster Thrustmaster TS-PC Racer] on usb-0000:09:00.3-3.1/input0
[  101.647434] input: Thrustmaster Thrustmaster TS-PC Racer as /devices/pci0000:00/0000:00:08.1/0000:09:00.3/usb3/3-3/3-3.1/3-3.1:1.0/0003:044F:B689.000B/input/input20
[  101.647577] tmff2 0003:044F:B689.000B: input,hidraw9: USB HID v1.11 Joystick [Thrustmaster Thrustmaster TS-PC Racer] on usb-0000:09:00.3-3.1/input0
[  101.649134] tmff2 0003:044F:B689.000B: firmware version 13 is too old, please update.
[  101.649137] tmff2 0003:044F:B689.000B: note: this has to be done through Windows.
[  101.649139] tmff2 0003:044F:B689.000B: failed initializing T300RS
[  101.649140] tmff2 0003:044F:B689.000B: init failed
[  101.668285] tmff2: probe of 0003:044F:B689.000B failed with error -22

We are making progress!
Looks like the restart (init) is working and we're getting into tmff2 territory.

It is now complaining about the firmware version being too old. But I have the newest TS PC firmware...

I assume this is where I make a subdir for the TS-PC racer, as you mentioned before (start with a copy of the T300RS?)

It's possible that the TS-PC differs in some subtle ways from other wheels supported (different wheel range, init commands, rdesc, whatever), so you might have to add a new subdir in src. Just copy one of the existing ones and tweak values found therein. Remember to point src/Kbuild to the new dir. Unfortunately I can't really help much in figuring out which bits (if any) might have to be flipped, it was a lot of trial and error when I went through it with the T300. Mostly I just tried to get the USB traffic to resemble the captures as close as possible.

@Kimplul
Copy link
Owner

Kimplul commented Jan 25, 2024

We are making progress!
Looks like the restart (init) is working and we're getting into tmff2 territory.

Excellent!

I assume this is where I make a subdir for the TS-PC racer, as you mentioned before (start with a copy of the T300RS?)

Yep, looks appropriate. Try maybe copying tmt248 instead, T300 is the 'base' for the other wheels and they use functions defined in tmt300rs, and the less you have to copy the better. Eventually I might refactor things to be a bit more clear, but as this was originally a T300 driver everything sort of evolved to be built on top of that wheel.

The T248 also doesn't currently have a firmware version check, so less changes to be made.

@svenliekens
Copy link

svenliekens commented Jan 25, 2024

[ 2129.709212] usb 3-3.1: new full-speed USB device number 11 using xhci_hcd
[ 2129.826621] usb 3-3.1: New USB device found, idVendor=044f, idProduct=b65d, bcdDevice= 7.00
[ 2129.826629] usb 3-3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 2129.826633] usb 3-3.1: Product: Thrustmaster FFB Wheel
[ 2129.826635] usb 3-3.1: Manufacturer: Thrustmaster
[ 2129.902793] input: Thrustmaster Thrustmaster FFB Wheel as /devices/pci0000:00/0000:00:08.1/0000:09:00.3/usb3/3-3/3-3.1/3-3.1:1.0/0003:044F:B65D.0010/input/input26
[ 2129.902972] hid-thrustmaster 0003:044F:B65D.0010: input,hidraw9: USB HID v1.00 Gamepad [Thrustmaster Thrustmaster FFB Wheel] on usb-0000:09:00.3-3.1/input0
[ 2129.922592] hid-thrustmaster 0003:044F:B65D.0010: Wheel with (model, attachment) = (0x6, 0x9) is a Thrustmaster TS-PC. attachment_found=1
[ 2129.924784] hid-thrustmaster 0003:044F:B65D.0010: Success?! The wheel should have been initialized!
[ 2130.026081] usb 3-3.1: USB disconnect, device number 11
[ 2130.730854] usb 3-3.1: new full-speed USB device number 12 using xhci_hcd
[ 2130.846596] usb 3-3.1: New USB device found, idVendor=044f, idProduct=b689, bcdDevice= 7.00
[ 2130.846602] usb 3-3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 2130.846605] usb 3-3.1: Product: Thrustmaster TS-PC Racer
[ 2130.846607] usb 3-3.1: Manufacturer: Thrustmaster
[ 2130.926887] input: Thrustmaster Thrustmaster TS-PC Racer as /devices/pci0000:00/0000:00:08.1/0000:09:00.3/usb3/3-3/3-3.1/3-3.1:1.0/0003:044F:B689.0011/input/input27
[ 2130.927082] tmff2 0003:044F:B689.0011: input,hidraw9: USB HID v1.11 Joystick [Thrustmaster Thrustmaster TS-PC Racer] on usb-0000:09:00.3-3.1/input0
[ 2130.933832] tmff2 0003:044F:B689.0011: force feedback for tspc

I now have the wheel showing up on https://hardwaretester.com/gamepad
The steering axis is working perfectly. I have played BeamNG with it. Force feedback seems to be doing nothing even though I have it enabled in the game.

So we're going in the right direction here, but I'm not sure on how to proceed... 😬

@Kimplul
Copy link
Owner

Kimplul commented Jan 25, 2024

So we're going in the right direction here, but I'm not sure on how to proceed... 😬

Right, here are a couple things to try, off the top of my head

  1. Try capturing some packets from the driver, do they match the ones you captured earlier? 0x60 0x01 ...?

If they don't, the packet format changes slightly depending on some values in the rdesc, and it might be that the TS-PC rdesc differs from the one the T248 uses. For example, I captured the T248 rdesc from the wheel and had to change these two lines:

0x09, 0x60, /* Usage (96), prev 10 */

0x85, 0x60, /* Report ID (96), prev 10 */

  1. The wheel might require some extra initialization packets. The T248, for whatever reason, needs these packets to be sent out before anything else happens:

static const u8 setup_0[64] = { 0x42, 0x01 };

The T300 didn't need them, so this might be something that changes from wheel to wheel. Maybe try checking if you can see anything similar in your Windows captures.

  1. The wheel only processes FFB after it gets sent some enable packets. The driver sends these packets when something opens the wheel:

static int t300rs_send_open(struct t300rs_device_entry *t300rs)

The T248 needs an extra packet here as well that the T300 didn't need, so the TS-PC might also differ in this regard. Check if you can see any extra packets being sent in Windows when you open a program that connects to the wheel.

Good luck, you've just stumbled on the tedious part of reverse engineering :)

@Potajito
Copy link

I gave up basically at the same point that @svenliekens did, but, shouldn't this #94 bring also compat to ts-pc, as ts-xw is basically the same wheel base? 🤔

@Kimplul
Copy link
Owner

Kimplul commented Apr 27, 2024

@Potajito certainly possible, but you'd have to try it out for yourself. I don't really know what the differences between the TS-PC and TS-XW are, the bases definitely look similar but that hasn't always been a reliable indicator of compatibility. They don't seem to share the same USB PID at least, but you could start out by doing something like

case TSPC_ACTIVE:
case TSXW_ACTIVE:
                     if ((ret = tsxw_populate_api(tmff2)))
...

adam820 added a commit to adam820/hid-tminit that referenced this issue Jun 15, 2024
adam820 added a commit to adam820/hid-tmff2 that referenced this issue Jun 15, 2024
Based on the work of svenliekens in this comment:
Kimplul#65 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants