Skip to content

Commit aed8369

Browse files
committed
fix(modem_4g): fix iot_usbh_cdc memory overrun issue
1 parent fae0bd2 commit aed8369

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

components/usb/iot_usbh_cdc/iot_usbh_cdc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static size_t _get_ringbuf_len(RingbufHandle_t ringbuf_hdl)
8686

8787
static esp_err_t _ringbuf_pop(RingbufHandle_t ringbuf_hdl, uint8_t *buf, size_t req_bytes, size_t *read_bytes, TickType_t ticks_to_wait)
8888
{
89-
uint8_t *buf_rcv = xRingbufferReceiveUpTo(ringbuf_hdl, read_bytes, ticks_to_wait, req_bytes);
89+
uint8_t *buf_rcv = xRingbufferReceiveUpTo(ringbuf_hdl, read_bytes, pdMS_TO_TICKS(1000), req_bytes);
9090
if (!buf_rcv) {
9191
return ESP_FAIL;
9292
}
@@ -802,7 +802,7 @@ esp_err_t usbh_cdc_read_bytes(usbh_cdc_handle_t cdc_handle, const uint8_t *buf,
802802

803803
ret = _ringbuf_pop(cdc->in_ringbuf_handle, (uint8_t *)buf, data_len, length, ticks_to_wait);
804804
if (ret != ESP_OK) {
805-
ESP_LOGD(TAG, "cdc read failed");
805+
ESP_LOGI(TAG, "cdc read failed");
806806
*length = 0;
807807
return ret;
808808
}

examples/usb/host/usb_cdc_basic/main/usb_cdc_basic_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void app_main(void)
7979
usbh_cdc_device_config_t dev_config = {
8080
.vid = 0,
8181
.pid = 0,
82-
.itf_num = 0,
82+
.itf_num = 1,
8383
.rx_buffer_size = IN_RINGBUF_SIZE,
8484
.tx_buffer_size = OUT_RINGBUF_SIZE,
8585
.cbs = {

0 commit comments

Comments
 (0)