Repository navigation
Conversation
02b9181 to
208de6a
Compare
5708e71 to
041db89
Compare
|
I hit the DS5 accelerometer saturation this PR fixes: the hidraw source forwards raw counts, Reading the new constants, the forward direction looks right but the inverses look wrong. Each pair should round-trip to 1 and neither does: Raw to SI to raw loses the resolution factor each time.
The driver applies the forward constants as raw to SI (
I have DualSense Edge hardware on Bluetooth and USB. I can test the branch and send the constant fix as a PR against it. |
|
Awesome, thanks. This PR is kinda stuck at the moment but I plan to break it up into a few separate PR's. I haven't gone through to validate all the value changes, I think I made quite a few mistakes. I'll be sure to review your input here when I'm working on the SI standardization piece. |
|
Tested motion through SDL on a ROG Ally X (BMI323) and wrote up the details in #715. Some notes that may help
|
3f64ddb to
a425117
Compare
|
@SimpleMatt7 @ilyasturki please retest, issues should be resolved now |
|
@pastaq Thanks! Retested on ROG Ally X (Bazzite 44), commit Fixed
New issue: gyro reads 8–35 °/s at rest on the DualSense target Device lying still on a table: At the same time, If I read the code right, it could be a scale mismatch: the target writes the gyro at 1024 LSB per °/s ( Side effect of the IIO buffer With this build, sysfs |
a425117 to
84c018e
Compare
|
│ Hey, while testing PR #612 I noticed a small typo in the udev rules that prevents the controller IMU bypass from being set: |
|
Hey @pastaq, I tested PR #612 using
Why the controller gyros aren't streaming yet:
Note: The firmware ignores these Additionally, the firmware stops the 16-bit stream if it doesn't receive a periodic keep-alive/heartbeat. In my custom build, sending these exact 7-byte commands along with a 3-second heartbeat loop kept the Joy-Con IMUs streaming reliably at ~350 Hz. |
|
Thanks. I'll compare those commands to the hid-lenovo-go driver. The documentation doesn't mention anything about HQ 16 but stream enabling, that appears to be an interpretation by the HHD dev and not necessarily accurate. There is a bug currently in the hid-lenovo-go driver that incorrectly routes the IMU enable for the right controller to the bypass feature. TBS, the controller remembers its state so it should only need enablement once to work correctly. |
|
Regarding the controller remembering its state: I've already tested that extensively. |
|
Reminder: user tested Apex and found the matrix from F1 series matched. Update config. |
Blocks IIO Sensors Proxy from claiming devices InputPlumber manages, so it doesn't fight the refactored IMU drivers for the same sysfs nodes.
Currently we don't track tasks started by manager. When InputPlumber stops the Drop::drop() callback never runs. As this will be necessary later when adding hrtimer, fix it now.
Adds de/normalize_accel_value_i16()/de/normalize_gyro_value_i16() to convert canonical m/s^2 and rad/s InputValues to/from raw per-device counts, for targets and sources with their own native accelerometer/gyroscope report format. Adopted by individual targets in following commits.
Currently the gyro/accel box only properly renders readable content if the total number of reported axis capabilities is fewer than three. Rewrite the row/column allocation in the device test grid and rework panel layout so axes/triggers/touch share one row. Gyro/accel now takes the full width in its own row and touchpad is only part of the second row. Also fix a label bug where the Keyboard gamepad button rendered with an empty title because the prefix-stripping chain matched "Keyboard" twice.
84c018e to
b17202f
Compare
b17202f to
6c03244
Compare
Source drivers often filter out individual Left/Right accelerometer and gyroscope capabilities by default, showing only the combined Center reading. This hides the raw per-side values needed to diagnose axis and calibration issues during hardware validation. Save and clear the device's event filters when the test menu starts, and restore them when it exits. The restore result is sent back over the channel and a warning is logged if the DBus proxy cannot be built, so a failed restore is visible instead of silently burning the receive timeout.
Migrates the DualSense/Edge source and target off the legacy Gamepad::Accelerometer/Gyro capabilities onto the SI-based Capability::Accelerometer/Gyroscope(Source), converting to/from m/s^2 and rad/s at the source and target boundaries. Corrects the gyro raw<->rad/s scale constants and calibration report values to the real ~16.384 counts/deg/s hardware scale instead of the kernel's internal 1024-count normalization basis.
Migrates the Flydigi Vader 4 Pro source off the legacy Gamepad::Accelerometer/Gyro capabilities onto the SI-based Capability::Accelerometer/Gyroscope(Source). The gyro axis sign flips move from the source into the driver, consistent with the other IMU drivers. The source now only normalizes raw values to SI.
…/scale Migrates the Horipad Steam source and target off the legacy Gamepad::Accelerometer/Gyro capabilities onto the SI-based Capability::Accelerometer/Gyroscope(Source). Corrects the gyro and accel sign conventions to match SDL's SDL_hidapi_steam_hori.c, and corrects the accel/gyro raw-to-SI scale constants, which assumed +/-2g / +/-2000 deg/s instead of the real +/-8g / +/-2048 deg/s. Also guards the Bluetooth report-id acceptance path against zero-length timeout reads: a zero-byte read left the buffer all-zero, which was previously misread as a valid all-neutral report and caused phantom button presses. Documents the target-side gyro inversion, which converts events to the sensor frame SDL publishes for this controller.
…onvention Migrates the Legion Go S IMU source off the legacy Gamepad::Accelerometer/Gyro capabilities onto the SI-based Capability::Accelerometer/Gyroscope(Source), and removes the now-redundant duplicate capability declarations from the XInput source's capability list. Corrects inverted accelerometer Y, accelerometer Z, and gyro yaw signs. Renames the legos driver module and legos_* source modules to the full device name, legion_go_s, including the LegionGoS* controller names.
Refactors iio_imu driver to eliminate the flawed industrial-io crate. The drivers now read a single buffer. The data format is interpreted directly from the sysfs reported types. Poll rate of the driver is calculated from the set sampling rate of the source driver after attempting to set it to 200Hz. AccelGyro3D/SHF_IMU devices use their built-in timers for each instance; accel and gyro are separated in this configuration by the driver. The adm_sfh scale correction for the flawed hid rdesc is now configurable per source via accel_correction and gyro_correction in the IMU config (default 1.0) instead of hardcoded values. This is yet to be tested on Intel devices (Claw A1M) and may need some detection method or a config file flag if the intel driver doesn't have the same issue. BMI devices create and bind an hrtimer instance that is cleaned up when the device closes. The kernel driver provides both accel and gyro buffers on a single udev. Also migrates the driver off the legacy Gamepad::Accelerometer/Gyro capabilities onto the SI-based Capability::Accelerometer/Gyroscope(Source). Raw calibration values are read as the kernel reports them, with the channel offset subtracted from the raw reading.
Migrates the Steam Deck source and both targets off the legacy Gamepad::Accelerometer/Gyro capabilities onto the SI-based Capability::Accelerometer/Gyroscope(Source). Corrects the accelerometer/gyroscope scale constants, which were off by about 2.4% from SDL's real +/-2g / +/-2000 deg/s range, and the axis mapping between canonical and wire representations.
Migrates the 8BitDo Ultimate 2 Wireless source and target off the legacy Gamepad::Accelerometer/Gyro capabilities onto the SI-based Capability::Accelerometer/Gyroscope(Source). Ensures each axis properly maps to/from other targets/sources correctly. While at it, fixes a copy-paste error in the right trigger edge detection, which compared the left trigger against the old right trigger value.
6c03244 to
6267e54
Compare
Fixes a Y/Z byte-mapping error in the raw HID report, adds missing SI scale constants, and corrects per-axis signs. The physical Legion Go 2 is distinguished from the original Legion Go, which shares this driver, by a self-contained DMI product name check in the driver instead of the composite device name. The generation gates LeftStickTouch, QuickAccess2, and Keyboard, which only the Legion Go 2 has, and selects the per-generation gyro yaw conventions. Also renames the lego driver module to the full device name, legion_go, and documents the gyro scale in LSB/(deg/s).
Corrects mount_matrix values across several handhelds to account for the deck target's axis fix in the previous commit. Moves all matrix off the deprecated iio group level and on to the imu: config: level. Re-enables IIO on low power devices that were disabled. Also adds an events include/exclude filter to touched devices that were missing it. Adds accel_correction and gyro_correction values to the Legion Go, Legion Go 2, and MSI Claw A8 BZ2E IMU sources to compensate for the adm_sfh rdesktop scale flaw, replacing the previously hardcoded corrections. Constrains the MSI Claw udev source matches to /dev/input/event* nodes so joystick and LED class nodes of the same devices no longer match.
…orkarounds Removes the Gamepad::Accelerometer/Gyro capability variants and every workaround that existed to bridge them with the SI-based Capability::Accelerometer/Gyroscope(Source): the blanket event-translation shim that forced every accelerometer/gyroscope event into the legacy Gamepad:: format before handing it to targets, and the capability-list shim that faked a Gamepad::Accelerometer/Gyro entry into a composite device's reported capabilities "so the tester works". Safe now that every source and target has been migrated to the SI-based capability directly. The gamepad capability map still accepts the removed gyro and accelerometer fields; configs that set them load with a warning naming the Gyroscope:*/Accelerometer:* replacements. Also fixes UnifiedGamepadDevice's Capability::Accelerometer -> InputCapability mapping, which incorrectly produced GyroscopeLeft/Right/Center instead of AccelerometerLeft/Right/Center.
…oc scale factors Replaces the placeholder GYRO_SCALE_FACTOR/ACCEL_SCALE_FACTOR with denormalize_accel_value_i16()/denormalize_gyro_value_i16() using new UNIFIED_GAMEPAD_* constants, matching the +/-2g / +/-2000 deg/s convention used by Steam Deck.
The iio_imu driver refactor eliminated the industrial-io crate in favor of reading sysfs directly, so libiio is no longer a build or runtime dependency; removed from Cargo.toml/Cargo.lock, packaging metadata, and install docs.
6267e54 to
d1c2330
Compare
This PR does a major overhaul of how IMU data is managed across every aspect of InputPlumber.
Considerations:
This change breaks DSU/cemuhook for target devices that don't report their own gyro. The DualSense and Deck type targets will still work, but xbox style and 3rd party controllers will not get gyro data.
Closes #102
Closes #218
Closes #240
Closes #262
Closes #427
Closes #447
Closes #475
Closes #715
Closes #728
AI Disclosure:
I used an LLM to research some of the concepts used here, and to break the code up into individual commits once the concept was flushed out. I also used it to do an initial review.