summaryrefslogtreecommitdiff
path: root/tmk_core/protocol/chibios/usb_main.c
diff options
context:
space:
mode:
authorFlorian Didron <fd@librem.one>2019-11-05 19:02:07 +0900
committerFlorian Didron <fdidron@users.noreply.github.com>2019-12-06 08:20:51 +0900
commitf3edef8c69384d92c026c4ffbcc167464d045c03 (patch)
treeabae48d2dbbe0229902e88059ff87dd6f7f4b9f9 /tmk_core/protocol/chibios/usb_main.c
parent40e9813ba2620b9b11811f3a2e5d5879a60aee83 (diff)
feat: adds pairing key
Diffstat (limited to 'tmk_core/protocol/chibios/usb_main.c')
-rw-r--r--tmk_core/protocol/chibios/usb_main.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c
index e2440601e3..8a249e19e3 100644
--- a/tmk_core/protocol/chibios/usb_main.c
+++ b/tmk_core/protocol/chibios/usb_main.c
@@ -37,6 +37,9 @@
extern keymap_config_t keymap_config;
#endif
+#ifdef WEBUSB_ENABLE
+#include "webusb.h"
+#endif
/* ---------------------------------------------------------
* Global interface variables and declarations
* ---------------------------------------------------------
@@ -880,7 +883,12 @@ void webusb_task(void) {
do {
size_t size = chnReadTimeout(&drivers.webusb_driver.driver, buffer, sizeof(buffer), TIME_IMMEDIATE);
if (size > 0) {
- webusb_receive(buffer, size);
+ if(webusb_state.paired == true) {
+ webusb_receive(buffer, size);
+ }
+ else {
+ webusb_error(WEBUSB_STATUS_NOT_PAIRED);
+ }
}
} while (size > 0);
}