mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-02-01 02:21:53 +08:00
improved mac boot keys handling
This commit is contained in:
@@ -76,11 +76,15 @@ class UsbKeyboard {
|
|||||||
|
|
||||||
void periodic() {
|
void periodic() {
|
||||||
# ifdef HID_USB_CHECK_ENDPOINT
|
# ifdef HID_USB_CHECK_ENDPOINT
|
||||||
if (is_micros_timed_out(_last, 10000)) {
|
static unsigned long prev_ts = 0;
|
||||||
if (!_sent) {
|
if (is_micros_timed_out(prev_ts, 10000)) {
|
||||||
|
static bool prev_online = true;
|
||||||
|
bool online = !getOfflineAs(1);
|
||||||
|
if (!_sent || (online && !prev_online)) {
|
||||||
_sendCurrent();
|
_sendCurrent();
|
||||||
}
|
}
|
||||||
_last = micros();
|
prev_online = online;
|
||||||
|
prev_ts = micros();
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
@@ -112,7 +116,6 @@ class UsbKeyboard {
|
|||||||
private:
|
private:
|
||||||
BootKeyboard_ _kbd;
|
BootKeyboard_ _kbd;
|
||||||
bool _sent = true;
|
bool _sent = true;
|
||||||
unsigned long _last = 0;
|
|
||||||
|
|
||||||
void _sendCurrent() {
|
void _sendCurrent() {
|
||||||
# ifdef HID_USB_CHECK_ENDPOINT
|
# ifdef HID_USB_CHECK_ENDPOINT
|
||||||
|
|||||||
Reference in New Issue
Block a user