Code Block Objective-C _device = [[IOUSBHostDevice alloc] initWithIOService:_service options:IOUSBHostObjectInitOptionsDeviceCapture queue:_queue error:&error interestHandler:^(IOUSBHostObject * _Nonnull hostObject, uint32_t messageType, void * _Nullable messageArgument) { NSLog(@"Interest handler..."); }];
However, when I run this tool (even under sudo), I'm hitting the error:
The documentation for IOUSBHostObjectInitOptionsDeviceCapture implies that using this option and having root privilege should gain exclusive access to the device. The alternative is to use an entitlement, but the executable is terminated immediately in that case probably due to code signing.Error:Unable to open io_service_t object and create user client. with reason: Exclusive open of usb object failed.
I would have expected that running the tool under sudo would have been sufficient to avoid this issue.
I just want to first get things working locally on my Mac for a proof of concept, so I don't really want to deal with code signing up front unless that is absolutely necessary.
What do I need to do to get exclusive access to the USB device?
Thanks in advance.