DEBUG: Working BIOS hotkeys

Works from cold boot and from reboot in windows.

Signed-off-by: Daniel Schaefer <dhs@frame.work>
This commit is contained in:
Daniel Schaefer
2023-11-27 12:55:38 +08:00
parent 324b8d7736
commit c6ba5ad0a2
8 changed files with 132 additions and 19 deletions

View File

@@ -384,19 +384,20 @@ void quantum_init(void) {
backlight_init_ports();
#endif
#ifdef AUDIO_ENABLE
audio_init();
audio_init()
#endif
#ifdef LED_MATRIX_ENABLE
led_matrix_init();
led_matrix_init()
#endif
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_init();
// Here
//rgb_matrix_init();
#endif
#if defined(UNICODE_COMMON_ENABLE)
unicode_input_mode_init();
unicode_input_mode_init()
#endif
#ifdef HAPTIC_ENABLE
haptic_init();
haptic_init()
#endif
}
@@ -408,13 +409,13 @@ void keyboard_init(void) {
timer_init();
sync_timer_init();
#ifdef VIA_ENABLE
via_init();
//via_init();
#endif
#ifdef SPLIT_KEYBOARD
split_pre_init();
split_pre_init()
#endif
#ifdef ENCODER_ENABLE
encoder_init();
encoder_init()
#endif
matrix_init();
quantum_init();
@@ -428,39 +429,39 @@ void keyboard_init(void) {
st7565_init(DISPLAY_ROTATION_0);
#endif
#ifdef PS2_MOUSE_ENABLE
ps2_mouse_init();
ps2_mouse_init()
#endif
#ifdef BACKLIGHT_ENABLE
backlight_init();
#endif
#ifdef RGBLIGHT_ENABLE
rgblight_init();
rgblight_init()
#endif
#ifdef STENO_ENABLE_ALL
steno_init();
steno_init()
#endif
#if defined(NKRO_ENABLE) && defined(FORCE_NKRO)
keymap_config.nkro = 1;
eeconfig_update_keymap(keymap_config.raw);
#endif
#ifdef DIP_SWITCH_ENABLE
dip_switch_init();
dip_switch_init()
#endif
#ifdef SLEEP_LED_ENABLE
sleep_led_init();
sleep_led_init()
#endif
#ifdef VIRTSER_ENABLE
virtser_init();
#endif
#ifdef SPLIT_KEYBOARD
split_post_init();
split_post_init()
#endif
#ifdef POINTING_DEVICE_ENABLE
// init after split init
pointing_device_init();
#endif
#ifdef BLUETOOTH_ENABLE
bluetooth_init();
bluetooth_init()
#endif
#if defined(DEBUG_MATRIX_SCAN_RATE) && defined(CONSOLE_ENABLE)

View File

@@ -35,6 +35,7 @@ struct setups_data_t {
uint8_t cnt_02;
uint8_t cnt_04;
uint8_t cnt_ff;
uint8_t cnt_zoid;
uint16_t last_wlength;
};
@@ -43,20 +44,30 @@ struct setups_data_t setups_data = {
.cnt_02 = 0,
.cnt_04 = 0,
.cnt_ff = 0,
.cnt_zoid = 0,
};
os_variant_t detected_os = OS_UNSURE;
// Some collected sequences of wLength can be found in tests.
void make_guess(void) {
if (setups_data.count < 3) {
//if (setups_data.count < 3 && setups_data.cnt_zoid != 0) {
// return;
//}
//if (setups_data.cnt_zoid == 0) {
// detected_os = OS_UEFI;
// return;
//}
if (setups_data.cnt_zoid == 0) {
detected_os = OS_UEFI;
return;
}
if (setups_data.cnt_ff >= 2 && setups_data.cnt_04 >= 1) {
detected_os = OS_WINDOWS;
return;
}
if (setups_data.count == setups_data.cnt_ff) {
// I changed this
if (setups_data.count > 3 && setups_data.count == setups_data.cnt_ff) {
// Linux has 3 packets with 0xFF.
detected_os = OS_LINUX;
return;
@@ -80,6 +91,15 @@ void make_guess(void) {
detected_os = OS_LINUX;
return;
}
if (setups_data.cnt_zoid == 0) {
detected_os = OS_UEFI;
return;
}
}
void process_zoid(const uint16_t zoid) {
setups_data.cnt_zoid = zoid;
make_guess();
}
void process_wlength(const uint16_t w_length) {
@@ -99,6 +119,7 @@ void process_wlength(const uint16_t w_length) {
}
os_variant_t detected_host_os(void) {
make_guess();
return detected_os;
}

View File

@@ -25,8 +25,10 @@ typedef enum {
OS_WINDOWS,
OS_MACOS,
OS_IOS,
OS_UEFI,
} os_variant_t;
void process_zoid(const uint16_t zoid);
void process_wlength(const uint16_t w_length);
os_variant_t detected_host_os(void);
void erase_wlength_data(void);