diff options
| author | Dan Halbert <halbert@halwitz.org> | 2018-11-09 23:35:22 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-09 23:35:22 -0500 |
| commit | 50f5d27c436cf71d14bf893709375e5bcf62717b (patch) | |
| tree | e44644757b48721a75d23b4794850124482f50c9 /supervisor/shared | |
| parent | 97bc95183d5114ce69c9387ebd2e2aa13feb65a7 (diff) | |
| parent | d012fd155338641f1d54d68d04410a848e07319d (diff) | |
Merge pull request #1325 from tannewt/fix_overruns
Fix output overflow and make help translatable
Diffstat (limited to 'supervisor/shared')
| -rw-r--r-- | supervisor/shared/serial.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/supervisor/shared/serial.c b/supervisor/shared/serial.c index 058c4a7a4..c57688ddc 100644 --- a/supervisor/shared/serial.c +++ b/supervisor/shared/serial.c @@ -47,10 +47,17 @@ bool serial_bytes_available(void) { return tud_cdc_available() > 0; } -void serial_write(const char* text) { - tud_cdc_write(text, strlen(text)); +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); + usb_background(); + } } -void serial_write_substring(const char* text, uint32_t length) { - tud_cdc_write(text, length); +void serial_write(const char* text) { + serial_write_substring(text, strlen(text)); } |
