Home > Enterprise >  IOHIDManagerOpen returns error code -536870201
IOHIDManagerOpen returns error code -536870201

Time:07-02

I am new to USB usage in my application on Mac. When I log the result of IOHIDManagerOpen(x,y) function call on my application I get error code -536870201. I have found in the following post (Keystrokes are not blocked when using kIOHIDOptionsTypeSeizeDevice and are still passed to the OS) that -536870207 is translated to kIOReturnNotPrivileged. How can I translate my error code and understand the cause of an error?

CodePudding user response:

For IOKit return values (IOReturn) it's typically much more helpful to print them as hexadecimal, ("0x%x") as that's how the constants are defined in <IOKit/IOReturn.h>.

So for example, -536870201 is represented in hexadecimal as 0xE00002C7. The 0xE0000000 part means it's an IOKit constant, the last few digits of 2C7 identify it as kIOReturnUnsupported.

You haven't posted any code or other details about the run-up or arguments to your IOHIDManagerOpen() call, so I can't really say why it should return kIOReturnUnsupported without more details.

Incidentally, I maintain a small library of IOKit helper utilities, and one of those things is a function djt_ioreturn_string which converts IOReturn values into string representations of those constants. (You just need to include the ioreturn_strings.cpp and ioreturn_strings.h files in your project, the ioreturn_strings.h can be #include/#imported from pure C or Objective-C, just the .cpp uses C .)

  • Related