IOServiceOpen Keeps Returning kIOReturnUnsupported

I have a custom HID device that works on Windows totally fine with the default HID driver. The HID device knows how to accept string commands to control it and respond accordingly. I am trying to control it on Mac using IOKit.

I am able to get the io_service_t reference to the IOHIDInterface for the device from the I/ORegistery. I use this to instantiate a class to represent the device. But when I try to establish a connection to the service, I keep getting -536870201 which corresponds to kIOReturnUnsupported. I'm not entirely sure what I am doing wrong here and I wasn't able to find anything online that could really help.

Replies

You can not open a user client for an IOHIDInterface. You should instead locate the io_service_t for the IOHIDDevice service (the provider of the IOHIDInterface) and open a user client on it. For HID devices, our recommendation is to use the IOHIDDevice APIs rather than the lower level IOKit userspace primitives (like IOServiceOpen).

  • UPDATE: I was able to control my custom HID device using IOHIDManager, but thank you for the help!

Add a Comment