summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tmk_core/protocol/chibios/usb_main.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c
index 57b9d74d38..0acb78c9ad 100644
--- a/tmk_core/protocol/chibios/usb_main.c
+++ b/tmk_core/protocol/chibios/usb_main.c
@@ -869,7 +869,12 @@ void raw_hid_task(void) {
#endif
#ifdef WEBUSB_ENABLE
-void webusb_send(uint8_t *data, uint8_t length) { chnWrite(&drivers.webusb_driver.driver, data, length); }
+void webusb_send(uint8_t *data, uint8_t length) {
+ if(chnWriteTimeout(&drivers.webusb_driver.driver, data, length, TIME_IMMEDIATE) != length){
+ webusb_state.paired = false;
+ webusb_state.pairing = false;
+ }
+}
__attribute__((weak)) void webusb_receive_kb(uint8_t *data, uint8_t length) {
// Users should #include "raw_hid.h" in their own code