Skip to content

Commit 95cbf3f

Browse files
committed
handle CIRCUITPY_USB_CDC = 0 properly (fix simmel build)
1 parent 3930440 commit 95cbf3f

File tree

1 file changed

+5
-0
lines changed
  • supervisor/shared/usb

1 file changed

+5
-0
lines changed

supervisor/shared/usb/usb.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ void usb_init(void) {
8383

8484
// Don't watch for ctrl-C if there is no REPL.
8585
if (usb_cdc_console_enabled()) {
86+
// Console will always be itf 0.
8687
tud_cdc_set_wanted_char(CHAR_CTRL_C);
8788
}
8889
#endif
@@ -156,9 +157,12 @@ void usb_background(void) {
156157
tud_task();
157158
#endif
158159
// No need to flush if there's no REPL.
160+
#if CIRCUITPY_USB_CDC
159161
if (usb_cdc_console_enabled()) {
162+
// Console will always be itf 0.
160163
tud_cdc_write_flush();
161164
}
165+
#endif
162166
}
163167
}
164168

@@ -212,6 +216,7 @@ void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts) {
212216
// DTR = false is counted as disconnected
213217
if (!dtr) {
214218
cdc_line_coding_t coding;
219+
// Use whichever CDC is itf 0.
215220
tud_cdc_get_line_coding(&coding);
216221

217222
if (coding.bit_rate == 1200) {

0 commit comments

Comments
 (0)