From 05ddbc6b6a589e5275acb86fb113c97fe2370da9 Mon Sep 17 00:00:00 2001 From: Florian Didron Date: Wed, 4 Dec 2019 16:51:52 +0900 Subject: fix: lufa handle disconnections gracefully --- tmk_core/protocol/lufa/lufa.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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(); } -- cgit v1.2.3