Skip to content

Commit

Permalink
fix(Legion Go): Add full support for all DInput modes.
Browse files Browse the repository at this point in the history
  • Loading branch information
pastaq authored and ShadowApex committed Nov 22, 2024
1 parent 375605c commit f20fe9d
Show file tree
Hide file tree
Showing 13 changed files with 3,715 additions and 528 deletions.
155 changes: 74 additions & 81 deletions rootfs/usr/share/inputplumber/devices/50-legion_go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,127 +23,111 @@ matches:
# One or more source devices to combine into a single virtual device. The events
# from these devices will be watched and translated according to the key map.
source_devices:
## XInput - Connected 0x6182
# Touchpad
- group: mouse # Gamepad Mode
hidraw:
vendor_id: 0x17ef
product_id: 0x6182
interface_num: 1
- group: mouse # DInput Mode
# Gamepad
- group: gamepad
hidraw:
vendor_id: 0x17ef
product_id: 0x6184
interface_num: 1
- group: mouse # Gampead Mode
blocked: true
product_id: 0x6182
interface_num: 2
- group: gamepad
unique: true
evdev:
name: "{Lenovo Legion Controller for Windows,Generic X-Box pad}"
vendor_id: "17ef"
product_id: "6182"
name: " Legion Controller for Windows Touchpad"
handler: event*
- group: mouse # DInput mode
# Block all evdev devices; mouse, touchpad, keyboard
- group: gamepad
blocked: true
unique: false
evdev:
name: " Legion Controller for Windows *"
vendor_id: "17ef"
product_id: "6184"
name: "Legion-Controller 1-D6 Touchpad"
product_id: "6182"
handler: event*

# Mouse
- group: mouse # DInput Mode
## DInput - Attached 0x6183
# Touchpad
- group: mouse
hidraw:
vendor_id: 0x17ef
product_id: 0x6185
product_id: 0x6183
interface_num: 1
- group: mouse # Gamepad Mode
blocked: true
evdev:
vendor_id: "17ef"
product_id: "6182"
name: " Legion Controller for Windows Mouse"
handler: event*
- group: mouse # FPS/Dinput Mode
blocked: true
evdev:
vendor_id: "17ef"
product_id: "618[4-5]"
name: "Legion-Controller 1-D6 Mouse"
handler: event*
- group: mouse # FPS/Dinput Mode
blocked: true
unique: false
evdev:
vendor_id: "17ef"
product_id: "618[4-5]"
name: "Legion-Controller 1-D6"
handler: event*

# Keyboard
- group: mouse # DInput Mode
# Gamepad
- group: gamepad # Dinput report
hidraw:
vendor_id: 0x17ef
product_id: 0x6185
product_id: 0x6183
interface_num: 0
- group: keyboard # Gamepad Mode
blocked: true
evdev:
vendor_id: "17ef"
product_id: "6182"
name: " Legion Controller for Windows Keyboard"
handler: event*
- group: keyboard # FPS/DInput Mode
blocked: true
evdev:
vendor_id: "17ef"
product_id: "618[4-5]"
name: "Legion-Controller 1-D6 Keyboard"
handler: event*

# Gamepad
- group: gamepad # Gamepad Mode
- group: gamepad # XInput report 40Hz
hidraw:
vendor_id: 0x17ef
product_id: 0x6182
product_id: 0x6183
interface_num: 2
- group: gamepad # Dinput Mode

## DInput - Detached 0x6184
# Touchpad
- group: mouse
hidraw:
vendor_id: 0x17ef
product_id: 0x6184
interface_num: 1
# Gamepad
- group: gamepad
hidraw:
vendor_id: 0x17ef
product_id: 0x6184
interface_num: 0
- group: gamepad # Dinput Mode
- group: gamepad
hidraw:
vendor_id: 0x17ef
product_id: 0x6184
interface_num: 2
- group: gamepad # FPS Mode

## FPS Mode - 0x6185
# Touchpad
- group: mouse
hidraw:
vendor_id: 0x17ef
product_id: 0x6185
interface_num: 1
# Mouse
- group: mouse
hidraw:
vendor_id: 0x17ef
product_id: 0x6185
interface_num: 1
# Keyboard
- group: keyboard
hidraw:
vendor_id: 0x17ef
product_id: 0x6185
interface_num: 0
# Gamepad
- group: gamepad
hidraw:
vendor_id: 0x17ef
product_id: 0x6185
interface_num: 2
- group: gamepad # Newer Kernels
evdev:
vendor_id: "17ef"
product_id: "6182"
name: "Lenovo Legion Controller for Windows"
handler: event*
- group: gamepad # Older Kernels
evdev:
vendor_id: "17ef"
product_id: "6182"
name: "Generic X-Box pad"
handler: event*

# IMU
# Broken for now --causes IP to hard freeze
# Enabling only gyro_3d allows the tablet gyro to work without needing kernel patch
# TODO: Find out why this is broken and swap tablet gyro to controller gyro as default.
# - group: imu
# iio:
# name: accel_3d
# mount_matrix:
# x: [0, 1, 0]
# y: [0, 0, -1]
# z: [-1, 0, 0]
# Broken for now --causes IP to hard freeze
# Enabling only gyro_3d allows the tablet gyro to work without needing kernel patch
# TODO: Find out why this is broken and swap tablet gyro to controller gyro as default.
# - group: imu
# iio:
# name: accel_3d
# mount_matrix:
# x: [0, 1, 0]
# y: [0, 0, -1]
# z: [-1, 0, 0]
- group: imu
iio:
name: gyro_3d
Expand All @@ -152,6 +136,15 @@ source_devices:
y: [0, 0, -1]
z: [-1, 0, 0]

# Block all evdev devices; mouse, touchpad, gamepad, keyboard
- group: gamepad
blocked: true
unique: false
evdev:
vendor_id: "17ef"
product_id: "618[3-5]"
handler: event*

# Optional configuration for the composite device
options:
# If true, InputPlumber will automatically try to manage the input device. If
Expand Down
Loading

0 comments on commit f20fe9d

Please sign in to comment.