diff options
author | Drashna Jaelre <[email protected]> | 2022-05-14 15:07:08 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2022-05-14 23:07:08 +0100 |
commit | db887e63d708925ad759e3504a6bc9ceef4aeb8f (patch) | |
tree | 7366242dc8834ff5ddb761ff162fa444bf64653f /quantum/secure.c | |
parent | baa8d07fdb32a35f9ff5020d655271b01e057ddc (diff) | |
download | qmk_firmware-db887e63d708925ad759e3504a6bc9ceef4aeb8f.tar.gz qmk_firmware-db887e63d708925ad759e3504a6bc9ceef4aeb8f.zip |
Enhancement and fixes of "Secure" feature (#16958)
Diffstat (limited to 'quantum/secure.c')
-rw-r--r-- | quantum/secure.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/quantum/secure.c b/quantum/secure.c index 00048bd6dd..f07f6af2cb 100644 --- a/quantum/secure.c +++ b/quantum/secure.c @@ -23,17 +23,24 @@ static secure_status_t secure_status = SECURE_LOCKED; static uint32_t unlock_time = 0; static uint32_t idle_time = 0; +static void secure_hook(secure_status_t secure_status) { + secure_hook_quantum(secure_status); + secure_hook_kb(secure_status); +} + secure_status_t secure_get_status(void) { return secure_status; } void secure_lock(void) { secure_status = SECURE_LOCKED; + secure_hook(secure_status); } void secure_unlock(void) { secure_status = SECURE_UNLOCKED; idle_time = timer_read32(); + secure_hook(secure_status); } void secure_request_unlock(void) { @@ -41,6 +48,7 @@ void secure_request_unlock(void) { secure_status = SECURE_PENDING; unlock_time = timer_read32(); } + secure_hook(secure_status); } void secure_activity_event(void) { @@ -85,3 +93,10 @@ void secure_task(void) { } #endif } + +__attribute__((weak)) bool secure_hook_user(secure_status_t secure_status) { + return true; +} +__attribute__((weak)) bool secure_hook_kb(secure_status_t secure_status) { + return secure_hook_user(secure_status); +} |