Skip to content

hidpp, userspace: add Logitech RS H-Shifter support, desktop routing, and UI gate monitor - #140

Open
gonzaloadrio wants to merge 2 commits into
mescon:masterfrom
gonzaloadrio:feature/rs-h-shifter-support
Open

gonzaloadrio wants to merge 2 commits into
mescon:masterfrom
gonzaloadrio:feature/rs-h-shifter-support

Conversation

@gonzaloadrio

Copy link
Copy Markdown

Summary

This PR adds complete support for the Logitech G RS H-Shifter (046d:c26b) across both the kernel driver and the userspace desktop stack (supersedes and resolves #138).

Problem & Root Cause

When the RS H-Shifter is connected via the accessory port of direct-drive wheel bases (such as the RS50 046d:c276 or G PRO):

  • In Onboard Mode (profiles 1–5), the wheel base microcontroller autonomously routes the shifter gates to interface 0.
  • In Desktop Mode (profile 0 / G HUB mode), the wheel base leaves the accessory gates disabled by default, reporting only Gear 7 and suppressing Gears 1–6 and Reverse unless host software explicitly activates attachment slot routing over HID++ 2.0.
  • Additionally, LIGHTSYNC's desktop zone sync sequence was targeting index 0x0F (GAMING_ATTACHMENTS), which reset the base's attachment routing table if called after configuration.

Changes

  1. Kernel driver (mainline/hid-logitech-hidpp.c):

    • Discover HID++ features 0x8120 (GAMING_ATTACHMENTS) and 0x812D (RS_H_SHIFTER).
    • Added hidpp_dd_enable_desktop_shifter() sending the 5-step slot routing and enablement sequence.
    • Invoked at the end of hidpp_dd_ff_query_settings() when entering or detecting Desktop mode (current_mode == 0).
    • Excluded ff->idx_attachments (0x0F) from desktop_sync_zones so LIGHTSYNC LED updates do not wipe out attachment routing.
    • Linux kernel coding style compliant (scripts/checkpatch.pl: 0 errors, 0 warnings, Signed-off-by).
  2. Userspace (logi-wheel-core & logi-wheel-gui):

    • Implemented detection for the shifter input node (discover_shifter_input, gear_from_wheel_code, gear_from_standalone_code).
    • Designed an interactive 7+R visual H-gate component in Slint (info_page.slint) showing live gate engagement and neutral rail.
    • Cleaned up gear decoding to avoid collisions with the wheel rim's physical LSB button (0x12b).
    • Passes 100% of workspace unit tests (cargo test --workspace: 219 passed, 0 failed).
  3. Documentation:

    • Documented input report offsets and bitmasks in docs/PROTOCOL_SPECIFICATION.md (Report 0x08, Byte 2 bits 0–6 for Gears 1–7, Byte 3 bit 0 for Reverse).
    • Documented DirectInput and evdev button indices in docs/BUTTON_MAPPING.md.

Hardware Verification

  • Hardware-tested live on an RS50 base (046d:c276) with the RS H-Shifter (046d:c26b) under Fedora Linux (kernel 7.2.x).
  • Verified live byte streams across all 7 forward gears and Reverse in both Onboard and Desktop ("G HUB") modes.

In Desktop mode (profile 0), the RS50 base suppresses accessory gate
reporting for gears 1-6 and Reverse on interface 0 unless G HUB's
slot routing, sync, and accessory activation sequence is sent.

Add discovery for GAMING_ATTACHMENTS (0x8120) and RS_H_SHIFTER (0x812D),
and invoke hidpp_dd_enable_desktop_shifter() when entering or detecting
Desktop mode to ensure full 8-gate functionality without requiring G HUB.

Signed-off-by: Gonzalo Adrio <[email protected]>
@sonarqubecloud

sonarqubecloud Bot commented Nov 1, 2026

Copy link
Copy Markdown

@mescon mescon left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, the H-shifter has been on the list for a while and the onboard-versus-desktop finding is new to me. Four things before it can go in:

  1. Gear decoding must be gated per wheel. gear_from_wheel_code runs for every model. On the G923 PS edition 0x2c3/0x2c4 are Plus and Minus; on the G923 Xbox edition 0x12b to 0x2c1 are already Shifter R and 1 to 6 (see G923_XBOX_BUTTONS) and 0x2c2 to 0x2c4 are Plus, Minus and the dial. With this change a G923 owner pressing Plus sees "shifter connected, Reverse". Apply the RS50 map only for RS50 and G PRO, keep the G923 tables as they are, and restore the G923 test you rewrote.
  2. Kernel: gate the enablement on the shifter being present. hidpp_dd_enable_desktop_shifter runs on every desktop-mode wheel, so every RS50 and G PRO owner now gets the 0x8120 and 0x1BC0 writes and an info line at each settings query. Run it only when h_shifter_dev_idx was found, and make the completion line dd_dbg.
  3. Evidence for the sequence. The 0x8120 fn2 slot list matches what G HUB sends at start-up in our captures. 0x80B1 fn8 = 1 and the 0x1BC0 fn2 on the sub-device I have no capture for. Where do they come from? If from a Windows capture, attach it:
tools\windows-usb-capture.bat

Otherwise the dmesg of a probe with the shifter attached (the new "RS H-Shifter at dev" line) and a note of what else was on the base, since the 0x812D discovery skips shifter_dev_idx.
4. Docs: write "1 to 7" rather than "1–7"; this repo keeps dashes out of prose.

#139 stacks on this branch, so it will need a rebase once this changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants