diff options
| author | Dan Halbert <halbert@adafruit.com> | 2020-10-31 12:28:20 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-31 12:28:20 -0400 |
| commit | 144eb131ae7c290c8ad03edd1e293b7962c00dc4 (patch) | |
| tree | de81dd9bc41645095fea88e9e39e36483471e998 /supervisor/shared | |
| parent | 0938d4e9c1e78bb79ae82b4bea2cab017ffc1573 (diff) | |
| parent | bbed1b03546802c03f3f20cdcb36d23cd54d047b (diff) | |
Merge pull request #3627 from adafruit/6.0.x
Merge 6.0.x bugfixes to main
Diffstat (limited to 'supervisor/shared')
| -rw-r--r-- | supervisor/shared/serial.c | 6 | ||||
| -rw-r--r-- | supervisor/shared/usb/usb.c | 3 |
2 files changed, 3 insertions, 6 deletions
diff --git a/supervisor/shared/serial.c b/supervisor/shared/serial.c index 91e90671d..7383cc228 100644 --- a/supervisor/shared/serial.c +++ b/supervisor/shared/serial.c @@ -47,8 +47,6 @@ busio_uart_obj_t debug_uart; byte buf_array[64]; #endif -volatile bool _serial_connected; - void serial_early_init(void) { #if defined(DEBUG_UART_TX) && defined(DEBUG_UART_RX) debug_uart.base.type = &busio_uart_type; @@ -71,7 +69,9 @@ bool serial_connected(void) { #if defined(DEBUG_UART_TX) && defined(DEBUG_UART_RX) return true; #else - return _serial_connected; + // True if DTR is asserted, and the USB connection is up. + // tud_cdc_get_line_state(): bit 0 is DTR, bit 1 is RTS + return (tud_cdc_get_line_state() & 1) && tud_ready(); #endif } diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index 89fbf56f3..93d3436e9 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -116,7 +116,6 @@ void tud_umount_cb(void) { // remote_wakeup_en : if host allows us to perform remote wakeup // USB Specs: Within 7ms, device must draw an average current less than 2.5 mA from bus void tud_suspend_cb(bool remote_wakeup_en) { - _serial_connected = false; } // Invoked when usb bus is resumed @@ -128,8 +127,6 @@ void tud_resume_cb(void) { void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts) { (void) itf; // interface ID, not used - _serial_connected = dtr; - // DTR = false is counted as disconnected if ( !dtr ) { |
