larskanis/libusb

LIBUSB::ERROR_ACCESS in Mac OS X

Benratelade opened this issue · 2 comments

Hi there,

I was following the README file to try to interact with an audio interface connected via USB, on Mac OS X.

Whenever I try to interact with a device, I get: LIBUSB::ERROR_ACCESS, for example:

device_handle.detach_kernel_driver(0)
LIBUSB::ERROR_ACCESS in libusb_detach_kernel_driver (LIBUSB::ERROR_ACCESS)
        from libusb-0.6.4/lib/libusb/dev_handle.rb:273:in `detach_kernel_driver'

My guess is that I don't have proper permissions (based on the docs:

# * Linux: read+write permissions to <tt>/dev/bus/usb/<bus>/<dev></tt>
).

However, my understanding is that there is no entry in /dev or anywhere in Mac OS that would make this possible.

So my question is: is it even possible to process packets from a USB device in Mac OS X with libusb, or am I out of luck?

Some environment info:
libusb 1.0.26 installed with brew install libusb.
ruby 3.1.2, on Mac OS X Ventura 13.3.1.

I don't know Macos well enough to give a specific answer. Just some ideas:

  • I know from reading, that USB-HID devices are not easily accessible through libusb on Macos. These type of devices should be used through libhid instead.
  • libusb for Ruby is just a wrapper around the C based libusb library. You can google for LIBUSB_ERROR_ACCESS to get some help.

Thank you for getting back to me so quickly, I'll have a look at those options.