Complete solution, native HID driver patch, configuration profiles, and auto-repair scripts to enable fully functional, smooth 200 Hz gyroscope and motion aiming on the Lenovo Legion Go using InputPlumber, with persistent DualSense (DS5) and Steam Deck (deck-uhid) support.
Includes a native reverse-engineered HID driver to read the detachable Right Controller IMU directly via hidraw, bypassing tablet-only limitations.
Works seamlessly in both Desktop Mode and Gamescope (Steam Game Mode) on Arch Linux, CachyOS, Bazzite, ChimeraOS, and other Linux distributions.
-
Native Right-Controller IMU Driver:
- Cause: Upstream InputPlumber only supported the internal tablet IMU via Linux IIO/AMD SFH. The detachable right Joy-Con sensor remained dark due to Lenovo's proprietary HID protocol.
-
Fix: Implemented native HID handling in
go1_driver.rsandgo2_driver.rs. It communicates viahidrawon Interface 2, sending raw 7-byte initialization handshakes (0x6A 0x02/0x07) to unlock high-rate 16-bit motion streaming from the controller MCU.
-
Dead/Disabled Gyro in Steam Input (Missing Gravitational Vector):
-
Cause: Stock InputPlumber configuration omitted
accel_3d. Steam Deck emulation (deck-uhid) reported(0, 0, 0)for gravity. Steam requires a 1G gravitational vector to calculate drift compensation and orientation; without it, Steam completely ignores the IMU. -
Fix: Added
accel_3dwith proper orientation mapping and cyclical 120 ms keep-alive gravity broadcasts.
-
Cause: Stock InputPlumber configuration omitted
-
Hotplug & Detach Resilience (MCU Reset Recovery):
-
Cause: Docking or undocking the controller triggers an MCU power reset (
0x61eb<->0x61ed), dropping motion streaming and breakinghidrawpolling loops. - Fix: Reconnect handling detects controller state changes, re-executes the unpadded 7-byte wake-up handshake, and cleanly rebinds the polling thread without crashing the daemon.
-
Cause: Docking or undocking the controller triggers an MCU power reset (
-
Firmware Glitch Filter & Linear Calibration:
-
Cause: Lenovo's firmware intermittently transmits spurious
0x00FE/0x00FFgyro packets, causing micro-stutters and sudden view snaps. Furthermore, excessive artificial multipliers caused immediate 16-bit clipping in Steam. - Fix: Implemented an exact byte glitch filter (dropping invalid packets) and normalized scaling to a clean 1:1 ratio matching the physical controller angular velocity, allowing native Steam Input sliders to function properly.
-
Cause: Lenovo's firmware intermittently transmits spurious
-
DualSense MAC Persistence (Lost Gyro Profiles on Reboot):
-
Cause: Upstream
src/input/target/dualsense.rsgenerated a random Bluetooth MAC address on every virtual device creation. Steam treated every reconnection as a brand new controller, resetting Gyro to "Disabled" and wiping layouts. -
Fix: Hardcoded persistent MAC addresses (
e8:47:3a:d6:e7:74for Normal,e8:47:3a:d6:e7:eefor Edge). Steam permanently remembers calibrations and per-game mappings.
-
Cause: Upstream
-
Dynamic Gyro Source Switching (Tablet vs. Detached Right Controller):
-
Feature: Allows seamlessly switching between the internal Tablet IMU (
Source::Center) and the Right Joy-Con Controller IMU (Source::Right, for detached/docked play) on-the-fly without restarting games or InputPlumber. -
Fix: Added live polling of
/etc/inputplumber/gyro_source.
-
Feature: Allows seamlessly switching between the internal Tablet IMU (
-
Touchpad / Mouse Lag Prevention:
-
Cause: Enabling MCU IMU bypass (
0x03) turns off internal hardware filtering on the optical trackpad in the controller firmware, causing cursor jumping and stutter. -
Fix: Driver logic enforces
bypass=0x00, keeping the optical sensor smooth while IMU streaming remains fully active.
-
Cause: Enabling MCU IMU bypass (
-
Anti-Jitter Filtering & Continuous Soft Deadzone:
- Cause: Standard hard-threshold deadzones create an abrupt 0 ↔ 24 LSB jump cliff, causing nervous micro-stutter during fine sniper aiming. Raw 350 Hz MEMS noise also causes trembling.
-
Fix: Replaced hard threshold with a continuous soft-deadzone (
18.0 LSB), ensuring motion starts smoothly at 1 LSB without threshold popping. Integrated an adaptive EMA low-pass filter ($\alpha = 0.35$ for micro-aiming,$\alpha = 0.95$ for rapid flicks) with 0 ms perceptible latency.
-
In-Flight Zero-Rate Auto-Bias Calibration (Drift Elimination):
- Cause: Environmental temperature changes and Joy-Con mounting tolerances induce DC offsets, causing subtle uncommanded camera drift.
-
Fix: Driver monitors delta variance across all 3 gyro axes. When the controller rests stationary for
$\ge 0.6$ seconds, it continuously learns and converges hardware zero-offsets, subtracting them in real-time. This guarantees 100% directional symmetry and eliminates drift completely.
| File | Description |
|---|---|
fix-inputplumber.sh |
Comprehensive build & maintenance tool (installer, source rebuild, pacman hook, uninstaller, health check) |
uninstall-gyro-fix.sh |
Complete uninstaller: restores stock binary, cleans udev/yaml overrides, resets MCU to defaults |
set-controller-gyro-speed.sh |
Live real-time speed multiplier tuner for Right Joy-Con gyro (/etc/inputplumber/controller_gyro_speed) |
set-gyro-source.sh |
Helper script to switch active gyro source between tablet and controller on-the-fly |
set-ds5-gyro-speed.sh |
Dynamic real-time speed multiplier adjuster for DualSense gyro emulation |
inputplumber-legiongo.patch |
Clean, standalone Git patch against upstream InputPlumber (ShadowBlip/InputPlumber) |
50-legion_go.yaml |
Corrected InputPlumber device configuration profile (deck-uhid default) |
99-inputplumber-device-setup.rules |
Udev rules to ensure permissions for hidraw controller nodes and eliminate mouse lag |
test-gyro.py |
Real-time terminal diagnostic tool verifying Pitch, Yaw, Roll, and 1G Accel |
test-dualsense-gyro.py |
Real-time terminal diagnostic tool for DualSense IMU data |
set-gyro-sensitivity.sh |
Adjust tablet gyro sensitivity multiplier directly in device configuration |
fix-mouse-lag.sh |
Reset touchpad optical sensor and controller MCU bypass settings |
INPUTPLUMBER_GYRO_FIX.md |
In-depth technical architecture and protocol documentation |
INPUTPLUMBER_PR612_FEEDBACK.md |
Validation report and upstream feedback templates for PR #612 |
sudo bash ~/fix-inputplumber.shThis script installs the patched InputPlumber binary with native Right Joy-Con IMU support, configures 50-legion_go.yaml, configures udev rules, sends MCU activation packets, and restarts inputplumber.service.
Switch motion sensors anytime without restarting InputPlumber or games:
# Switch to right controller sensor (detached / docked play)
~/set-gyro-source.sh controller
# Switch back to internal tablet sensor (handheld mode)
~/set-gyro-source.sh tablet
# Check active sensor status
~/set-gyro-source.sh statusAdjust sensitivity in real-time without restarting InputPlumber or running games:
# Set factor for Right Joy-Con controller (e.g. 0.17 for standard Steam 2.5 sensitivity, 0.7 default, 1.0 raw)
~/set-controller-gyro-speed.sh 0.17
# Set factor for DualSense emulation (e.g. 1.0 raw, 1.5, 2.0)
~/set-ds5-gyro-speed.sh 1.0Verify motion controls in real-time from the terminal:
# For Steam Deck (deck-uhid)
python3 test-gyro.py
# For DualSense (ds5)
python3 test-dualsense-gyro.pyTo compile directly from source using the included patch:
sudo bash fix-inputplumber.sh --rebuildTo automatically re-apply the patched binary whenever pacman -Syu updates inputplumber:
sudo bash fix-inputplumber.sh --hookTo cleanly revert all changes, restore the official upstream pacman binary, remove all overrides, and reset MCU firmware:
sudo bash uninstall-gyro-fix.sh
# or: sudo bash fix-inputplumber.sh --uninstallSee the Complete Uninstall Protocol section below for technical details.
The uninstaller (uninstall-gyro-fix.sh / fix-inputplumber.sh --uninstall) performs a thorough, 8-step factory reset to ensure the system is completely restored to its original upstream state:
- Stop Active Daemon:
- Stops
inputplumber.serviceto avoid file locks and race conditions while binaries and configuration files are manipulated.
- Stops
- Remove Automated Package Hooks:
- Deletes
/etc/pacman.d/hooks/99-inputplumber-fix.hookand/usr/local/bin/fix-inputplumber. This ensures future system upgrades (pacman -Syu) stay on standard upstream packages without reapplying patches.
- Deletes
- Restore Official Stock Binary:
- Reinstalls the official, unmodified InputPlumber binary directly from the local Pacman cache (
/var/cache/pacman/pkg/inputplumber-*.pkg.tar.zst) or backed-up stock binary (/usr/bin/inputplumber.stock-backup). - Cleans up all backup binaries in
/usr/bin/.
- Reinstalls the official, unmodified InputPlumber binary directly from the local Pacman cache (
- Remove Configuration Overrides:
- Removes
/etc/inputplumber/gyro_source,/etc/inputplumber/ds5_gyro_multiplier, and/etc/inputplumber/devices.d/50-legion_go.yaml*. - InputPlumber cleanly reverts to using the default, unmodified profiles in
/usr/share/inputplumber/.
- Removes
- Reset Udev Rules & System Policies:
- Removes
/etc/udev/rules.d/99-inputplumber-device-setup.rulesand reloads udev rules to restore standard Linux device permissions.
- Removes
- Reset Controller MCU & sysfs Hardware State:
- Sends explicit HID commands to stop 16-bit HQ motion streaming and power down the controller IMU.
- Restores touchpad bypass (
0x01), returning the controller MCU to its stock Lenovo firmware state. - Reverts sysfs attributes back to Linux defaults (
os_mode=linux,imu_bypass_enabled=true).
- Clean Systemd Overrides:
- Removes any service overrides in
/etc/systemd/system/inputplumber.service.d/and executessystemctl daemon-reload.
- Removes any service overrides in
- Package Integrity Verification:
- Starts the clean upstream service and runs
pacman -Qkk inputplumberto verify that every installed file matches the official Arch/CachyOS package checksums with 100% integrity.
- Starts the clean upstream service and runs
- Open Steam (Desktop Mode or Gamescope Game Mode).
- Open your game, press Steam button / Legion-L
$\rightarrow$ Controller Settings$\rightarrow$ Edit Layout$\rightarrow$ Gyro. - Set Gyro Behavior to:
- As Mouse (Recommended for FPS and precise aiming)
- As Right Joystick (For games without simultaneous mouse + gamepad support)
- Set Gyro Orientation to:
- "Player Space" (Recommended: dynamically fuses Yaw and Roll based on your handheld viewing angle for natural aiming in any posture).
- Set Gyro Enable Button:
- "Right Stick Touch" (The upper rear M2 button is hardwired to RightStickTouch in our driver – resting your finger on M2 engages gyro instantly without always-on twitching!)
- "Left Trigger Soft Pull" (Engages gyro when aiming down sights / ADS).
- "Always On".
- In Steam Settings
$\rightarrow$ Controller$\rightarrow$ Calibration$\rightarrow$ Gyroscope, verify that the horizon is level and responsive.
MIT License