Detect Switch 2 Pro Controller and support GL/GR paddles - #1
Merged
Conversation
The Pro Controller was never identified as Side.PRO: BleScanner only recognised the Joy-Con product bytes (0x67/0x66), so a Pro fell through to Side.UNKNOWN. That routed it into the single-Left-Joy-Con slot, where GamepadState.from applies the sideways 90 degree rotation and pins the right stick to centre — matching the reported symptoms (rotated D-Pad and left stick, dead right stick, working face/shoulder/system buttons). Detection: - Map product byte 0x69 (PID 0x2069) to Side.PRO. Once tagged PRO the existing pipeline fills both player slots (hasFullController), so no rotation is applied and the right stick decodes from offset 0x0D. GL/GR back paddles: - Parse report byte 0x07 (GR = bit 0, GL = bit 1) in PacketParser. - Add GL/GR to JoyconButton, which also makes them selectable remap sources for a Pro (ControllerMappingScreen enumerates the entries). - Expose them as HID buttons 15/16 (ReportMapper + UhidRelay descriptor, reusing the two former padding bits). - Show them in the Pro controller UI. Eden in-game binding for GL/GR is deferred: the Android keycode that HID buttons 15/16 land on is kernel/device-dependent and not yet captured. CI now uploads the debug APK as an artifact (it was built but never published). Adds PacketParserTest covering the PRO stick offsets and the paddle decode. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A Switch 2 Pro Controller was reported as behaving like a sideways Left Joy-Con:
Root cause
BleScanneronly recognised the Joy-Con product bytes (0x67Left /0x66Right), so a Pro Controller fell through toSide.UNKNOWN.PlayerStateResolverthen placed it in the single-Left-Joy-Con slot (leftset,rightnull), andGamepadState.from()takes its sideways branch for that shape — applyingSidewaysMapper's 90° rotation to the stick + D-Pad and pinning the right stick to centre. Every symptom follows from that one misclassification (the untouched buttons pass straight through, which is why they worked).Fix
Detection (the core fix):
0x69(Pro Controller 2, PID0x2069) →Side.PRO. The advertisement carries the little-endian USB/BLE product ID at manufacturer-data bytes[5..6], the same scheme as the hardware-confirmed Joy-Con values. Once taggedSide.PRO, the existing pipeline fills both player slots (hasFullController) → no rotation, andPacketParserdecodes the right stick from offset0x0D. This resolves the D-Pad, left stick, and right stick.GL/GR back paddles:
0x07(GR= bit 0,GL= bit 1) inPacketParser.GL/GRtoJoyconButton— this also makes them selectable remap sources for a Pro (the mapping screen enumeratesJoyconButton.entriesfor DUAL).ReportMapper+ theUhidRelayreport descriptor, reusing the two former padding bits).Delivery / tests:
app-debug) — it was being built but never published.PacketParserTestcovering the PRO stick offsets and the paddle decode.Testing notes for the reporter (I don't have a Pro Controller)
0x69is cross-validated from RE sources but not hardware-confirmed by us. This build's test is the confirmation. If the Pro still isn't detected, a logcat filtered onJoycon2during pairing will show the real advertisement byte (Adv … mfg=…is already logged) — please capture and share it.The debug APK is downloadable from this PR's CI run → Artifacts →
app-debug.🤖 Generated with Claude Code