From f1588c35b0ace68afb2a33dd841ad345b8dceab3 Mon Sep 17 00:00:00 2001 From: Joshua Rubin Date: Sun, 24 May 2020 02:15:40 -0600 Subject: [PATCH] fix magic_key_lock with bluetooth Signed-off-by: Joshua Rubin --- drivers/bluetooth/bluetooth_classic.c | 9 +-------- tmk_core/common/host.c | 9 ++++++--- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/bluetooth/bluetooth_classic.c b/drivers/bluetooth/bluetooth_classic.c index 8e779c893f77..befadc527e45 100644 --- a/drivers/bluetooth/bluetooth_classic.c +++ b/drivers/bluetooth/bluetooth_classic.c @@ -43,14 +43,7 @@ along with this program. If not, see . #define CONSUMER2RN42(usage) (usage == AUDIO_MUTE ? 0x0040 : (usage == AUDIO_VOL_UP ? 0x0010 : (usage == AUDIO_VOL_DOWN ? 0x0020 : (usage == TRANSPORT_NEXT_TRACK ? 0x0100 : (usage == TRANSPORT_PREV_TRACK ? 0x0200 : (usage == TRANSPORT_STOP ? 0x0400 : (usage == TRANSPORT_STOP_EJECT ? 0x0800 : (usage == TRANSPORT_PLAY_PAUSE ? 0x0080 : (usage == AL_EMAIL ? 0x0200 : (usage == AL_LOCAL_BROWSER ? 0x8000 : (usage == AC_SEARCH ? 0x0400 : (usage == AC_HOME ? 0x0100 : 0)))))))))))) -static struct { bool initialized; } state; - -void bluetooth_task() { - if (!state.initialized) { - serial_init(); - state.initialized = true; - } -} +void bluetooth_init() { serial_init(); } void bluetooth_send_keyboard(report_keyboard_t *report) { #ifdef MODULE_RN42 diff --git a/tmk_core/common/host.c b/tmk_core/common/host.c index 62f23c76a6c7..f7b785129aa4 100644 --- a/tmk_core/common/host.c +++ b/tmk_core/common/host.c @@ -66,6 +66,8 @@ void host_keyboard_send(report_keyboard_t *report) { #endif } + if (!driver) return; + #ifdef BLUETOOTH_ENABLE uint8_t where = where_to_send(); @@ -78,7 +80,6 @@ void host_keyboard_send(report_keyboard_t *report) { } #endif - if (!driver) return; (*driver->send_keyboard)(report); if (debug_keyboard) { @@ -95,6 +96,8 @@ void host_mouse_send(report_mouse_t *report) { report->report_id = REPORT_ID_MOUSE; #endif + if (!driver) return; + #if defined(BLUETOOTH_ENABLE) && defined(MOUSE_ENABLE) uint8_t where = where_to_send(); @@ -107,7 +110,6 @@ void host_mouse_send(report_mouse_t *report) { } #endif - if (!driver) return; (*driver->send_mouse)(report); } @@ -123,6 +125,8 @@ void host_consumer_send(uint16_t report) { if (report == last_consumer_report) return; last_consumer_report = report; + if (!driver) return; + #ifdef BLUETOOTH_ENABLE uint8_t where = where_to_send(); @@ -135,7 +139,6 @@ void host_consumer_send(uint16_t report) { } #endif - if (!driver) return; (*driver->send_consumer)(report); }