From 09d668eb0ed3ff6fa48ce1db98910b022bca2d90 Mon Sep 17 00:00:00 2001 From: Ryan Date: Sat, 3 Sep 2022 05:38:27 +1000 Subject: Simplify extrakeys sending at the host driver level (#18230) * Simplify extrakeys sending at the host driver level * There are two arguments here * Wrong syntax * Adjust keyboards which use a custom host driver --- tmk_core/protocol/lufa/lufa.c | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) (limited to 'tmk_core/protocol/lufa/lufa.c') diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index b4b03357a3..5c1a9b600e 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -101,10 +101,9 @@ static report_keyboard_t keyboard_report_sent; static uint8_t keyboard_leds(void); static void send_keyboard(report_keyboard_t *report); static void send_mouse(report_mouse_t *report); -static void send_system(uint16_t data); -static void send_consumer(uint16_t data); +static void send_extra(uint8_t report_id, uint16_t data); static void send_programmable_button(uint32_t data); -host_driver_t lufa_driver = {keyboard_leds, send_keyboard, send_mouse, send_system, send_consumer, send_programmable_button}; +host_driver_t lufa_driver = {keyboard_leds, send_keyboard, send_mouse, send_extra, send_programmable_button}; #ifdef VIRTSER_ENABLE // clang-format off @@ -748,30 +747,8 @@ static void send_report(void *report, size_t size) { */ #ifdef EXTRAKEY_ENABLE static void send_extra(uint8_t report_id, uint16_t data) { - static report_extra_t r; - r = (report_extra_t){.report_id = report_id, .usage = data}; - send_report(&r, sizeof(r)); -} -#endif - -/** \brief Send System - * - * FIXME: Needs doc - */ -static void send_system(uint16_t data) { -#ifdef EXTRAKEY_ENABLE - send_extra(REPORT_ID_SYSTEM, data); -#endif -} - -/** \brief Send Consumer - * - * FIXME: Needs doc - */ -static void send_consumer(uint16_t data) { -#ifdef EXTRAKEY_ENABLE # ifdef BLUETOOTH_ENABLE - if (where_to_send() == OUTPUT_BLUETOOTH) { + if (report_id == REPORT_ID_CONSUMER && where_to_send() == OUTPUT_BLUETOOTH) { # ifdef BLUETOOTH_BLUEFRUIT_LE bluefruit_le_send_consumer_key(data); # elif BLUETOOTH_RN42 @@ -781,9 +758,11 @@ static void send_consumer(uint16_t data) { } # endif - send_extra(REPORT_ID_CONSUMER, data); -#endif + static report_extra_t r; + r = (report_extra_t){.report_id = report_id, .usage = data}; + send_report(&r, sizeof(r)); } +#endif static void send_programmable_button(uint32_t data) { #ifdef PROGRAMMABLE_BUTTON_ENABLE -- cgit v1.2.3