I'm using IOHIDDeviceRegisterInputReportCallback to listen to incoming reports while using a HID device. At the point I disconnect from the device (in software, not physically), I'd like to unregister this callback. However, I'm not seeing any methods to unhook my callback in Apple's docs. I'm sure I'm just missing something. Can anyone point me to the proper way to unhook from a device? If I'm not supposed to directly unhook my callback, what's the proper way to disconnect from my software from the HID device?
I'm doing this project in Swift, but an answer in Objective-C or C++ should be fine too.
Shortly after I asked this, I found the answer in Apple's documentation. They state:
Note: There is no function to unregister IOHID callback routines. They are unregistered by calling the register function and passing NULL for the pointer to the callback routine.
So, the answer is to pass a null/nil pointer to the callback registration function.