From 6dd03f42882b8de1483db79e30bf937bff781c49 Mon Sep 17 00:00:00 2001 From: zvecr Date: Fri, 6 Jun 2025 02:42:57 +0100 Subject: [PATCH] Add active driver callbacks --- tmk_core/protocol/host.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tmk_core/protocol/host.c b/tmk_core/protocol/host.c index 166bcbabea6..f4fa9064e03 100644 --- a/tmk_core/protocol/host.c +++ b/tmk_core/protocol/host.c @@ -82,12 +82,25 @@ host_driver_t *host_get_driver(void) { #ifdef CONNECTION_ENABLE static connection_host_t active_host = CONNECTION_HOST_NONE; +__attribute__((weak)) void host_disconnect_active_driver_user(connection_host_t host) {} +__attribute__((weak)) void host_disconnect_active_driver_kb(connection_host_t host) {} + +__attribute__((weak)) void host_connect_active_driver_user(connection_host_t host) {} +__attribute__((weak)) void host_connect_active_driver_kb(connection_host_t host) {} + +// TODO: Additionally have host_driver_t handle swap static void host_update_active_driver(connection_host_t current, connection_host_t next) { + host_disconnect_active_driver_user(current); + host_disconnect_active_driver_kb(current); + if (current != CONNECTION_HOST_NONE) { - // TODO: Additionally have host_driver_t handle swap clear_keyboard(); } + + host_connect_active_driver_user(next); + host_connect_active_driver_kb(next); } + #endif void host_init(void) {