circuitpython/supervisor/shared
Jeff Epler 28043c94b5 supervisor: Improve serial connection detection
These changes remove the caveat from supervisor.runtime.serial_connected.

It appears that _tud_cdc_connected() only tracks explicit changes to the
"DTR" bit, which leads to disconnects not being registered.

Instead:
 * when line state is changed explicitly, track the dtr value in
   _serial_connected
 * when the USB bus is suspended, set _serial_connected to False

Testing performed (using sam e54 xplained):  Run a program to show
the state of `serial_connected` on the LED:
```
import digitalio
import supervisor
import board

led = digitalio.DigitalInOut(board.LED)
while True:
    led.switch_to_output(not supervisor.runtime.serial_connected)
```

Try all the following:
 * open, close serial terminal program
    - LED status tracks whether terminal is open
 * turn on/off data lines using the switchable charge-only cable
    - LED turns off when switch is in "charger" position
    - LED turns back on when switch is in Data position and terminal is
      opened (but doesn't turn back on just because switch position is
      changed)
2020-09-17 18:32:06 -05:00
..
external_flash Add license to some obvious files. 2020-07-06 19:16:25 +01:00
usb supervisor: Improve serial connection detection 2020-09-17 18:32:06 -05:00
autoreload.c Updates based on feedback from jepler 2020-04-06 16:03:31 -07:00
autoreload.h Refine _bleio 2019-10-21 18:57:03 -07:00
background_callback.c background callbacks: Clear any callbacks that were queued 2020-07-20 08:44:39 -05:00
bluetooth.c wip: advertising; not tested 2020-07-12 19:45:23 -04:00
bluetooth.h wip: compiles 2020-08-02 11:36:38 -04:00
board.c pygamer and pybadge boards were not resetting neopixels 2020-01-24 09:32:28 -05:00
board.h reset NeoPixels on CPB on soft reload 2020-01-23 20:16:31 -05:00
display.c supervisor: Always allocate at least a 1x1 terminal 2020-09-01 10:55:45 -05:00
display.h Turn off terminalio for ja and ko 2020-08-17 17:17:59 -07:00
filesystem.c Allow drive name to be set per target, with fallback to pre-existing behaviour 2020-02-12 11:09:48 +00:00
flash.c flash: Correctly signal error on invalid flash read 2020-06-22 10:24:21 -05:00
internal_flash.h Hopefully fix flash flush and hopefully audio as well. 2020-03-13 11:12:31 -07:00
memory.c Initial ESP32S2 port. 2020-05-15 15:36:16 -07:00
micropython.c supervisor: use mp_handle_pending to check for exceptions 2020-08-23 09:12:01 -05:00
rgb_led_colors.h Reduce DotStar status brightness; macros for status colors 2019-11-01 13:37:36 -04:00
rgb_led_status.c Fix RGB LED use 2020-08-24 18:29:50 -07:00
rgb_led_status.h Disable bitbangio on Itsy M0 2019-08-27 15:21:47 -07:00
safe_mode.c Update safe_mode.c 2020-09-13 23:17:14 +05:30
safe_mode.h Fix heap without PSRAM. Never set heap_size. 2020-09-08 17:06:09 -07:00
serial.c supervisor: Improve serial connection detection 2020-09-17 18:32:06 -05:00
stack.c Initial ESP32S2 port. 2020-05-15 15:36:16 -07:00
stack.h Initial ESP32S2 port. 2020-05-15 15:36:16 -07:00
status_leds.c Add feature conditionals and clean up 2019-07-22 12:58:28 -04:00
status_leds.h Move atmel-samd to tinyusb and support nRF flash. 2018-11-08 17:25:30 -08:00
tick.c merge from upstream 2020-08-30 14:39:03 -04:00
tick.h supervisor: factor supervisor_background_tasks from sundry ports 2020-07-15 11:49:44 -05:00
translate.c Small improvements to the dictionary compression 2020-09-14 01:50:01 +09:00
translate.h supervisor translate: explain the dictionary 2020-09-15 13:18:04 -05:00