My application does the following cycle:
Collect devices from IOHIDManagerRef using the IOHIDManagerRegisterDeviceMatchingCallback
IOHIDDeviceOpen for the received IOHIDDeviceRef
IOHIDDeviceRegisterInputReportCallback for the received IOHIDDeviceRef
IOHIDDeviceClose for the received IOHIDDeviceRef
IOHIDDeviceOpen for the received IOHIDDeviceRef
IOHIDDeviceRegisterInputReportCallback for the received IOHIDDeviceRef
I delete the "context" that I pass to the IOHIDDeviceRegisterInputReportCallback after the device closing.
In this situation I observe that the registered call back is called on the delete callback.
Does anyone have clue why the call back remains registered even after the device closing?
I also tried to "unrgister" the callback manually using this trick:
IOHIDDeviceRegisterInputReportCallback(dev, orig_buff_ptr, orig_buff_size, nullptr, orig_ctx);
This doesn't help as well. I checked https://github.com/aosm/IOKitUser/blob/master/hid.subproj/IOHIDDevice.c already and it seems the IOHIDDeviceClose call should be enough to rid of the staling call back records.
Thank you in advance!
3
1
78