Thanks Kevin, that was very helpful. I called IOServiceOpen() directly on the interface service and logged the registry state:
IOServiceOpen() returns 0xe00002e2 (kIOReturnNotPermitted), not kIOReturnExclusiveAccess.
No mass storage driver is attached to the interface. The only child of IOUSBHostInterface@0 is an AppleUSBHostFrameworkInterfaceClient, and the interface reports busy = 1.
ioreg while the device is assigned to my app:
+-o UDisk@20231400 <class IOUSBHostDevice, registered, matched, active, busy 0>
+-o IOUSBHostInterface@0 <class IOUSBHostInterface, registered, matched, active, busy 0>
+-o yuVM@20231400 <class AppleUSBHostFrameworkDeviceClient, !registered, !matched, active>
So the device client from AAUSBAccessory.open() belongs to my process, but opening the interface is rejected with kIOReturnNotPermitted. I get the same result with the interfaces as delivered, after configureWithValue(1, matchInterfaces: false) and after configureWithValue(1, matchInterfaces: true), and also with IOUSBHostObjectInitOptionsDeviceSeize on the interface.
The app is sandboxed with com.apple.developer.accessory-access.usb and com.apple.security.device.usb; no sandbox denials are logged.
Is there an additional step or entitlement needed to open the interfaces of a device obtained through Accessory Access? Or should the interfaces be obtained some other way than creating IOUSBHostInterface from the child services of the device?
Topic:
App & System Services
SubTopic:
Hardware
Tags: