Skip to content

Commit

Permalink
fix magic_key_lock with bluetooth
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Rubin <[email protected]>
  • Loading branch information
joshuarubin committed Aug 10, 2020
1 parent a1c088b commit f1588c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
9 changes: 1 addition & 8 deletions drivers/bluetooth/bluetooth_classic.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

#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
Expand Down
9 changes: 6 additions & 3 deletions tmk_core/common/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -78,7 +80,6 @@ void host_keyboard_send(report_keyboard_t *report) {
}
#endif

if (!driver) return;
(*driver->send_keyboard)(report);

if (debug_keyboard) {
Expand All @@ -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();

Expand All @@ -107,7 +110,6 @@ void host_mouse_send(report_mouse_t *report) {
}
#endif

if (!driver) return;
(*driver->send_mouse)(report);
}

Expand All @@ -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();

Expand All @@ -135,7 +139,6 @@ void host_consumer_send(uint16_t report) {
}
#endif

if (!driver) return;
(*driver->send_consumer)(report);
}

Expand Down

0 comments on commit f1588c3

Please sign in to comment.