dualsense_api 1.0.1 copy "dualsense_api: ^1.0.1" to clipboard
dualsense_api: ^1.0.1 copied to clipboard

Control a Sony DualSense (PS5) controller over USB on macOS via HIDAPI + Dart FFI: read sticks, triggers, buttons, battery and audio jack in real time, and command the lightbar color.

1.0.1 #

Bug fixes found in end-to-end testing against real hardware:

  • Fix L3/R3 button mapping. They read bits 0x04/0x08 of the button byte, which are actually the digital L2/R2 (set when the analog triggers are pulled). L3/R3 live in bits 0x40/0x80. Pulling the triggers no longer reports L3/R3, and real stick clicks are now detected.
  • Fix setLedColor doing nothing. The output report set feature flag byte 0 but not byte 1, whose LIGHTBAR_CONTROL_ENABLE (0x04) bit is required for the controller to apply the RGB. The lightbar now changes.
  • Detect disconnection. The read loop now stops and signals listeners (stream error) when hid_read returns an error (controller unplugged), instead of spinning silently — consumers can react instead of freezing.

1.0.0 #

  • Initial release.
  • DualSenseBindings: FFI bindings to libhidapi (hid_init, hid_open, hid_read, hid_write, hid_close, hid_get_product_string).
  • DualSenseController: connects to the DualSense over USB, runs a background polling loop, exposes an onInputChanged stream with structural deduplication, and setLedColor(r, g, b) for the lightbar.
  • DualSenseState: immutable model with sticks, analog triggers, buttons, D-Pad, battery, charging state, and the 3.5mm audio jack.
  • Platform support: macOS (Apple Silicon, Homebrew).
0
likes
140
points
31
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Control a Sony DualSense (PS5) controller over USB on macOS via HIDAPI + Dart FFI: read sticks, triggers, buttons, battery and audio jack in real time, and command the lightbar color.

Repository (GitHub)
View/report issues

Topics

#ffi #gamepad #hid #macos #desktop

License

MIT (license)

Dependencies

equatable, ffi

More

Packages that depend on dualsense_api