Repository navigation
hidpp, userspace: add Logitech RS H-Shifter support, desktop routing, and UI gate monitor - #140
Conversation
mescon
left a comment
There was a problem hiding this comment.
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:
- Gear decoding must be gated per wheel.
gear_from_wheel_coderuns 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 (seeG923_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. - Kernel: gate the enablement on the shifter being present.
hidpp_dd_enable_desktop_shifterruns 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 whenh_shifter_dev_idxwas found, and make the completion linedd_dbg. - 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.
3200e3a to
e3b8ac0
Compare
|
Thanks for the thorough review and catching the G923 button collision! I've addressed all the review items:
|
mescon
left a comment
There was a problem hiding this comment.
Thanks, this round lands the big ones: the G923 gate with its test back, the enablement keyed on h_shifter_dev_idx, 0x80B1 gone, and the wire table in the docs. Four smaller things before it can go in:
- Rebase on master (now at 1af9b33). The cargo-audit job fails on your branch only because master's lockfile bump to pulldown-cmark 0.13.6 is missing.
desktop_sync_zones: the new skip runs for every RS50 in desktop mode, not only with a shifter attached, so it changes LIGHTSYNC for everyone. Gate it onh_shifter_dev_idx != HIDPP_DD_FEATURE_NOT_FOUND. Inhidpp_dd_oled_handbackthe call now also runs from the remove path (the handback at teardown); return early whenff->stoppingis set.- Fill
ff->accessory_name(for example "RS H-Shifter") when the 0x812D probe succeeds.wheel_accessoryis what the TUI,logi-wheel doctorand--reportread, so that gives them the accessory for free; today only the GUI knows about it. gear_from_wheel_codemaps 0x2c4 to Reverse, but your own table says index 20 is unused: drop the alias. And the "RS50 Base" label intestio.rsalso shows on a G PRO; "Wheel base" covers both.
I will approve CI as soon as the rebase is up.
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 and sync sequence is sent. Discover GAMING_ATTACHMENTS (0x8120) and RS_H_SHIFTER (0x812D), and invoke hidpp_dd_enable_desktop_shifter() when entering or detecting Desktop mode if an RS H-Shifter is present (h_shifter_dev_idx). Signed-off-by: Gonzalo Adrio <gonzaloadrio@users.noreply.github.com>
Add Logitech RS H-Shifter (046d:c26b) detection and decoding for both direct USB mode and wheel base accessory port attachment. Gate wheel-base gear decoding strictly to direct-drive wheels (RS50 and G PRO) to prevent collisions with physical button codes on G923 editions. Add an interactive 7+R Slint visual H-gate component and document input report mappings and evdev codes. Signed-off-by: Gonzalo Adrio <gonzaloadrio@users.noreply.github.com>
Activating or handing back the RS50 base OLED display via Feature 0x8130 (DisplayGameData) resets the internal sub-device gate routing table (Feature 0x8120), dropping gates 1-6 and Reverse while leaving only 7th gear operational in desktop mode. Re-invoke hidpp_dd_enable_desktop_shifter() whenever the OLED display is handed back to firmware menus or activated through wheel_oled sysfs attribute while operating in desktop mode (current_mode == 0). Signed-off-by: Gonzalo Adrio <gonzaloadrio@gmail.com>
SonarCloud flagged dropping the const qualifier on slot_routing when passing it as mutable u8 * to hidpp_send_fap_command_sync(). Copy the table into the local params buffer instead. Signed-off-by: Gonzalo Adrio <gonzaloadrio@gmail.com>
Extract standalone USB shifter event polling from Reader::start loop into a dedicated helper function (poll_standalone_shifter). Signed-off-by: Gonzalo Adrio <gonzaloadrio@gmail.com>
…nd guard clauses Replace nested if-let pyramid with guard clauses and early exits (return false on empty/err read, continue on unhandled events). Signed-off-by: Gonzalo Adrio <gonzaloadrio@gmail.com>
48f0d77 to
c94d80e
Compare
|
Thanks @mescon, rebased and pushed with all 4 items addressed:
SonarCloud check is green. |
… gating - Gate desktop_sync_zones skip on h_shifter_dev_idx != NOT_FOUND. - Return early in hidpp_dd_oled_handback if ff->stopping is set. - Populate ff->accessory_name with 'RS H-Shifter' on 0x812D discovery. - Allow wheel_accessory_show to report when either shifter_dev_idx or h_shifter_dev_idx is present. - Drop unused 0x2c4 alias in gear_from_wheel_code. - Rename 'RS50 Base' label in testio.rs to 'Wheel base' for generic direct-drive coverage. Signed-off-by: Gonzalo Adrio <gonzaloadrio@gmail.com>
c94d80e to
8484945
Compare
The 0x812D probe ran as a second loop over every candidate sub-device, so a base without an H-Shifter paid one HIDPP_DD_PROBE_TIMEOUT per silent candidate on top of what the pedal and RS Shifter & Handbrake pass already cost, about a second and a half at probe. A port with no response curve answers that first pass with -ENOENT in a few milliseconds, which is exactly what the H-Shifter looks like, so ask such a candidate for 0x812D right there and never probe a silent index twice. The accessory rescan only knew the RS Shifter & Handbrake, so an H-Shifter plugged in after the module loaded was never found and one pulled out was never forgotten. Teach it both directions, and send the desktop-mode enablement sequence when a shifter arrives, as probe does. The RS Shifter & Handbrake adoption moves into a helper shared by probe and rescan. wheel_accessory's documentation covers both accessories and the on-demand re-check.
|
Pushed one commit on top of yours (eb1164b) for the two remaining gaps. The 0x812D probe now rides the existing candidate pass: a port with no response curve answers -ENOENT in a few milliseconds, and only those get asked for 0x812D, so a base without the shifter pays nothing extra at probe. The accessory rescan now learns H-Shifter arrival and removal and re-sends the desktop enablement when one arrives, so it works plugged in after boot and Builds and checkpatch are clean here, but nobody on this side has the shifter. Could you reload with it attached, then pull it and plug it back while reading |
|
|
Tested live on the RS50 base ( Here is the log summary from the re-plug test in desktop mode:
As a small observation for down the road: with both accessories plugged in at the same time (RS H-Shifter + RS Shifter & Handbrake), input routing works seamlessly in parallel for both devices. Currently Everything is working smoothly and ready to merge from my side. Thanks a lot for the great work on the hotplug and probe refactoring! |
mescon
left a comment
There was a problem hiding this comment.
Thanks for the thorough re-plug run, that is exactly the confirmation this needed. Approving and merging.
Your point about both accessories at once is fair: wheel_accessory is a single value by design, so a second attribute or a list format would be needed to show both. Worth a follow-up issue once this lands, and the RS Shifter & Handbrake owners can weigh in on the format. A CREDITS.md entry for this work follows on master.



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:c276or G PRO):0x0F(GAMING_ATTACHMENTS), which reset the base's attachment routing table if called after configuration.Changes
Kernel driver (
mainline/hid-logitech-hidpp.c):0x8120(GAMING_ATTACHMENTS) and0x812D(RS_H_SHIFTER).hidpp_dd_enable_desktop_shifter()sending the 5-step slot routing and enablement sequence.hidpp_dd_ff_query_settings()when entering or detecting Desktop mode (current_mode == 0).ff->idx_attachments(0x0F) fromdesktop_sync_zonesso LIGHTSYNC LED updates do not wipe out attachment routing.scripts/checkpatch.pl: 0 errors, 0 warnings,Signed-off-by).Userspace (
logi-wheel-core&logi-wheel-gui):discover_shifter_input,gear_from_wheel_code,gear_from_standalone_code).info_page.slint) showing live gate engagement and neutral rail.LSBbutton (0x12b).cargo test --workspace: 219 passed, 0 failed).Documentation:
docs/PROTOCOL_SPECIFICATION.md(Report 0x08, Byte 2 bits 0–6 for Gears 1–7, Byte 3 bit 0 for Reverse).docs/BUTTON_MAPPING.md.Hardware Verification
046d:c276) with the RS H-Shifter (046d:c26b) under Fedora Linux (kernel 7.2.x).