Question about MacOS exclusive rights to USB devices

How to send SCSI instructions to USB devices on MacOS system? The relevant operation can be seen from the official website: first, the primary port is obtained, then the dictionary is traversed to find the relevant device, then the exclusive permission of the device is obtained through the underlying interface, and finally SCSI instruction is sent and data is returned. When you get exclusive access through ObtainExclusiveAccess, the system always returns kIOReturnBusy, causing the device to be busy. May I ask why the USB device just inserted fails to obtain its exclusive permission, indicating that the device is busy? Is there any way to get exclusive rights from the MacOS system?
Hope to get your help or advice, thank you!
Answered by DTS Engineer in 641580022
I’m going to repeat the question I posed in the other thread you asked this on, namely…

What sort of USB device? A mass storage device? Or something else?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Accepted Answer
I’m going to repeat the question I posed in the other thread you asked this on, namely…

What sort of USB device? A mass storage device? Or something else?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
A mass storage device.Is there anything you can do to solve this problem?

A mass storage device.

I don’t think there’s an easy way to achieve this goal. Included below is my understanding of the issue. However, I must caution you that this is somewhat outside of my area of expertise so things might have changed since I last looked at it. If you want a definitive answer you should open a DTS tech support incident and talk to our I/O Kit specialist.



The issue here is that drivers within the kernel match against mass storage nubs and that prevents you from opening a user client for them. The only way around that is to create a KEXT that matches against the nub and provides the user client (or other user-space accessible features) you need.

The VendorSpecificType00 sample code shows one way to do this. Make sure to read its read me.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
do you solve it?
Question about MacOS exclusive rights to USB devices
 
 
Q