diff options
| author | hathach <[email protected]> | 2019-03-27 23:58:24 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2019-03-27 23:58:24 +0700 |
| commit | 8fb9fbb0b19de3422645e65fbd422c86cb548c62 (patch) | |
| tree | 0fe97b0fb5f78737d6e34b605732cf8b904c044e /src/class/cdc | |
| parent | c09d754654eb7846f3b53cbe58da517076c97494 (diff) | |
add tud_mounted() check in tud_cdc_connected()
mark device as disconnected immed with DCD_EVENT_UNPLUGGED
Diffstat (limited to 'src/class/cdc')
| -rw-r--r-- | src/class/cdc/cdc_device.c | 2 | ||||
| -rw-r--r-- | src/class/cdc/cdc_device.h | 1 |
2 files changed, 1 insertions, 2 deletions
diff --git a/src/class/cdc/cdc_device.c b/src/class/cdc/cdc_device.c index 2ac8d471c..7b8f1bf72 100644 --- a/src/class/cdc/cdc_device.c +++ b/src/class/cdc/cdc_device.c @@ -99,7 +99,7 @@ static void _prep_out_transaction (uint8_t itf) bool tud_cdc_n_connected(uint8_t itf)
{
// DTR (bit 0) active is considered as connected
- return TU_BIT_TEST(_cdcd_itf[itf].line_state, 0);
+ return tud_mounted() && TU_BIT_TEST(_cdcd_itf[itf].line_state, 0);
}
uint8_t tud_cdc_n_get_line_state (uint8_t itf)
diff --git a/src/class/cdc/cdc_device.h b/src/class/cdc/cdc_device.h index 468edef45..d9a200dd4 100644 --- a/src/class/cdc/cdc_device.h +++ b/src/class/cdc/cdc_device.h @@ -97,7 +97,6 @@ ATTR_WEAK void tud_cdc_line_coding_cb(uint8_t itf, cdc_line_coding_t const* p_li //--------------------------------------------------------------------+
// INTERNAL USBD-CLASS DRIVER API
-
//--------------------------------------------------------------------+
void cdcd_init (void);
bool cdcd_open (uint8_t rhport, tusb_desc_interface_t const * p_interface_desc, uint16_t *p_length);
|
