forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Milestone
Description
If CDC USB is connected and then becomes disconnected, serial_write_substring()
in supervisor/shared/serial.c
will loop forever trying to write a string. The call to tud_cdc_connected()
returns true
even though USB has been disconnected. See code in https://github.com/adafruit/circuitpython/blob/master/supervisor/shared/serial.c#L54.
Opening an issue in tinyusb about this.
#1680 discusses a case where PyPortal hangs (no display update, but no crash) after running the OpenWeather demo for a long time. In discussing this with @jerryneedell, the host computer went to sleep during that period, with the REPL connected. I replicated the problem this way:
- Start PyPortal running OpenWeather. Use a USB cable with a data/power-only switch
- Connect to REPL.
- After a minute or less, disconnect the data by flipping the switch on the USB cable. The PyPortal will remain powered but will lose its USB connection.
- The PyPortal will eventually try to
print()
a string, and will callserial_write_substring()
. As described above, it will loop forever there, becausetud_cdc_connected()
but no bytes are able to be written to CDC.
Metadata
Metadata
Assignees
Labels
No labels