scarburato / t150_driver

Linux driver for Thrustmaster T150 Steering Wheel USB
GNU General Public License v2.0
103 stars 16 forks source link

T150 USB product string missing #23

Closed thomasa88 closed 3 years ago

thomasa88 commented 3 years ago

I'm trying to get my T150 to work with Project Cars 2 and Automobilista, using Steam Proton. ( https://github.com/ValveSoftware/Proton/issues/4819 )

I don't think this is related to my problem, but when I checked lsusb, the product name is picked up from my Prusa printer.

lsusb -d 044f:b677

Bus 001 Device 098: ID 044f:b677 ThrustMaster, Inc. Original Prusa i3 MK3

Looking closer in, I can see that idProduct shows no text.

lsusb -v -d 044f:b677

  idVendor           0x044f ThrustMaster, Inc.
  idProduct          0xb677 
  bcdDevice            1.00

Xbox Controller for comparison

lsusb -d 045e:02d1
Bus 001 Device 099: ID 045e:02d1 Microsoft Corp. Xbox One Controller

lsusb -d 045e:02d1 -v
  idVendor           0x045e Microsoft Corp.
  idProduct          0x02d1 Xbox One Controller
  bcdDevice            1.01

First I though that the firmware might be behaving badly, but I think the strings from the firmware appear in the following values (the actual strings are only fetched when running with "sudo")

  iManufacturer           1 Thrustmaster
  iProduct                2 Thrustmaster T150RS
  iSerial                 0 

lsusb-xbox-sudo.txt lsusb-xbox.txt lsusb-prusa-sudo.txt lsusb-prusa.txt lsusb-v-t150.txt lsusb-v-t150-sudo.txt

thomasa88 commented 3 years ago

It turns out that the value is missing from the Linux USB ID database.

Website: http://www.linux-usb.org/usb-ids.html

File on Ubuntu: /var/lib/usbutils/usb.ids

I will try editing usb.ids and, if it works, I will submit the ID for review to linux-usb.org

https://gist.github.com/m4ver1Kc/90462139e5ab0ab5e11e42d6779b5289 indicates that the product should be "Thrustmaster T150RS"

I will see if I can read a value from a Windows computer as well, just to be sure.

edit. Info on fetching latest database from the web: https://opensource.com/article/20/8/usb-id-repository

thomasa88 commented 3 years ago

Turns out that the linux-usb.org webpage is mostly broken, but it seems that the usb.ids list still gets updated. I will try to send a patch to the robot, but I'm not sure if one must be registered first, somehow.

USB ids are nowadays read from "hwdb" in systemd, but they seem to fetch the USB IDs from the usb.ids file.

I added a local hwdb entry in this way (Ubuntu 20.04): /etc/udev/hwdb.d/90-thrustmaster-t150.hwdb

usb:v044FpB677*
 ID_MODEL_FROM_DATABASE=T150 Racing Wheel
sudo systemd-hwdb update

lsusb -d 044f:b677
Bus 001 Device 101: ID 044f:b677 ThrustMaster, Inc. T150 Racing Wheel

lsusb -d 044f:b677 -v
  idVendor           0x044f ThrustMaster, Inc.
  idProduct          0xb677 T150 Racing Wheel

Based on this guide: https://wiki.archlinux.org/title/Map_scancodes_to_keycodes

Upstream systemd hwdb: https://github.com/thomasa88/systemd/tree/main/hwdb.d

Edit: It did not make the wheel function in my Steam/proton games.

Edit: I have made a PR on SDL_GameControllerDB for a config that makes the wheel be visible as XInput in wine. (Mapping a controller in Steam also does this). Does not fix the mentioned games though. https://github.com/gabomdq/SDL_GameControllerDB/pull/465

SDL_GAMECONTROLLERCONFIG="030000004f04000077b6000000010000,Thrustmaster T150RS,a:b1,b:b2,x:b4,y:b3,back:b9,guide:b0,start:b10,leftstick:b5,rightstick:b6,leftshoulder:b11,rightshoulder:b12,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a1,-rightx:b7,+rightx:b8,lefttrigger:a3,righttrigger:a2,platform:Linux,"