不幸的是,不是使用HID Manager
的API沒有其他辦法。原始訪問OS X中的HID設備不受支持。
的documentation清楚:
HID family. Through the HID Manager, the HID family provides a device
interface for accessing a variety of devices, including joysticks and other
game devices, audio devices, non-Apple displays, and UPS (uninterruptible
power supply) devices.
通過POSIX原始訪問API,這只是available存儲,網絡和串行設備:
Using POSIX APIs
For each storage, network, and serial device the I/O Kit dynamically
creates a device file in the file system’s /dev directory when it discovers
a device and finds a driver for it, either at system startup or as part of
its ongoing matching process. If your device driver is a member of the I/O
Kit’s Storage, Network, or Serial families, then your clients can access your
driver’s services by using POSIX I/O routines.
所以您可以直接或使用HID Manager
的API可以使用libusb或(作爲其他答案提及)hidapi,它們只不過是HID Manager
apis上的封裝庫。使用這些庫的好處是它們可以抽象出大部分低級調用,從而使它們更易於使用。