mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(usb/host): Do not abort on string descriptor overflow
Some devices return full LANGID table, even if short LANGID table was requested. No memory overflow occurs, because we have allocated enough memory for transfers to the default pipe. So we can ignore the error and continue with string desc fetching.
This commit is contained in:
parent
ce351790a8
commit
9cdd6ac5f1
@ -449,9 +449,16 @@ static bool enum_stage_transfer_check(enum_ctrl_t *enum_ctrl)
|
||||
return false;
|
||||
}
|
||||
// Check IN transfer returned the expected correct number of bytes
|
||||
if (enum_ctrl->expect_num_bytes != 0 && enum_ctrl->expect_num_bytes != transfer->actual_num_bytes) {
|
||||
ESP_LOGE(HUB_DRIVER_TAG, "Incorrect number of bytes returned %d: %s", transfer->actual_num_bytes, enum_stage_strings[enum_ctrl->stage]);
|
||||
return false;
|
||||
if (enum_ctrl->expect_num_bytes != 0 && transfer->actual_num_bytes != enum_ctrl->expect_num_bytes) {
|
||||
if (transfer->actual_num_bytes > enum_ctrl->expect_num_bytes) {
|
||||
// The device returned more bytes than requested.
|
||||
// This violates the USB specs chapter 9.3.5, but we can continue
|
||||
ESP_LOGW(HUB_DRIVER_TAG, "Incorrect number of bytes returned %d: %s", transfer->actual_num_bytes, enum_stage_strings[enum_ctrl->stage]);
|
||||
} else {
|
||||
// The device returned less bytes than requested. We cannot continue.
|
||||
ESP_LOGE(HUB_DRIVER_TAG, "Incorrect number of bytes returned %d: %s", transfer->actual_num_bytes, enum_stage_strings[enum_ctrl->stage]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Stage specific checks and updates
|
||||
|
@ -70,7 +70,6 @@ static void action_get_info(class_driver_t *driver_obj)
|
||||
ESP_ERROR_CHECK(usb_host_device_info(driver_obj->dev_hdl, &dev_info));
|
||||
ESP_LOGI(TAG, "\t%s speed", (dev_info.speed == USB_SPEED_LOW) ? "Low" : "Full");
|
||||
ESP_LOGI(TAG, "\tbConfigurationValue %d", dev_info.bConfigurationValue);
|
||||
//Todo: Print string descriptors
|
||||
|
||||
//Get the device descriptor next
|
||||
driver_obj->actions &= ~ACTION_GET_DEV_INFO;
|
||||
|
Loading…
x
Reference in New Issue
Block a user