Skip to content

add macOS support#57

Open
alfaoz wants to merge 2 commits into
nowrep:mainfrom
alfaoz:macos-port
Open

add macOS support#57
alfaoz wants to merge 2 commits into
nowrep:mainfrom
alfaoz:macos-port

Conversation

@alfaoz
Copy link
Copy Markdown

@alfaoz alfaoz commented Mar 20, 2026

summary

adds macOS support to dualsensectl. all changes are behind #ifdef __APPLE__ — linux code is untouched.

  • replaces libudev with IOKit/CoreFoundation for device monitoring (IOHIDManager callbacks for hotplug)
  • swaps hidapi-hidraw for the generic hidapi (uses IOKit backend on macOS)
  • handles macOS IOKit stripping the HID report ID byte from read buffers
  • adds nanosleep compat shim for thrd_sleep
  • platform-conditional meson.build (auto-detects macOS vs Linux dependencies)

tested on

  • macOS sequoia 15, arm64 (apple silicon)
  • dualsense (CFL-ZCT1) over USB and bluetooth
feature bluetooth usb
device listing yes yes
battery yes yes
firmware info yes yes
lightbar yes yes
player leds yes yes
adaptive triggers (all modes) yes yes
mic led yes yes
speaker routing yes
volume yes
microphone on/off yes
monitor (plug/unplug) yes yes

build on macOS

brew install hidapi meson
meson setup build
meson compile -C build

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.
Copilot AI review requested due to automatic review settings March 20, 2026 20:12
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 monitor command backend using IOHIDManager callbacks.

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.

Comment thread meson.build Outdated
Comment thread meson.build Outdated
Comment thread main.c Outdated
Comment thread main.c
Comment thread main.c
- 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
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread meson.build
Comment thread main.c
@alfaoz
Copy link
Copy Markdown
Author

alfaoz commented Mar 25, 2026

hello!

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.

2 participants