Merge pull request #2438 from IngHK/cdch_mounted_fix
fix of #2437 CDCh tuh_cdc_mounted() returns true before process config is completed
This commit is contained in:
@@ -53,12 +53,13 @@ typedef struct {
|
|||||||
uint8_t bInterfaceSubClass;
|
uint8_t bInterfaceSubClass;
|
||||||
uint8_t bInterfaceProtocol;
|
uint8_t bInterfaceProtocol;
|
||||||
|
|
||||||
uint8_t serial_drid; // Serial Driver ID
|
|
||||||
cdc_acm_capability_t acm_capability;
|
|
||||||
uint8_t ep_notif;
|
uint8_t ep_notif;
|
||||||
|
uint8_t serial_drid; // Serial Driver ID
|
||||||
|
bool mounted; // Enumeration is complete
|
||||||
|
cdc_acm_capability_t acm_capability;
|
||||||
|
|
||||||
uint8_t line_state; // DTR (bit0), RTS (bit1)
|
|
||||||
TU_ATTR_ALIGNED(4) cdc_line_coding_t line_coding; // Baudrate, stop bits, parity, data width
|
TU_ATTR_ALIGNED(4) cdc_line_coding_t line_coding; // Baudrate, stop bits, parity, data width
|
||||||
|
uint8_t line_state; // DTR (bit0), RTS (bit1)
|
||||||
|
|
||||||
#if CFG_TUH_CDC_FTDI || CFG_TUH_CDC_CP210X || CFG_TUH_CDC_CH34X
|
#if CFG_TUH_CDC_FTDI || CFG_TUH_CDC_CP210X || CFG_TUH_CDC_CH34X
|
||||||
cdc_line_coding_t requested_line_coding;
|
cdc_line_coding_t requested_line_coding;
|
||||||
@@ -305,7 +306,8 @@ bool tuh_cdc_itf_get_info(uint8_t idx, tuh_itf_info_t* info) {
|
|||||||
|
|
||||||
bool tuh_cdc_mounted(uint8_t idx) {
|
bool tuh_cdc_mounted(uint8_t idx) {
|
||||||
cdch_interface_t* p_cdc = get_itf(idx);
|
cdch_interface_t* p_cdc = get_itf(idx);
|
||||||
return p_cdc != NULL;
|
TU_VERIFY(p_cdc);
|
||||||
|
return p_cdc->mounted;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tuh_cdc_get_dtr(uint8_t idx) {
|
bool tuh_cdc_get_dtr(uint8_t idx) {
|
||||||
@@ -644,9 +646,9 @@ void cdch_close(uint8_t daddr) {
|
|||||||
// Invoke application callback
|
// Invoke application callback
|
||||||
if (tuh_cdc_umount_cb) tuh_cdc_umount_cb(idx);
|
if (tuh_cdc_umount_cb) tuh_cdc_umount_cb(idx);
|
||||||
|
|
||||||
//tu_memclr(p_cdc, sizeof(cdch_interface_t));
|
|
||||||
p_cdc->daddr = 0;
|
p_cdc->daddr = 0;
|
||||||
p_cdc->bInterfaceNumber = 0;
|
p_cdc->bInterfaceNumber = 0;
|
||||||
|
p_cdc->mounted = false;
|
||||||
tu_edpt_stream_close(&p_cdc->stream.tx);
|
tu_edpt_stream_close(&p_cdc->stream.tx);
|
||||||
tu_edpt_stream_close(&p_cdc->stream.rx);
|
tu_edpt_stream_close(&p_cdc->stream.rx);
|
||||||
}
|
}
|
||||||
@@ -747,6 +749,7 @@ bool cdch_open(uint8_t rhport, uint8_t daddr, tusb_desc_interface_t const *itf_d
|
|||||||
|
|
||||||
static void set_config_complete(cdch_interface_t * p_cdc, uint8_t idx, uint8_t itf_num) {
|
static void set_config_complete(cdch_interface_t * p_cdc, uint8_t idx, uint8_t itf_num) {
|
||||||
TU_LOG_DRV("CDCh Set Configure complete\r\n");
|
TU_LOG_DRV("CDCh Set Configure complete\r\n");
|
||||||
|
p_cdc->mounted = true;
|
||||||
if (tuh_cdc_mount_cb) tuh_cdc_mount_cb(idx);
|
if (tuh_cdc_mount_cb) tuh_cdc_mount_cb(idx);
|
||||||
|
|
||||||
// Prepare for incoming data
|
// Prepare for incoming data
|
||||||
|
|||||||
Reference in New Issue
Block a user