summaryrefslogtreecommitdiff
path: root/tmk_core/protocol/lufa/lufa.c
diff options
context:
space:
mode:
authorFlorian Didron <fd@librem.one>2019-12-04 16:51:52 +0900
committerFlorian Didron <fdidron@users.noreply.github.com>2019-12-06 08:20:51 +0900
commit4a8aa15634209f7f0360f6f04c24a162bac8f450 (patch)
tree0eca4eb40f473dea27d9e21ceb525eda88953baf /tmk_core/protocol/lufa/lufa.c
parent54d6f5d4c50af2ea09a103825040e739d7acd58b (diff)
fix: lufa handle disconnections gracefully
Diffstat (limited to 'tmk_core/protocol/lufa/lufa.c')
-rw-r--r--tmk_core/protocol/lufa/lufa.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c
index 660633fd12..a6ac44c597 100644
--- a/tmk_core/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
@@ -280,7 +280,11 @@ void webusb_send(uint8_t *data, uint8_t length) {
Endpoint_SelectEndpoint(WEBUSB_IN_EPNUM);
- Endpoint_Write_Stream_LE(data, length, NULL);
+ if(Endpoint_Write_Stream_LE(data, length, NULL)) {
+ // Stream failed to complete, resetting WEBUSB's state
+ webusb_state.paired = false;
+ webusb_state.pairing = false;
+ }
Endpoint_ClearIN();
}