Skip to content

Commit 7bb5773

Browse files
committed
revert PR 7100 restoring the ability to read the buffer when no serial client is connected
the original issue if fixed in tinyusb
1 parent a0b482c commit 7bb5773

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

shared-module/usb_cdc/Serial.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ size_t common_hal_usb_cdc_serial_read(usb_cdc_serial_obj_t *self, uint8_t *data,
1919
// Read up to len bytes immediately.
2020
// The number of bytes read will not be larger than what is already in the TinyUSB FIFO.
2121
uint32_t total_num_read = 0;
22-
if (tud_cdc_n_connected(self->idx)) {
23-
total_num_read = tud_cdc_n_read(self->idx, data, len);
24-
}
22+
total_num_read = tud_cdc_n_read(self->idx, data, len);
2523

2624
if (wait_forever || wait_for_timeout) {
2725
// Continue filling the buffer past what we already read.
@@ -48,9 +46,7 @@ size_t common_hal_usb_cdc_serial_read(usb_cdc_serial_obj_t *self, uint8_t *data,
4846
data += num_read;
4947

5048
// Try to read another batch of bytes.
51-
if (tud_cdc_n_connected(self->idx)) {
52-
num_read = tud_cdc_n_read(self->idx, data, len);
53-
}
49+
num_read = tud_cdc_n_read(self->idx, data, len);
5450
total_num_read += num_read;
5551
}
5652
}

0 commit comments

Comments
 (0)