Skip to content

Bind wired SDL vendor commands to the correct physical controller - #7

Merged
jmonster merged 5 commits into
fix/sdl-preserve-input-edgesfrom
fix/sdl-usb-device-identity
Sep 10, 2026
Merged

jmonster merged 5 commits into
fix/sdl-preserve-input-edgesfrom
fix/sdl-usb-device-identity

Conversation

@jmonster

@jmonster jmonster commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Ready for review — wired device identity, depends on #2

Head 7a026de88151297913f4a4e061bc39800754c4cd. Exact-head SDL/USB regression and build passed.

The original SDL patch opened the first matching VID/PID, potentially sending initialization or feedback to the wrong identical controller. The follow-on patch resolves the selected HID DevSrvsID through IOKit to its USB ancestor and matches the unique libusb bus/address plus model IDs. Unknown, invalid or ambiguous identities do not fall back to a different controller. Registry properties/entries are released.

The baseline acquisition function fails the wrong-identical-device test. The correction passes boundary tests for reverse enumeration, missing/ambiguous peers, failed claims, alternate registry properties, invalid paths and resource cleanup. CI explicitly enables libusb and compiles the real wired driver against Apple IOKit/CoreFoundation; the real SDL/UDP input test runs against the combined rebuilt library.

The latest integration repair renames the source-dependent harness to tests/sdl-usb/check-sdl.sh, preventing the generic Swift test runner from invoking it without an SDL checkout. It stays fully exercised by its dedicated workflow. Both combined app tests and combined SDL tests passed.

Compatibility tradeoff: this path performs wired initialization too. Unsupported HID/IOKit layouts can now prevent initialization instead of guessing another device. Physical same-hub device ancestry and driver behavior remain unqualified. BLE/UDP handling and Nintendo command bytes are unchanged.

The tracked upstream dylib is not silently updated; rebuild with sdl/build-sdl.sh or review the corrected development artifact. Merge #2 first, then retarget to main and recheck. No merge, binary installation or release performed.

Resolve the HID registry service to its USB ancestor and match bus plus
address, not the first VID/PID entry. Unknown/ambiguous identity fails closed.
The same path initializes wired devices, so hardware identity coverage is an
explicit compatibility gate. BLE and command bytes remain unchanged.

Test actual production function bodies with fake IOKit/libusb boundaries and
compile the full wired SDL driver against the real Apple SDK. The baseline
wrong-device reproducer exits 42; corrected selection/cleanup cases must pass.
…ration header

The initial check looked in include/ rather than SDL's include-config-* path.
Keep the assertion that HAVE_LIBUSB is enabled so the real wired driver cannot
silently be preprocessed out of the Apple-SDK build.
@jmonster
jmonster marked this pull request as ready for review September 9, 2026 23:47
@jmonster
jmonster merged commit 231e49a into fix/sdl-preserve-input-edges Sep 10, 2026
1 check passed
@jmonster
jmonster deleted the fix/sdl-usb-device-identity branch September 10, 2026 00:01
jmonster added a commit that referenced this pull request Sep 10, 2026
* fix(sdl): preserve received button edges and trigger transitions

* test(sdl): wait for throttled hotplug registration before checking edges

* test(sdl): inspect queued SDL events after explicit update and axis warmup

* build(sdl): use and test the corrected library instead of the stale bundled binary

* Bind wired SDL vendor commands to the correct physical controller (#7)

* fix(sdl): bind vendor commands to the HID device's exact USB ancestry

Resolve the HID registry service to its USB ancestor and match bus plus
address, not the first VID/PID entry. Unknown/ambiguous identity fails closed.
The same path initializes wired devices, so hardware identity coverage is an
explicit compatibility gate. BLE and command bytes remain unchanged.

Test actual production function bodies with fake IOKit/libusb boundaries and
compile the full wired SDL driver against the real Apple SDK. The baseline
wrong-device reproducer exits 42; corrected selection/cleanup cases must pass.

* test(sdl): explicitly enable libusb and inspect the generated configuration header

The initial check looked in include/ rather than SDL's include-config-* path.
Keep the assertion that HAVE_LIBUSB is enabled so the real wired driver cannot
silently be preprocessed out of the Apple-SDK build.

* ci(sdl): preserve compiler diagnostics and surface concise failure tails

* fix(sdl): include the CoreFoundation number API used by registry validation

* test: keep SDL source-dependent checks out of the Swift suite discovery
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