Only set the semaphore if the report is successfully requested
This commit is contained in:
@@ -407,6 +407,8 @@ uint32_t UsbReportUpdateCounter;
|
|||||||
|
|
||||||
void UpdateUsbReports(void)
|
void UpdateUsbReports(void)
|
||||||
{
|
{
|
||||||
|
usb_status_t status;
|
||||||
|
|
||||||
if (UsbReportUpdateSemaphore) {
|
if (UsbReportUpdateSemaphore) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -430,24 +432,32 @@ void UpdateUsbReports(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (HasUsbBasicKeyboardReportChanged) {
|
if (HasUsbBasicKeyboardReportChanged) {
|
||||||
UsbReportUpdateSemaphore |= 1 << USB_BASIC_KEYBOARD_INTERFACE_INDEX;
|
status = UsbBasicKeyboardAction();
|
||||||
UsbBasicKeyboardAction();
|
if (status == kStatus_USB_Success) {
|
||||||
|
UsbReportUpdateSemaphore |= 1 << USB_BASIC_KEYBOARD_INTERFACE_INDEX;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasUsbMediaKeyboardReportChanged) {
|
if (HasUsbMediaKeyboardReportChanged) {
|
||||||
UsbReportUpdateSemaphore |= 1 << USB_MEDIA_KEYBOARD_INTERFACE_INDEX;
|
status = UsbMediaKeyboardAction();
|
||||||
UsbMediaKeyboardAction();
|
if (status == kStatus_USB_Success) {
|
||||||
|
UsbReportUpdateSemaphore |= 1 << USB_MEDIA_KEYBOARD_INTERFACE_INDEX;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasUsbSystemKeyboardReportChanged) {
|
if (HasUsbSystemKeyboardReportChanged) {
|
||||||
UsbReportUpdateSemaphore |= 1 << USB_SYSTEM_KEYBOARD_INTERFACE_INDEX;
|
status = UsbSystemKeyboardAction();
|
||||||
UsbSystemKeyboardAction();
|
if (status == kStatus_USB_Success) {
|
||||||
|
UsbReportUpdateSemaphore |= 1 << USB_SYSTEM_KEYBOARD_INTERFACE_INDEX;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send out the mouse position and wheel values continuously if the report is not zeros, but only send the mouse button states when they change.
|
// Send out the mouse position and wheel values continuously if the report is not zeros, but only send the mouse button states when they change.
|
||||||
if (HasUsbMouseReportChanged || ActiveUsbMouseReport->x || ActiveUsbMouseReport->y ||
|
if (HasUsbMouseReportChanged || ActiveUsbMouseReport->x || ActiveUsbMouseReport->y ||
|
||||||
ActiveUsbMouseReport->wheelX || ActiveUsbMouseReport->wheelY) {
|
ActiveUsbMouseReport->wheelX || ActiveUsbMouseReport->wheelY) {
|
||||||
UsbReportUpdateSemaphore |= 1 << USB_MOUSE_INTERFACE_INDEX;
|
status = UsbMouseAction();
|
||||||
UsbMouseAction();
|
if (status == kStatus_USB_Success) {
|
||||||
|
UsbReportUpdateSemaphore |= 1 << USB_MOUSE_INTERFACE_INDEX;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user