Skip to content

[Discussion] Kernel Upstreaming #159

Description

@pastaq

Greetings! This is a bit long winded but bear with me.

Background

I'm here to start a discussion regarding starting the process of upstreaming the work that has been done here and in the t150 driver. As many of us ThrustMaster owners are aware, there are quite a few out of tree drivers floating around that provide basic functionality for these wheels. It would be nice to have a unified kernel driver so that DKMS and/or userspace daemons are no longer required. This is likely to be a long process that will take a large community effort.

Current Scope

Here are all the projects I'm aware of that deal with modern ThrustMaster wheels.

  • Xpad in-tree kernel driver: Basic support for a few xb360 & xone wheels. These will probably remain untouched, I'm not sure if they are even FFB capable (some of them are gamepads).
  • hid-thustmaster in-tree kernel driver: Initialization support for T150RS, T300, T300RS (+ accessories), T500RS.
  • hid-tmff2: Provides HID subsystem FFB feature support for T300RS, T248, TX, T128, T-GT II and TS-XW
  • TMX-driver: Initialization support for TMX wheels only.
  • tmdrv: Initialization support for T500RS, TX, TMX, TS-XW (doesn't appear to be maintained anymore).
  • t150_driver: Provides HID subsystem FFB feature support for T150 and TMX.
  • hid-tminit: Precursor to hid-thrustmaster, no longer maintained but provides support for kernels pre-5.13 for the same wheels.

There may be others, but these are the main ones.

There have been issues related to combining some of these dkms modules/features over the years, or improving support in the kernel, that haven't really come to fruition yet:
#48
#78
scarburato/t150_driver#2

Why Upstream?

Owning a ThrustMaster FFB wheel at this point in time means tinkering with your system, at least a little, to get support. There is no "out of the box" solution that works now, and the current ones are not guaranteed to continue working through kernel updates. API/ABI's change and out of tree drivers need to be maintained separately as kernel maintainers have no obligation to out of tree functionality. Luckily the input subsystem is fairly stable so this doesn't appear to have been a huge issue, but it will always be a moving target. It is also difficult for users to find the right combination of initialization and functionality drivers, depending on the wheel, due to the fracturing of the ecosystem.

Proposed Solutions

Problem Statement

All modern ThrustMaster wheels start in some kind of basic state. hid-thrustmaster handles the "GIP" hid_device state of these wheels which detects the model, then submits a change request to cycle it into a second hid mode where this or the t150 drivers take over. The TM and TMX devices start as a USB HID device and have a two stage initialization where the first mode change is expected to hand off to hid-thrustmaster when it switches to the hid subsystem. Through happy circumstance I found that the first state doesn't appear to be strictly necessary. Through testing I found that the TMX wheel in GIP mode doesn't support the command to get the model number, it will error out with a bad URB. As a fluke I tried sending the stage 2 change bit that GIP mode would take to the USB HID init mode and it actualy switched to the final state without problems. I'm still waiting for a tester for the TX wheel, but if this works for both then the "xbox" style wheel is solved for init and the TMX-Driver/tmdrv projects can be dropped from the above list as necessary.

What Next

The driver I'm currently writing for upstreaming to init the TMX/TX wheels is a USB HID driver. Once/while that is merged I plan to start work upstreaming the TMX/T150 family functionality currently provided by t150. The final state for both the t150 driver and the tmff2 driver bind to the hid subsystem, just like hid-thrustmaster. My plan then is to refactor hid-thrustmaster into its own mini-subsytem. The basic structure would look like this:

- /drivers/hid/hid-thrustmaster.c: Current driver
+ /drivers/hid/thrustmaster-ffw-hid/..
+  ./thrustmaster-ffw-hid-core.c/h: Contains driver entry-point for all wheels and type enumeration, common structs and callback function definitions
+  ./thrustmaster-ffw-hid-init.c/h: Contains the current functionality of hid-thrustmaster for devices that start in the hid subsystem
+  ./thrustmaster-ffw-hid-t248.c/h: Contains the current functionality of hid-tmff2 for t248 and similar wheels
+  ./thrustmaster-ffw-hid-t300.c/h: Contains the current functionality of hid-tmff2 for t300rs and similar wheels
+  ./thrustmaster-ffw-hid-tmx.c: Contains the current functionality of t150_driver for TMX and T150 family
+  ./thrustmaster-ffw-hid-tsxw.c/h: Contains the current functionality of hid-tmff2 for tsxw and similar wheels
+  ./thrustmaster-ffw-hid-tx.c/h: Contains the current functionality of hid-tmff2 for TX wheels

This won't all happen at once. I plan to submit a patch series to refactor the current hid-thrustmaster first, then add one driver family at a time until everything is covered, starting with my own wheel. At least one driver implementation is probably a prerequisite for fully implementing, but once we have a solid/coordinated plan I'll submit the refactor alone as an RFC and see if they will take it without.

What I need help with

First and foremost, I want to make sure the original authors for each driver/subdriver are credited for their efforts. There isn't a lot of copywrite notice in the source code so I'll need information on that. I'm not here to take credit for the hard work that has been done previous to me. I'm merely offering to coordinate the effort so we can all benefit from it.

Secondly, I only own one wheel, the TMX. I'll need folks to test their wheel against the driver, provide insight for the functionality they wrote, provide kernel review/tested by tags, etc.

Thirdly, feedback and experience.

Who am I and why should you trust me to follow through

I've been in the ThrustMaster Linux family for a while at this point and have slowly worked towards this goal. I'm also fairly comfortable with the LKML at this point and work on input systems quite frequently these days. I'm certainly not going to promise inclusion in a specific kver, but I think I have a decent plan and the experience necessary to lead a sustained effort towards getting proper kernel level support for our racing wheels.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions