Skip to content

Commit 82be247

Browse files
author
IngHK
committed
fixed #2437
1 parent bd3c4fb commit 82be247

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/class/cdc/cdc_host.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ typedef struct {
7777
uint8_t rx_ff_buf[CFG_TUH_CDC_TX_BUFSIZE];
7878
CFG_TUH_MEM_ALIGN uint8_t rx_ep_buf[CFG_TUH_CDC_TX_EPSIZE];
7979
} stream;
80+
81+
bool configured;
8082
} cdch_interface_t;
8183

8284
CFG_TUH_MEM_SECTION
@@ -257,6 +259,7 @@ static cdch_interface_t* make_new_itf(uint8_t daddr, tusb_desc_interface_t const
257259
p_cdc->bInterfaceSubClass = itf_desc->bInterfaceSubClass;
258260
p_cdc->bInterfaceProtocol = itf_desc->bInterfaceProtocol;
259261
p_cdc->line_state = 0;
262+
p_cdc->configured = false;
260263
return p_cdc;
261264
}
262265
}
@@ -305,7 +308,8 @@ bool tuh_cdc_itf_get_info(uint8_t idx, tuh_itf_info_t* info) {
305308

306309
bool tuh_cdc_mounted(uint8_t idx) {
307310
cdch_interface_t* p_cdc = get_itf(idx);
308-
return p_cdc != NULL;
311+
TU_VERIFY(p_cdc);
312+
return p_cdc->configured;
309313
}
310314

311315
bool tuh_cdc_get_dtr(uint8_t idx) {
@@ -747,6 +751,7 @@ bool cdch_open(uint8_t rhport, uint8_t daddr, tusb_desc_interface_t const *itf_d
747751

748752
static void set_config_complete(cdch_interface_t * p_cdc, uint8_t idx, uint8_t itf_num) {
749753
TU_LOG_DRV("CDCh Set Configure complete\r\n");
754+
p_cdc->configured = true;
750755
if (tuh_cdc_mount_cb) tuh_cdc_mount_cb(idx);
751756

752757
// Prepare for incoming data

0 commit comments

Comments
 (0)