iPad App with custom HID over USB

Hello, I need to develop an application for a customer who is using an iPad. This application needs to read from and send data to a custom HID device connected via USB-C.

Using USBDriverKit, the HID device can be detected when plugged into the iPad. However, when trying to open the device with the following code:

ivars->interface = OSDynamicCast(IOUSBHostInterface, provider); ret = ivars->interface->Open(this, 0, NULL);

It only returns e00002cd.

I would like to ask if it is possible to access a custom HID device on iPadOS using USBDriverkit?

Any help would be greatly appreciated!!

Hello, I need to develop an application for a customer who is using an iPad.

The first thing to do here is shift development back/over to the Mac and don't worry about the iPad until you've gotten it working there. I did an extended write-up about this here, but the particular issue here is that you're trying to understand system-level behavior without ANY of the tools that would actually let you see what the system was doing.

Next:

It only returns E00002CD.

This post describes the error code format IOKit is using, but this error is kIOReturnNotOpen, which basically (unhelpfully) just means "open failed".

I would like to ask if it is possible to access a custom HID device on iPadOS using USBDriverkit?

Yes, with a few qualifications:

  1. You'll need to send raw USB commands, which can be somewhat annoying.

  2. Depending on when the device is attached, your DEXT may not load at all, so there may be cases where a hotplug is required to claim the device.

  3. You have to match at the device level, not the interface. If you match at the interface level, you end up loading "beside" the HID driver instead of underneath it. That will then cause you to open to fail (because the HID driver already had it open).

  4. Hardware is weird and unpredictable. While it's fully possible to do what you're trying to do, I'm also sure there is at least one accessory in the world where it won't work for reasons I won't try to predict or speculate on.

Note that #3 is what's probably going wrong here and is a perfect example of why you need to start on macOS, as IORegistryExplorer will let you see exactly what's going on. I'll also note that if you wrote into DTS asking for help on this, the first thing I'd ask for is an IORegistryExplorer snapshot from macOS... so I could see what was actually going on.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

iPad App with custom HID over USB
 
 
Q