hammerspoon icon indicating copy to clipboard operation
hammerspoon copied to clipboard

HIDAPI module wrapper / Surface Dial support

Open dge8 opened this issue 1 year ago • 0 comments

Hi all,

I recently bought a Surface Dial, and naturally it wasn't long before I wanted to try it with my Mac. I found the promising Mac Dial which provides a nice little system tray app and allows for translating rotation to scrolling or system volume control (with presses translated to clicks and play/pause/next, respectively). But then I thought, wouldn't it be great if it could also control Music volume (for AirPlay), or brightness, or send MIDI commands, or really just control anything in Hammerspoon.

Mac Dial builds on HIDAPI (with an extra commit to add a function for monitoring Mac device changes), and this seems like a powerful way to interface with Bluetooth/HID devices.

I notice HIDAPI has been mentioned a few times (by @latenitefilms and @cmsj) in relation to interfacing BT gamepads and other unusual BT/USB HID devices (e.g. #1587 and #1109) and was rejected due to being limited to opening devices in exclusive mode only on macOS. AFAICT this is no longer an issue as of libusb/hidapi#397.

Is there any interest in creating a HIDAPI extension and including it with Hammerspoon, for the purposes of then allowing one to write input-device-specific extensions on top in pure Lua? Unfortunately the former is beyond me for the foreseeable future, but if someone was willing to take on the HIDAPI extension, I'd be happy to write/test/contribute a pure-Lua module for the Surface Dial.

Of course, also open to other suggestions.

Thanks.

dge8 avatar Nov 29 '23 07:11 dge8