Skip to content

cazzoo/ffb-switcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ffb-switcher

Auto-switch FFB (Force Feedback) profiles based on running game detection — native Linux, written in Rust.

What it does

  • Watches /proc for game processes (native + Wine/Proton .exe)
  • When a known game starts → applies the matching FFB profile via sysfs
  • When no game runs → reverts to default profile
  • Zero dependencies on external tools (no oversteer, no Python)

Designed for

  • Thrustmaster wheels (T500RS, T300RS) using hid-tmff2 kernel driver
  • Linux sim racing (AMS2, Dirt Rally 2, Forza via Proton/Wine)
  • Solo dev, single machine — runs as a lightweight daemon

Install

cargo build --release
sudo cp target/release/ffb-switcher /usr/local/bin/

Quick Start

# Generate default config
ffb-switcher init

# List profiles
ffb-switcher list

# Check current FFB device status
ffb-switcher status

# See running game processes
ffb-switcher ps

# Start watching (foreground)
ffb-switcher watch

# Apply a specific profile manually
ffb-switcher apply "AMS2 - Touring"

Config

Default location: ~/.config/ffb-switcher/config.toml

device = "/sys/bus/hid/drivers/hid-tmff2"
poll_interval_ms = 2000

[[profiles]]
name = "AMS2 - Touring"
game_processes = ["AMS2.exe", "AMS2_AVX.exe"]

[profiles.ffb]
gain = 85
autocenter = 20
spring = 40
damper = 30
friction = 15

[[profiles]]
name = "Dirt Rally 2"
game_processes = ["DirtRally2.exe"]

[profiles.ffb]
gain = 90
autocenter = 30
spring = 50
damper = 40
friction = 25

[[profiles]]
name = "Default"
game_processes = []

[profiles.ffb]
gain = 75
autocenter = 50
spring = 35
damper = 25
friction = 15

How it works

  1. Process detection: reads /proc/*/comm and /proc/*/exe symlinks every 2s
  2. Wine/Proton support: follows .exe symlinks which Wine exposes
  3. Profile matching: maps process names to profiles from config
  4. FFB control: writes directly to sysfs parameters under the hid-tmff2 driver path
  5. Auto-revert: falls back to default profile when no game is running

Run as systemd service (optional)

# /etc/systemd/user/ffb-switcher.service
[Unit]
Description=FFB Profile Auto-Switcher
After=multi-user.target

[Service]
ExecStart=/usr/local/bin/ffb-switcher watch
Restart=on-failure

[Install]
WantedBy=default.target
systemctl --user enable --now ffb-switcher

Requirements

  • Linux kernel with hid-tmff2 module loaded
  • Read/write access to /sys/bus/hid/drivers/hid-tmff2/*/ (may need sudo or udev rules)
  • Rust 1.70+ (build only)

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages