From d012fd155338641f1d54d68d04410a848e07319d Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 9 Nov 2018 17:06:55 -0800 Subject: [PATCH] Only write to usb when its around. --- supervisor/shared/serial.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/supervisor/shared/serial.c b/supervisor/shared/serial.c index cd20b5c26e..c57688ddcf 100644 --- a/supervisor/shared/serial.c +++ b/supervisor/shared/serial.c @@ -48,6 +48,9 @@ bool serial_bytes_available(void) { } void serial_write_substring(const char* text, uint32_t length) { + if (!tud_cdc_connected()) { + return; + } uint32_t count = 0; while (count < length) { count += tud_cdc_write(text + count, length - count);