Accessing an HID interface in a USB Composite Audio device

I develop an app for a USB Composite device that has an audio class 1 interface and a midi interface. USBInterfaceOpen() (part of the IOUSBInterfaceStruct800) can open the midi interface and I can send and receive raw midi messages using the USB api just fine (using libusb). I do not need to detach the kernel driver and the audio device keep working.

We want to change our product so that it is an audio class 2 device and has a HID interface. When I use USBInterfaceOpen() on the HID interface, it returns with the error

another process has device opened for exclusive access

It is very odd that MacOS will let an application open a midi interface that MacOS does have a driver loaded for (its internal midi driver) but MacOS will not allow an application to open a HID interface in a USB Composite device with audio class 2 unless the application first detaches the kernel driver causing all audio function to stop.

The app must be able to control the product while at the same time audio continues to function in the OS. On Windows and Linux the HID interface can be used without the audio device being removed from the OS. MacOS is prohibiting us from moving forward with this solution. Is this a bug in MacOS?

Developing on MacOS is 12.5, XCode = 13.4, tried target 10.14, 11.0 and 12.0

I meet the same issue. I have a composite device which has multiple interfaces. One of it is audio control interface, the other is audio speaker. I just want to access autio control interface, and do not detach the kernel driver of the audio speaker and it keep working. It seems that I should capture the whole device as exclusive mode, then I can capture the audio contorl interface successfully. So, I think the macOS did not support composite usb device.

Accessing an HID interface in a USB Composite Audio device
 
 
Q