diff --git a/examples/peripherals/usb/device/tusb_hid/main/CMakeLists.txt b/examples/peripherals/usb/device/tusb_hid/main/CMakeLists.txt index 25a3164ece..ed6a4b2d99 100644 --- a/examples/peripherals/usb/device/tusb_hid/main/CMakeLists.txt +++ b/examples/peripherals/usb/device/tusb_hid/main/CMakeLists.txt @@ -1,5 +1,5 @@ idf_component_register( SRCS "tusb_hid_example_main.c" INCLUDE_DIRS "." - PRIV_REQUIRES driver + PRIV_REQUIRES esp_driver_gpio ) diff --git a/examples/peripherals/usb/host/cdc/cdc_acm_vcp/main/CMakeLists.txt b/examples/peripherals/usb/host/cdc/cdc_acm_vcp/main/CMakeLists.txt index 477ba42e45..e52dfe2ba8 100644 --- a/examples/peripherals/usb/host/cdc/cdc_acm_vcp/main/CMakeLists.txt +++ b/examples/peripherals/usb/host/cdc/cdc_acm_vcp/main/CMakeLists.txt @@ -3,5 +3,3 @@ idf_component_register( INCLUDE_DIRS "." PRIV_REQUIRES usb ) - -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-missing-field-initializers") diff --git a/examples/peripherals/usb/host/cdc/cdc_acm_vcp/main/cdc_acm_vcp_example_main.cpp b/examples/peripherals/usb/host/cdc/cdc_acm_vcp/main/cdc_acm_vcp_example_main.cpp index 1ffd33c222..32d2fee7e3 100644 --- a/examples/peripherals/usb/host/cdc/cdc_acm_vcp/main/cdc_acm_vcp_example_main.cpp +++ b/examples/peripherals/usb/host/cdc/cdc_acm_vcp/main/cdc_acm_vcp_example_main.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: CC0-1.0 */ @@ -109,10 +109,9 @@ extern "C" void app_main(void) // Install USB Host driver. Should only be called once in entire application ESP_LOGI(TAG, "Installing USB Host"); - const usb_host_config_t host_config = { - .skip_phy_setup = false, - .intr_flags = ESP_INTR_FLAG_LEVEL1, - }; + usb_host_config_t host_config = {}; + host_config.skip_phy_setup = false; + host_config.intr_flags = ESP_INTR_FLAG_LEVEL1; ESP_ERROR_CHECK(usb_host_install(&host_config)); // Create a task that will handle USB library events diff --git a/examples/peripherals/usb/host/hid/main/CMakeLists.txt b/examples/peripherals/usb/host/hid/main/CMakeLists.txt index 724c538d4b..0bf44fb76a 100644 --- a/examples/peripherals/usb/host/hid/main/CMakeLists.txt +++ b/examples/peripherals/usb/host/hid/main/CMakeLists.txt @@ -1,4 +1,4 @@ idf_component_register(SRCS "hid_host_example.c" INCLUDE_DIRS "." - PRIV_REQUIRES usb driver + PRIV_REQUIRES usb esp_driver_gpio ) diff --git a/examples/peripherals/usb/host/msc/main/CMakeLists.txt b/examples/peripherals/usb/host/msc/main/CMakeLists.txt index 344024ba7d..cf7d18b340 100644 --- a/examples/peripherals/usb/host/msc/main/CMakeLists.txt +++ b/examples/peripherals/usb/host/msc/main/CMakeLists.txt @@ -1,4 +1,4 @@ idf_component_register(SRCS "msc_example_main.c" INCLUDE_DIRS "" - PRIV_REQUIRES usb fatfs driver esp_timer + PRIV_REQUIRES usb fatfs esp_driver_gpio esp_timer ) diff --git a/examples/peripherals/usb/host/msc/main/msc_example_main.c b/examples/peripherals/usb/host/msc/main/msc_example_main.c index c6be757d9c..773a049281 100644 --- a/examples/peripherals/usb/host/msc/main/msc_example_main.c +++ b/examples/peripherals/usb/host/msc/main/msc_example_main.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -217,17 +217,19 @@ static void usb_task(void *args) }; ESP_ERROR_CHECK(msc_host_install(&msc_config)); + bool has_clients = true; while (true) { uint32_t event_flags; usb_host_lib_handle_events(portMAX_DELAY, &event_flags); // Release devices once all clients has deregistered if (event_flags & USB_HOST_LIB_EVENT_FLAGS_NO_CLIENTS) { + has_clients = false; if (usb_host_device_free_all() == ESP_OK) { break; }; } - if (event_flags & USB_HOST_LIB_EVENT_FLAGS_ALL_FREE) { + if (event_flags & USB_HOST_LIB_EVENT_FLAGS_ALL_FREE && !has_clients) { break; } } diff --git a/examples/peripherals/usb/host/usb_host_lib/main/CMakeLists.txt b/examples/peripherals/usb/host/usb_host_lib/main/CMakeLists.txt index 5d0a296fb9..8e8817d582 100644 --- a/examples/peripherals/usb/host/usb_host_lib/main/CMakeLists.txt +++ b/examples/peripherals/usb/host/usb_host_lib/main/CMakeLists.txt @@ -1,4 +1,4 @@ idf_component_register(SRCS "usb_host_lib_main.c" "class_driver.c" INCLUDE_DIRS "." - PRIV_REQUIRES usb driver + PRIV_REQUIRES usb esp_driver_gpio )