Skip to content

feat: other brands' centre button opens Console Mode, through standard HID usages - #226

Merged
lippdev merged 3 commits into
mainfrom
feat/hid-home-button
Nov 18, 2026
Merged

lippdev merged 3 commits into
mainfrom
feat/hid-home-button

Conversation

@lippdev

@lippdev lippdev commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Second of three PRs for generic controllers in 1.7.1-beta.4. Stacked on #225 (shares Native/HidDevices): merge #225 first, then retarget this to main.

What

PLEXX-DE (#217): the centre button of an Amazon Luna pad (Bluetooth, 0171:0419) doesn't open Console Mode; only Select + Y works. XInput (XInputGetStateEx) reports the Guide button for Xbox pads only, even when it covers the rest of another brand's pad.

Rather than a per-model rule, this reads the standard HID usages of a controller's centre button, for any brand:

  • Generic Desktop System Main Menu (0x01:0x85)
  • Consumer AC Home (0x0C:0x223)

HidHomeButtonReader (new, started with the controller shortcuts and while recording one):

  • every 3 s lists the HID collections; a device counts when one of its collections is a gamepad/joystick (usage page 1, usage 4/5) and its vendor isn't Microsoft (XInput already has Guide) or Sony (SonyHidReader reads PS). All collections of that vendor+product are looked at, since the button may sit on a sibling "consumer control" collection;
  • a collection that declares one of those usages as an input button (HidP_GetSpecificButtonCaps) is opened shared and read (HidP_GetUsagesEx); the button sets Guide (0x0400) for that device; a report of another id keeps the last state;
  • logs once: lendo o botão central pelo HID (<vid:pid>, <usage>), or that Windows won't let it be read.

ControllerHoldWatcher and ShortcutPicker take it like the Sony reader: Guide alone is matched per device; Guide plus another button on such a pad isn't (its other buttons come through XInput).

Pure rules in ControllerMapping (tested): HomeUsages, IsHomeUsage, ReadsHomeFromHid, DescribeUsage (also for the diagnostics PR).

Changelogs (both) and docs/TESTING.md updated.

Testing

  • dotnet test: 715 passing (15 new). Debug build OK; 20 s run with no error in the log.
  • On the owner's PC (no such pad) a harness compiling HidDevices.cs: DeclaredButtons found exactly what each collection declares (the keyboard's and the receiver's consumer collections declare AC Home, which is why only devices that are game controllers are looked at); consumer collections open for reading, keyboards and mice don't; PressedButtons parses reports and returns null for other report ids.
  • Whether the Luna declares one of these usages: to be seen on the beta (PR 3 adds the usages to the controller test). If it doesn't, the diagnostics will show what it sends.

🤖 Generated with Claude Code

lippdev and others added 2 commits November 18, 2026 13:59
…d HID usages

XInput never reports the centre button of pads that aren't Xbox, even
when it covers the rest of the pad (an Amazon Luna over Bluetooth, issue
#217). HidHomeButtonReader looks, on every collection of a game
controller's vendor and product (not Microsoft, not Sony), for the
standard usages of that button: Generic Desktop System Main Menu (0x85)
and Consumer AC Home (0x223). Collections that declare one are opened
shared and read; the button counts as Guide for the controller
shortcuts and for recording a new one. Keyboards that declare AC Home
are never read: only devices that are also game controllers.

HidDevices gains OpenForRead, DeclaredButtons and PressedButtons
(HidP_GetSpecificButtonCaps, HidP_GetUsagesEx).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Approach: sound — discovers non-Xbox/non-PlayStation gamepad collections and reads the standard HID home usages without exclusive access, then maps them to the existing Guide shortcut.

Reviewed changes This review covers the HID reader, shortcut capture and hold-watcher integration, mapping rules and tests, plus the changelog and manual test checklist.

  • HID discovery and parsing: Identifies controller collections by VID/PID, finds collections declaring the standard home usages, and tracks their input reports.
  • Shortcut integration: Acquires/releases the reader alongside shortcut watching and capture, exposing the held home button as Guide.
  • Rules and verification: Adds pure usage mapping tests and manual checks for supported controllers and existing Xbox/PlayStation behavior.

Pullfrog  | View workflow run | Using gpt-6-luna | 𝕏

@lippdev
lippdev changed the base branch from feat/bluetooth-battery to main November 18, 2026 17:08
@lippdev
lippdev merged commit c098f51 into main Nov 18, 2026
2 checks passed
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.

1 participant