add macOS support#57
Open
alfaoz wants to merge 2 commits into
Open
Conversation
replace libudev with IOKit/CoreFoundation for device monitoring, swap hidapi-hidraw for the generic hidapi (IOKit backend), handle macOS-specific HID report ID stripping, and add nanosleep compat for thrd_sleep. all changes behind #ifdef __APPLE__ — linux code is untouched. tested on macOS sequoia (arm64) over both USB and bluetooth.
There was a problem hiding this comment.
Pull request overview
This PR adds macOS support to dualsensectl by introducing macOS-specific HID handling and device monitoring while keeping Linux behavior intact via platform conditionals.
Changes:
- Adds platform-conditional Meson dependencies to switch between Linux (
hidapi-hidraw+libudev) and macOS (hidapi+ IOKit/CoreFoundation frameworks). - Introduces macOS-specific handling for HID input report layout differences (report ID stripping).
- Implements a macOS
monitorcommand backend usingIOHIDManagercallbacks.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| meson.build | Adds OS-conditional dependencies and linker args for macOS vs Linux. |
| main.c | Adds macOS-specific includes/shims, input report parsing adjustments, and an IOKit-based monitor implementation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- fix potential NULL dereference in serial number fprintf - handle macOS report ID stripping in update command (not just battery) - fix CF object leak on IOHIDManagerOpen error path - use bracket syntax for meson array appends
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Author
|
hello! |
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.
summary
adds macOS support to dualsensectl. all changes are behind
#ifdef __APPLE__— linux code is untouched.libudevwithIOKit/CoreFoundationfor device monitoring (IOHIDManagercallbacks for hotplug)hidapi-hidrawfor the generichidapi(uses IOKit backend on macOS)nanosleepcompat shim forthrd_sleepmeson.build(auto-detects macOS vs Linux dependencies)tested on
build on macOS