summaryrefslogtreecommitdiff
path: root/hid/src/main.cpp
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2021-04-22 03:21:06 +0300
committerDevaev Maxim <[email protected]>2021-04-22 03:21:06 +0300
commit4279ae5bc3ffbd4f645195c38fe5a60a1d28ec01 (patch)
tree4b690b657adc3d942c86e051fceafa237ef618d5 /hid/src/main.cpp
parente6ecbb2a9ca6de372ba8cb627c79636832595805 (diff)
improved mac uefi keys handling
Diffstat (limited to 'hid/src/main.cpp')
-rw-r--r--hid/src/main.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/hid/src/main.cpp b/hid/src/main.cpp
index 72ad60b8..118e0d4e 100644
--- a/hid/src/main.cpp
+++ b/hid/src/main.cpp
@@ -36,6 +36,7 @@
# include <avr/eeprom.h>
#endif
+#include "tools.h"
#include "proto.h"
#ifdef CMD_SPI
# include "spi.h"
@@ -337,6 +338,11 @@ int main() {
aumProxyUsbVbus();
# endif
+# ifdef HID_WITH_USB
+ if (_usb_kbd) {
+ _usb_kbd->periodic();
+ }
+# endif
# ifdef HID_WITH_PS2
if (_ps2_kbd) {
_ps2_kbd->periodic();
@@ -354,11 +360,7 @@ int main() {
++index;
}
} else if (index > 0) {
- unsigned long now = micros();
- if (
- (now >= last && now - last > CMD_SERIAL_TIMEOUT)
- || (now < last && ((unsigned long)-1) - last + now > CMD_SERIAL_TIMEOUT)
- ) {
+ if (is_micros_timed_out(last, CMD_SERIAL_TIMEOUT)) {
_sendResponse(PROTO::RESP::TIMEOUT_ERROR);
index = 0;
}