fl16: Keep keyboard out of suspend at least 30s
With selective suspend windows likes to suspend the keyboard very eagerly after 5 seconds without activity. So we send keyboard reports every second for 25 seconds to keep it awake. Signed-off-by: Daniel Schaefer <dhs@frame.work>
This commit is contained in:
parent
daa14d08fd
commit
f449ecc074
@ -313,6 +313,9 @@ bool handle_idle(void) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint16_t keepalive_timer = 0;
|
||||||
|
static uint16_t keepalive_count = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overriding behavior of matrix_scan from quantum/matrix.c
|
* Overriding behavior of matrix_scan from quantum/matrix.c
|
||||||
*/
|
*/
|
||||||
@ -381,7 +384,23 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return changed;
|
if (changed) {
|
||||||
|
keepalive_timer = timer_read();
|
||||||
|
keepalive_count = 25;
|
||||||
|
} else {
|
||||||
|
// Measure how many seconds have passed
|
||||||
|
if (keepalive_count > 0 && TIMER_DIFF_16(timer_read(), keepalive_timer) >= 1000) {
|
||||||
|
keepalive_timer = timer_read();
|
||||||
|
keepalive_count -= 1;
|
||||||
|
|
||||||
|
// Print to the console to cause bus activity,
|
||||||
|
// preventing the driver from suspending the device
|
||||||
|
uprintf("Keepalive: %d\n", keepalive_count);
|
||||||
|
send_keyboard_report();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
//bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
//bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
Loading…
Reference in New Issue
Block a user