summaryrefslogtreecommitdiff
path: root/tmk_core/protocol/chibios
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/protocol/chibios')
-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);
}