summaryrefslogtreecommitdiff
path: root/supervisor
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2019-04-04 18:58:35 -0400
committerDan Halbert <halbert@halwitz.org>2019-04-04 18:58:35 -0400
commite5e9d2ba473deadb7d1b076c043775befb70ae6b (patch)
tree078b5ea467e695dda78ba3fd2b73450e07b48c22 /supervisor
parent9d43a25d6e9336646aa8cf62cad6ae53f232d324 (diff)
@hathach's changes; check cdc connected during string write
Diffstat (limited to 'supervisor')
-rw-r--r--supervisor/shared/serial.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/supervisor/shared/serial.c b/supervisor/shared/serial.c
index ed210416f..a61899576 100644
--- a/supervisor/shared/serial.c
+++ b/supervisor/shared/serial.c
@@ -52,15 +52,13 @@ bool serial_bytes_available(void) {
}
void serial_write_substring(const char* text, uint32_t length) {
- #if CIRCUITPY_DISPLAYIO
+#if CIRCUITPY_DISPLAYIO
int errcode;
common_hal_terminalio_terminal_write(&supervisor_terminal, (const uint8_t*) text, length, &errcode);
- #endif
- if (!tud_cdc_connected()) {
- return;
- }
+#endif
+
uint32_t count = 0;
- while (count < length) {
+ while (count < length && tud_cdc_connected()) {
count += tud_cdc_write(text + count, length - count);
usb_background();
}