mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-28 16:20:26 +00:00
fix cdc host enumeration issue when device does not support line request
This commit is contained in:
parent
f640163ee9
commit
b054229780
@ -323,7 +323,8 @@ bool tuh_cdc_set_control_line_state(uint8_t idx, uint16_t line_state, tuh_xfer_c
|
|||||||
.user_data = user_data
|
.user_data = user_data
|
||||||
};
|
};
|
||||||
|
|
||||||
return tuh_control_xfer(&xfer);
|
TU_ASSERT(tuh_control_xfer(&xfer));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tuh_cdc_set_line_coding(uint8_t idx, cdc_line_coding_t const* line_coding, tuh_xfer_cb_t complete_cb, uintptr_t user_data)
|
bool tuh_cdc_set_line_coding(uint8_t idx, cdc_line_coding_t const* line_coding, tuh_xfer_cb_t complete_cb, uintptr_t user_data)
|
||||||
@ -363,7 +364,8 @@ bool tuh_cdc_set_line_coding(uint8_t idx, cdc_line_coding_t const* line_coding,
|
|||||||
.user_data = user_data
|
.user_data = user_data
|
||||||
};
|
};
|
||||||
|
|
||||||
return tuh_control_xfer(&xfer);
|
TU_ASSERT(tuh_control_xfer(&xfer));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
@ -543,26 +545,31 @@ static void process_cdc_config(tuh_xfer_t* xfer)
|
|||||||
uintptr_t const state = xfer->user_data;
|
uintptr_t const state = xfer->user_data;
|
||||||
uint8_t const itf_num = (uint8_t) tu_le16toh(xfer->setup->wIndex);
|
uint8_t const itf_num = (uint8_t) tu_le16toh(xfer->setup->wIndex);
|
||||||
uint8_t const idx = tuh_cdc_itf_get_index(xfer->daddr, itf_num);
|
uint8_t const idx = tuh_cdc_itf_get_index(xfer->daddr, itf_num);
|
||||||
TU_ASSERT(idx != TUSB_INDEX_INVALID_8, );
|
cdch_interface_t * p_cdc = get_itf(idx);
|
||||||
|
TU_ASSERT(p_cdc, );
|
||||||
|
|
||||||
switch(state)
|
switch(state)
|
||||||
{
|
{
|
||||||
case CONFIG_SET_CONTROL_LINE_STATE:
|
case CONFIG_SET_CONTROL_LINE_STATE:
|
||||||
#if CFG_TUH_CDC_LINE_CONTROL_ON_ENUM
|
#if CFG_TUH_CDC_LINE_CONTROL_ON_ENUM
|
||||||
TU_ASSERT( tuh_cdc_set_control_line_state(idx, CFG_TUH_CDC_LINE_CONTROL_ON_ENUM, process_cdc_config, CONFIG_SET_LINE_CODING), );
|
if (p_cdc->acm_capability.support_line_request)
|
||||||
break;
|
{
|
||||||
#endif
|
TU_ASSERT( tuh_cdc_set_control_line_state(idx, CFG_TUH_CDC_LINE_CONTROL_ON_ENUM, process_cdc_config, CONFIG_SET_LINE_CODING), );
|
||||||
TU_ATTR_FALLTHROUGH;
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
TU_ATTR_FALLTHROUGH;
|
||||||
|
|
||||||
case CONFIG_SET_LINE_CODING:
|
case CONFIG_SET_LINE_CODING:
|
||||||
#ifdef CFG_TUH_CDC_LINE_CODING_ON_ENUM
|
#ifdef CFG_TUH_CDC_LINE_CODING_ON_ENUM
|
||||||
{
|
if (p_cdc->acm_capability.support_line_request)
|
||||||
cdc_line_coding_t line_coding = CFG_TUH_CDC_LINE_CODING_ON_ENUM;
|
{
|
||||||
TU_ASSERT( tuh_cdc_set_line_coding(idx, &line_coding, process_cdc_config, CONFIG_COMPLETE), );
|
cdc_line_coding_t line_coding = CFG_TUH_CDC_LINE_CODING_ON_ENUM;
|
||||||
break;
|
TU_ASSERT( tuh_cdc_set_line_coding(idx, &line_coding, process_cdc_config, CONFIG_COMPLETE), );
|
||||||
}
|
break;
|
||||||
#endif
|
}
|
||||||
TU_ATTR_FALLTHROUGH;
|
#endif
|
||||||
|
TU_ATTR_FALLTHROUGH;
|
||||||
|
|
||||||
case CONFIG_COMPLETE:
|
case CONFIG_COMPLETE:
|
||||||
if (tuh_cdc_mount_cb) tuh_cdc_mount_cb(idx);
|
if (tuh_cdc_mount_cb) tuh_cdc_mount_cb(idx);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user