Callback set by IOHIDDeviceRegisterRemovalCallback not being called in 10.15

Since upgrading to Catalina (10.15) we are finding that the callback set by


"IOHIDDeviceRegisterRemovalCallback(inIOHIDDeviceRef, DeviceRemoved, this); "


is not being called when the USB HID device is removed. The same build of software works on 10.14 and older (I've tested back to Yosemite). The above call is made in the callback set by IOHIDManagerRegisterDeviceMatchingCallback, so some callbacks are still working.


Has anyone else seen this?




Replies

I have a similar issue but with the "IOHIDDeviceRegisterInputReportCallback". I've check

with an USB analyzer the packets are correctly transmitted to the mac but the callback

is never called. The same code work on all previous versions of macOS...


Did someone have any idea why ?

Yes!


The SDL2 joystick library on Catalina crashes if you unplug a gamepad.

I just found that the system doesn't receive notification that the device has been used, and keeps using the handle, which causes a crash.

After some playing around, it seems that you can use IOHIDManagerRegisterDeviceRemovalCallback.

It is still working properly on macOS 10.15.

I also just ran into this problem while upgrading our code from using the old IOUSBInterface class to using IOHIDManager. Does anyone know the cause or a fix? I have had to go back to my original code for now.

I also found that Catalina is very sensitive to the report size. I had to set my report size to 65 bytes in the setReport call on Catalina whereas we were getting away with using 128 bytes on earlier MacOS versions.