Skip to content

Fix the IOKit framework lookup in the macOS backend - #1

Open
vt128 wants to merge 1 commit into
dolmen-go:masterfrom
vt128:fix/macos-iokit-framework-path
Open

vt128 wants to merge 1 commit into
dolmen-go:masterfrom
vt128:fix/macos-iokit-framework-path

Conversation

@vt128

@vt128 vt128 commented Nov 9, 2026

Copy link
Copy Markdown

The macOS backend tries to load IOKit from /System/Library/IOKit.framework/IOKit, which omits the Frameworks directory. The failed lookup sends hidapi_IOHIDDeviceGetService through its private OS X 10.5 layout fallback even though the public symbol is available.

Use /System/Library/Frameworks/IOKit.framework/IOKit in both the original C source and the generated hidapi_mac.h that Cgo actually includes. Regenerating the header leaves no further changes.

On the tested Apple Silicon Mac, upstream HEAD 27ac09a enumerated a blink(1) mk2 with an empty path, preventing DeviceInfo.Open. With both files updated, enumeration returned a nonempty IOKit path and the same exact-serial fixture completed 16/16 sequential firmware Feature Report queries, returning firmware204. No first-device fallback was used.

Validation on macOS27.2 arm64, SDK27.2, Go1.27.3 / CGO:

  • Loader-only check: the original path fails; the corrected path loads and exports IOHIDDeviceGetService.
  • Isolated cold build: the native Cgo object and final probe contain the corrected path and no original path.
  • Upstream go test -race -count=1 -timeout=2m ./... and go vet ./... pass.
  • Read-only hardware probe:16 successful v command/write + fresh-buffer/read transactions; no retries, color, pattern or Flash commands. This hardware result covers the one Mac/mk2 fixture.

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