Skip to content

Commit

Permalink
LUFA: make send_report a boolean (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
drashna authored Jul 5, 2024
1 parent 0754cff commit d03c020
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion keyboards/zsa/common/oryx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 5 additions & 4 deletions tmk_core/protocol/lufa/lufa.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,22 @@ 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);

/* Check if write ready for a polling interval around 10ms */
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
Expand Down

0 comments on commit d03c020

Please sign in to comment.