Repository navigation
Fix C/Capture swap, read factory stick calibration, hardening (v1.3.0) - #18
Merged
Merged
Conversation
Protocol (sources cited in code and README): - Byte 4 of the input report: Capture is 0x02 and C is 0x10, not the reverse. Agreed by ndeadly/switch2_controller_research (hid_reports.md), esp-cpp/espp PR #765 (switch2_pro_report.hpp) and the hardware capture in issue #14. Also fixes Capture -> DSU Touch. - Read the factory stick calibration over the command channel (649d4ac9-...f005 / replies c765a961-...) and light player LED 1. Frame format, SPI addresses 0x130A8/0x130E8 and block layout adapted from kennethreitz/switch2bridge-macos@975f329 (issue #14, MIT), based on darthcloud/BlueRetro#1249; addresses match SDL's Switch 2 driver. Best effort: a silent controller keeps the nominal 2048 range. - README: 7492866c-...c0f8 is notify-only, document the command channel. Hardening: - mappings.json written atomically (temp file + os.replace) - "dsu.enabled" must be a boolean (bool("false") was True) - warn when the DSU server is bound to a non-loopback address - DSU socket: drop SO_REUSEADDR (useless for UDP; on Linux it let a second server silently share the port) - worker -> UI messages taken atomically; stick hysteresis read under lock - asyncio.get_running_loop(); logging set up at startup, not import Build: Python 3.10+ (bleak 3 requires it), major-version upper bounds, py2app moved to requirements-build.txt, CI matrix 3.10/3.12/3.13, DMG README explains the macOS 15+ Gatekeeper "Open Anyway" flow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SGsFjHBorX2mfsanZhFyzs
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.
Protocol
0x02, C is0x10. Three independent sources agree: ndeadlyhid_reports.md, espp PR #765switch2_pro_report.hpp, and the hardware capture in Findings from a Pro 2 unit: C/Capture swapped, stick calibration, and USB does work #14. Also fixes Capture → DSU Touch.649d4ac9-…f005, replies onc765a961-…), then player LED 1 is lit. Frame format, SPI addresses0x130A8/0x130E8and block layout are adapted from kennethreitz's fork @ 975f329 (MIT, Findings from a Pro 2 unit: C/Capture swapped, stick calibration, and USB does work #14), which is based on BlueRetro #1249; the addresses match SDL's Switch 2 driver. This is best effort: if the controller stays silent, the bridge keeps the nominal 2048 range, as before.…c0f8is notify-only, so the command channel and the input report layout are now documented.Hardening
mappings.jsonis written atomically (temp file +os.replace)."dsu.enabled"must be a boolean;bool("false")used to evaluate to True.SO_REUSEADDR. It is useless for UDP, and on Linux it let a second server silently share the port.get_running_loop(); logging is set up at startup instead of at import.Build
py2appmoved torequirements-build.txt.Tests
PROTOCOL.md), command frames, an end-to-end session with and without a responding controller, and the config hardening.rumps/pynput. Not yet verified on real hardware: C/Capture, the "sticks calibrated" status and the player LED.🤖 Generated with Claude Code
https://claude.ai/code/session_01SGsFjHBorX2mfsanZhFyzs
Generated by Claude Code