Send out the mouse report continuously if the report is not zeros

This commit is contained in:
Kristian Sloth Lauszus
2018-06-07 01:56:16 +02:00
parent 53a82a5f57
commit 1a0da7971a

View File

@@ -33,6 +33,13 @@ usb_status_t UsbMouseCallback(class_handle_t handle, uint32_t event, void *param
switch (event) {
case kUSB_DeviceHidEventSendResponse:
if (UsbCompositeDevice.attach) {
// Send out the mouse report continuously if the report is not zeros
usb_mouse_report_t *mouseReport = getInactiveUsbMouseReport();
uint8_t zeroBuf[sizeof(usb_mouse_report_t)] = { 0 };
if (memcmp(mouseReport, zeroBuf, sizeof(usb_mouse_report_t)) != 0)
return usbMouseAction();
}
case kUSB_DeviceHidEventGetReport:
case kUSB_DeviceHidEventSetReport:
case kUSB_DeviceHidEventRequestReportBuffer: