From ada69909dcf52154958aead4050115f7a5f05e28 Mon Sep 17 00:00:00 2001 From: Drashna Jael're Date: Thu, 4 Jul 2024 23:07:49 -0700 Subject: [PATCH] LUFA: make send_report a boolean --- keyboards/zsa/common/oryx.c | 3 ++- tmk_core/protocol/lufa/lufa.c | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/keyboards/zsa/common/oryx.c b/keyboards/zsa/common/oryx.c index 8d3e2d8ad2d9..8b57c20bc2a3 100644 --- a/keyboards/zsa/common/oryx.c +++ b/keyboards/zsa/common/oryx.c @@ -16,7 +16,8 @@ rawhid_state_t rawhid_state = { uint8_t pairing_input_index = 0; #if defined(PROTOCOL_LUFA) -void send_report(uint8_t endpoint, void *report, size_t size); +bool send_report(uint8_t endpoint, void *report, size_t size); +#include "usb_descriptor.h" # define RAW_EP_NAME RAW_IN_EPNUM #elif defined(PROTOCOL_CHIBIOS) # include "usb_endpoints.h" diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 2142b04460a1..81827e329599 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -87,10 +87,10 @@ static void send_mouse(report_mouse_t *report); static void send_extra(report_extra_t *report); host_driver_t lufa_driver = {keyboard_leds, send_keyboard, send_nkro, send_mouse, send_extra}; -void send_report(uint8_t endpoint, void *report, size_t size) { +bool send_report(uint8_t endpoint, void *report, size_t size) { uint8_t timeout = 255; - if (USB_DeviceState != DEVICE_STATE_Configured) return; + if (USB_DeviceState != DEVICE_STATE_Configured) return false; Endpoint_SelectEndpoint(endpoint); @@ -98,10 +98,11 @@ void send_report(uint8_t endpoint, void *report, size_t size) { while (timeout-- && !Endpoint_IsReadWriteAllowed()) { _delay_us(40); } - if (!Endpoint_IsReadWriteAllowed()) return; + if (!Endpoint_IsReadWriteAllowed()) return false; - Endpoint_Write_Stream_LE(report, size, NULL); + uint8_t report_status = Endpoint_Write_Stream_LE(report, size, NULL); Endpoint_ClearIN(); + return (bool)report_status; } #ifdef VIRTSER_ENABLE