IOHIDDeviceSetReport blocks until the report is sent, and when you call it from the main thread in a situation where more than a couple bluetooth devices are connected (which is often, considering Apple's mice, keyboards and trackpads are all bluetooth) and the system can't keep up with the traffic the report rather frequently never makes it through, resulting in a hanged application and an unresponsive bluetooth HID device that will only respond after being disconnected and reconnected.
Is there any way around this situation? Ideally
- IOHIDDeviceSetReport would timeout
- An output report failing to get through would not make the HID device unresponsive
- IOHIDDeviceSetReportWithCallback would work, but it seems under the hood it has simply never been implemented
- There would be a way to set reports asynchronously
but it seems none of those are the case.
Does anyone have any light to shed on this matter? macOS12 here.