mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-02-23 23:37:46 +00:00
secure keycodes?
This commit is contained in:
parent
2563e7b2a0
commit
b0b6594ded
@ -3,8 +3,9 @@
|
||||
|
||||
#include "secure.h"
|
||||
#include "process_secure.h"
|
||||
#include "quantum_keycodes.h"
|
||||
|
||||
bool process_secure(uint16_t keycode, keyrecord_t *record) {
|
||||
bool preprocess_secure(uint16_t keycode, keyrecord_t *record) {
|
||||
if (secure_is_unlocking()) {
|
||||
if (!record->event.pressed) {
|
||||
secure_keypress_event(record->event.key.row, record->event.key.col);
|
||||
@ -16,3 +17,23 @@ bool process_secure(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool process_secure(uint16_t keycode, keyrecord_t *record) {
|
||||
#ifndef SECURE_DISABLE_KEYCODES
|
||||
if (!record->event.pressed) {
|
||||
if (keycode == SECURE_LOCK) {
|
||||
secure_lock();
|
||||
return false;
|
||||
}
|
||||
if (keycode == SECURE_UNLOCK) {
|
||||
secure_lock();
|
||||
return false;
|
||||
}
|
||||
if (keycode == SECURE_TOGGLE) {
|
||||
secure_is_locked() ? secure_unlock() : secure_lock();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
@ -6,4 +6,6 @@
|
||||
#include <stdbool.h>
|
||||
#include "action.h"
|
||||
|
||||
bool preprocess_secure(uint16_t keycode, keyrecord_t *record);
|
||||
|
||||
bool process_secure(uint16_t keycode, keyrecord_t *record);
|
||||
|
@ -212,6 +212,12 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
#if defined(SECURE_ENABLE)
|
||||
if (!preprocess_secure(keycode, record)) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VELOCIKEY_ENABLE
|
||||
if (velocikey_enabled() && record->event.pressed) {
|
||||
velocikey_accelerate();
|
||||
@ -246,10 +252,10 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||
#if defined(VIA_ENABLE)
|
||||
process_record_via(keycode, record) &&
|
||||
#endif
|
||||
process_record_kb(keycode, record) &&
|
||||
#if defined(SECURE_ENABLE)
|
||||
process_secure(keycode, record) &&
|
||||
#endif
|
||||
process_record_kb(keycode, record) &&
|
||||
#if defined(SEQUENCER_ENABLE)
|
||||
process_sequencer(keycode, record) &&
|
||||
#endif
|
||||
|
@ -597,6 +597,10 @@ enum quantum_keycodes {
|
||||
|
||||
QK_MAKE,
|
||||
|
||||
SECURE_LOCK,
|
||||
SECURE_UNLOCK,
|
||||
SECURE_TOGGLE,
|
||||
|
||||
// Start of custom keycode range for keyboards and keymaps - always leave at the end
|
||||
SAFE_RANGE
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user