From 4deccbc4a6e089d8fee444e793b4ca7d717afa87 Mon Sep 17 00:00:00 2001 From: "peter.marcisovsky" Date: Mon, 28 Jul 2025 18:52:51 +0200 Subject: [PATCH] fix(usb_host): Run esp-usb pre-commit: - trailing whitespaces - end-of-file-fixer - codespell - astyle_py: align pointer name --- components/usb/ext_hub.c | 12 ++--- components/usb/ext_port.c | 16 +++--- components/usb/hcd_dwc.c | 4 +- .../host_test/usb_host_layer_test/README.md | 2 +- .../usb/host_test/usbh_layer_test/README.md | 4 +- components/usb/maintainers.md | 2 +- components/usb/private_include/enum.h | 2 +- components/usb/private_include/ext_hub.h | 4 +- components/usb/private_include/ext_port.h | 4 +- components/usb/test_apps/common/dev_msc.c | 2 +- components/usb/test_apps/enum/README.md | 5 +- components/usb/test_apps/enum/main/mock_dev.c | 2 +- .../test_apps/ext_port/main/ext_port_common.c | 10 ++-- .../usb/test_apps/ext_port/main/hub_common.c | 4 +- .../usb/test_apps/ext_port/main/hub_common.h | 2 +- .../test_apps/ext_port/main/test_ext_port.c | 52 +++++++++---------- .../usb/test_apps/hcd/main/test_hcd_port.c | 2 +- components/usb/test_apps/usb_host/README.md | 1 - .../usb_host/main/test_usb_host_async.c | 4 +- components/usb/usb_host.c | 2 +- .../tusb_hid/main/tusb_hid_example_main.c | 8 +-- .../device/tusb_midi/main/tusb_midi_main.c | 2 +- .../peripherals/usb/device/tusb_msc/README.md | 26 +++++----- .../usb/host/cdc/cdc_acm_host/README.md | 2 +- examples/peripherals/usb/host/hid/README.md | 12 ++--- examples/peripherals/usb/host/msc/README.md | 2 +- .../usb/host/usb_host_lib/README.md | 2 +- .../usb/mock_add_usb_device.c | 25 ++++----- 28 files changed, 105 insertions(+), 110 deletions(-) diff --git a/components/usb/ext_hub.c b/components/usb/ext_hub.c index 44b81eb380..9ba5f7b9d9 100644 --- a/components/usb/ext_hub.c +++ b/components/usb/ext_hub.c @@ -145,7 +145,7 @@ typedef struct { struct { ext_hub_cb_t proc_req_cb; /**< Process callback */ void *proc_req_cb_arg; /**< Process callback argument */ - const ext_port_driver_api_t* port_driver; /**< External Port Driver */ + const ext_port_driver_api_t *port_driver; /**< External Port Driver */ } constant; /**< Constant members. Do not change after installation thus do not require a critical section or mutex */ } ext_hub_driver_t; @@ -180,7 +180,7 @@ DEFINE_CRIT_SECTION_LOCK_STATIC(ext_hub_driver_lock); // ----------------------------------------------------------------------------- static bool _device_set_actions(ext_hub_dev_t *ext_hub_dev, uint32_t action_flags); static void device_error(ext_hub_dev_t *ext_hub_dev); -static void device_status_change_handle(ext_hub_dev_t *ext_hub_dev, const uint8_t* data, const int length); +static void device_status_change_handle(ext_hub_dev_t *ext_hub_dev, const uint8_t *data, const int length); // ----------------------------------------------------------------------------- // ---------------------- Callbacks (implementation) --------------------------- @@ -361,7 +361,7 @@ static void device_has_changed(ext_hub_dev_t *ext_hub_dev) // | ... // +---------------------------- Port N change detected // -static void device_status_change_handle(ext_hub_dev_t *ext_hub_dev, const uint8_t* data, const int length) +static void device_status_change_handle(ext_hub_dev_t *ext_hub_dev, const uint8_t *data, const int length) { uint32_t device_status = 0; // Driver does not support Hubs with EP IN wMaxPacketSize > 4 @@ -415,14 +415,14 @@ static void device_error(ext_hub_dev_t *ext_hub_dev) static esp_err_t device_port_new(ext_hub_dev_t *ext_hub_dev, uint8_t port_idx) { ext_port_config_t port_config = { - .context = (void*) ext_hub_dev, + .context = (void *) ext_hub_dev, .parent_dev_hdl = ext_hub_dev->constant.dev_hdl, .parent_port_num = port_idx + 1, .port_power_delay_ms = ext_hub_dev->constant.hub_desc->bPwrOn2PwrGood * 2, }; assert(p_ext_hub_driver->constant.port_driver); - esp_err_t ret = p_ext_hub_driver->constant.port_driver->new (&port_config, (void**) &ext_hub_dev->constant.ports[port_idx]); + esp_err_t ret = p_ext_hub_driver->constant.port_driver->new (&port_config, (void **) &ext_hub_dev->constant.ports[port_idx]); if (ret != ESP_OK) { ESP_LOGE(EXT_HUB_TAG, "[%d:%d] Port allocation error: %s", ext_hub_dev->constant.dev_addr, port_idx + 1, esp_err_to_name(ret)); goto fail; @@ -1208,7 +1208,7 @@ void *ext_hub_get_client(void) EXT_HUB_ENTER_CRITICAL(); driver_installed = (p_ext_hub_driver != NULL); EXT_HUB_EXIT_CRITICAL(); - return (driver_installed) ? (void*) p_ext_hub_driver : NULL; + return (driver_installed) ? (void *) p_ext_hub_driver : NULL; } // ----------------------------------------------------------------------------- diff --git a/components/usb/ext_port.c b/components/usb/ext_port.c index eb5f40d3ea..098007d84d 100644 --- a/components/usb/ext_port.c +++ b/components/usb/ext_port.c @@ -78,7 +78,7 @@ struct ext_port_s { usb_device_handle_t parent_dev_hdl; /**< Ports' parent device handle */ uint8_t parent_dev_addr; /**< Ports' parent device bus address */ // Port related constant members - void* context; /**< Ports' parent External Hub handle */ + void *context; /**< Ports' parent External Hub handle */ uint8_t port_num; /**< Ports' parent External Hub Port number */ int power_on_delay_ms; /**< Ports' Power on time to Power Good, ms */ } constant; /**< Constant members. Do not change after installation thus do not require a critical section or mutex */ @@ -181,7 +181,7 @@ static inline bool port_is_enabled(ext_port_t *ext_port) * - true Port connection changed * - false Port connection not changed */ -static inline bool port_has_changed_connection(ext_port_t * ext_port) +static inline bool port_has_changed_connection(ext_port_t *ext_port) { return ext_port->status.wPortChange.C_PORT_CONNECTION ? true : false; } @@ -230,7 +230,7 @@ static inline bool port_has_finished_reset(ext_port_t *ext_port) * - ESP_ERR_NOT_SUPPORTED: The request type is not supported by the External Hub Driver * - ESP_OK: Status has been requested */ -static esp_err_t port_request_status(ext_port_t* ext_port) +static esp_err_t port_request_status(ext_port_t *ext_port) { ext_port_parent_request_data_t data = { .type = EXT_PORT_PARENT_REQ_CONTROL, @@ -469,7 +469,7 @@ static ext_port_t *get_port_from_pending_list(void) * - ESP_ERR_NOT_FINISHED: Unable to allocate the port object: parent device is not available * - ESP_OK: Port object created successfully */ -static esp_err_t port_alloc(void* context, usb_device_handle_t parent_dev_hdl, uint8_t parent_port_num, uint16_t port_delay_ms, ext_port_t **port_obj) +static esp_err_t port_alloc(void *context, usb_device_handle_t parent_dev_hdl, uint8_t parent_port_num, uint16_t port_delay_ms, ext_port_t **port_obj) { uint8_t parent_dev_addr = 0; EXT_PORT_CHECK(context != NULL && parent_dev_hdl != NULL, ESP_ERR_INVALID_ARG); @@ -1247,7 +1247,7 @@ static esp_err_t port_gone(void *port_hdl) * - ESP_ERR_INVALID_ARG: The port handle can't be NULL * - ESP_OK: Port action was requested */ -static esp_err_t port_get_status(void* port_hdl) +static esp_err_t port_get_status(void *port_hdl) { EXT_PORT_CHECK(p_ext_port_driver != NULL, ESP_ERR_NOT_ALLOWED); EXT_PORT_CHECK(port_hdl != NULL, ESP_ERR_INVALID_ARG); @@ -1269,7 +1269,7 @@ static esp_err_t port_get_status(void* port_hdl) * - ESP_ERR_INVALID_ARG: The port handle can't be NULL, the status data can't be NULL * - ESP_OK: Port action was requested */ -static esp_err_t port_set_status(void* port_hdl, const usb_port_status_t *port_status) +static esp_err_t port_set_status(void *port_hdl, const usb_port_status_t *port_status) { EXT_PORT_CHECK(p_ext_port_driver != NULL, ESP_ERR_NOT_ALLOWED); EXT_PORT_CHECK(port_hdl != NULL && port_status != NULL, ESP_ERR_INVALID_ARG); @@ -1298,7 +1298,7 @@ static esp_err_t port_set_status(void* port_hdl, const usb_port_status_t *port_s * - ESP_ERR_INVALID_ARG: The port handle can't be NULL * - ESP_OK: Port action was requested */ -static esp_err_t port_req_process(void* port_hdl) +static esp_err_t port_req_process(void *port_hdl) { EXT_PORT_CHECK(p_ext_port_driver != NULL, ESP_ERR_NOT_ALLOWED); EXT_PORT_CHECK(port_hdl != NULL, ESP_ERR_INVALID_ARG); @@ -1443,7 +1443,7 @@ const ext_port_driver_api_t *ext_port_get_driver(void) return &ext_port_driver; } -void* ext_port_get_context(ext_port_hdl_t port_hdl) +void *ext_port_get_context(ext_port_hdl_t port_hdl) { EXT_PORT_CHECK(p_ext_port_driver != NULL, NULL); ext_port_t *ext_port = (ext_port_t *)port_hdl; diff --git a/components/usb/hcd_dwc.c b/components/usb/hcd_dwc.c index fb41de0754..dc1e2fb81f 100644 --- a/components/usb/hcd_dwc.c +++ b/components/usb/hcd_dwc.c @@ -1407,7 +1407,7 @@ esp_err_t hcd_port_init(int port_number, const hcd_port_config_t *port_config, h // USB-HAL's size is dependent on its configuration, namely on number of channels in the configuration // We must first initialize the HAL, to get the number of channels and then allocate memory for the channels usb_dwc_hal_init(port_obj->hal, port_number); - port_obj->hal->channels.hdls = calloc(port_obj->hal->constant_config.chan_num_total, sizeof(usb_dwc_hal_chan_t*)); + port_obj->hal->channels.hdls = calloc(port_obj->hal->constant_config.chan_num_total, sizeof(usb_dwc_hal_chan_t *)); HCD_CHECK_FROM_CRIT(port_obj->hal->channels.hdls != NULL, ESP_ERR_NO_MEM); port_obj->initialized = true; @@ -1669,7 +1669,7 @@ static bool pipe_args_usb_compliance_verification(const hcd_pipe_config_t *pipe_ return true; } -static bool pipe_alloc_hcd_support_verification(usb_dwc_hal_context_t *hal, const usb_ep_desc_t * ep_desc) +static bool pipe_alloc_hcd_support_verification(usb_dwc_hal_context_t *hal, const usb_ep_desc_t *ep_desc) { assert(hal != NULL); assert(ep_desc != NULL); diff --git a/components/usb/host_test/usb_host_layer_test/README.md b/components/usb/host_test/usb_host_layer_test/README.md index 07071d4359..a37804c3f7 100644 --- a/components/usb/host_test/usb_host_layer_test/README.md +++ b/components/usb/host_test/usb_host_layer_test/README.md @@ -34,4 +34,4 @@ or run the executable directly: ``` ./build/host_test_usb_host_layer.elf -``` \ No newline at end of file +``` diff --git a/components/usb/host_test/usbh_layer_test/README.md b/components/usb/host_test/usbh_layer_test/README.md index 44200aed3b..ad2d609eeb 100644 --- a/components/usb/host_test/usbh_layer_test/README.md +++ b/components/usb/host_test/usbh_layer_test/README.md @@ -13,7 +13,7 @@ This test directory uses freertos as a real component # Build -Tests build regularly like an idf project. Currently only working on Linux machines. +Tests build regularly like an idf project. Currently only working on Linux machines. ``` idf.py --preview set-target linux @@ -34,4 +34,4 @@ or run the executable directly: ``` ./build/host_test_usbh_layer.elf -``` \ No newline at end of file +``` diff --git a/components/usb/maintainers.md b/components/usb/maintainers.md index 56f8c9383a..334fd017fe 100644 --- a/components/usb/maintainers.md +++ b/components/usb/maintainers.md @@ -128,7 +128,7 @@ In order to communicate events to the client of the HCD, the HCD does not attemp There are two types callbacks that the HCD offers: - Port callback will run whenever an event a port occurs. `hcd_port_handle_event()` should be called after a port event occurs. -- A pipe callback on each pipe, that will run when a event occurs on a pipe. +- A pipe callback on each pipe, that will run when a event occurs on a pipe. The client of the HCD can also forego callbacks entirely and simply poll for port and pipe events using the `hcd_port_handle_event()` and `hcd_pipe_get_event()` respectively. diff --git a/components/usb/private_include/enum.h b/components/usb/private_include/enum.h index b1869f2398..59b708d545 100644 --- a/components/usb/private_include/enum.h +++ b/components/usb/private_include/enum.h @@ -29,7 +29,7 @@ extern "C" { /** * @brief Handle of enumeration control object */ -typedef struct enum_ctx_handle_s * enum_ctx_handle_t; +typedef struct enum_ctx_handle_s *enum_ctx_handle_t; // ------------------------------ Events --------------------------------------- diff --git a/components/usb/private_include/ext_hub.h b/components/usb/private_include/ext_hub.h index f58b9a3383..a5f463e72e 100644 --- a/components/usb/private_include/ext_hub.h +++ b/components/usb/private_include/ext_hub.h @@ -37,7 +37,7 @@ typedef bool (*ext_hub_cb_t)(bool in_isr, void *user_arg); typedef struct { ext_hub_cb_t proc_req_cb; /**< External Hub process callback */ void *proc_req_cb_arg; /**< External Hub process callback argument */ - const ext_port_driver_api_t* port_driver; /**< External Port Driver */ + const ext_port_driver_api_t *port_driver; /**< External Port Driver */ } ext_hub_config_t; // ------------------------------ Driver --------------------------------------- @@ -55,7 +55,7 @@ typedef struct { * - ESP_ERR_NO_MEM: Insufficient memory * - ESP_ERR_INVALID_STATE: External Hub driver already installed */ -esp_err_t ext_hub_install(const ext_hub_config_t* config); +esp_err_t ext_hub_install(const ext_hub_config_t *config); /** * @brief Uninstall External Hub Driver diff --git a/components/usb/private_include/ext_port.h b/components/usb/private_include/ext_port.h index 0d12a68071..791b58fdc0 100644 --- a/components/usb/private_include/ext_port.h +++ b/components/usb/private_include/ext_port.h @@ -128,7 +128,7 @@ typedef struct { * Structure is used to create new port */ typedef struct { - void* context; /**< Ports' parent external Hub handle */ + void *context; /**< Ports' parent external Hub handle */ usb_device_handle_t parent_dev_hdl; /**< Ports' parent device handle */ uint8_t parent_port_num; /**< Ports' parent port number */ uint16_t port_power_delay_ms; /**< Ports' Power on time to Power Good, ms */ @@ -193,7 +193,7 @@ const ext_port_driver_api_t *ext_port_get_driver(void); * @return * - Pointer to the External Port Driver context */ -void* ext_port_get_context(ext_port_hdl_t port_hdl); +void *ext_port_get_context(ext_port_hdl_t port_hdl); /** * @brief Returns External Port's port number diff --git a/components/usb/test_apps/common/dev_msc.c b/components/usb/test_apps/common/dev_msc.c index 6d5d93d224..fdce4a5294 100644 --- a/components/usb/test_apps/common/dev_msc.c +++ b/components/usb/test_apps/common/dev_msc.c @@ -87,7 +87,7 @@ bLength : 0x22 (34 bytes) bDescriptorType : 0x03 (String Descriptor) wData : " SanDisk 3.2Gen1" ------------------------------ String Descriptor Ser ---------------------------- +----------------------------- String Descriptor Set ---------------------------- bLength : 0xF2 (242 bytes) bDescriptorType : 0x03 (String Descriptor) wData : "0101cdd1e856b427bbb796f870561a4b2b817af9da9872c8d75217cccdd5d5eccb3a0000000000000000000096abe1a3ff83610095558107aea948b4" diff --git a/components/usb/test_apps/enum/README.md b/components/usb/test_apps/enum/README.md index e42bfd7de2..b479fc2135 100644 --- a/components/usb/test_apps/enum/README.md +++ b/components/usb/test_apps/enum/README.md @@ -51,7 +51,7 @@ The Mocked Device has a Final State Machine (FSM), which could be configured to FSM is described in the **mock_dev_stage_t** structure and could be found in [mock_dev.h](main/mock_dev.h). -Available stages: +Available stages: - Request Short Device Descriptor - Request Full Device Descriptor - Request Short Configuration Descriptor @@ -165,7 +165,7 @@ TEST_CASE("enum::complete", "[mock_enum_device]") } }, }; - + // Test remained logic } ``` @@ -346,4 +346,3 @@ E (121120) USBH: Dev 33 EP 0 STALL E (121120) ENUM: Bad transfer status 4: CHECK_CONFIG E (121120) ENUM: [0:0] CHECK_CONFIG FAILED ``` - diff --git a/components/usb/test_apps/enum/main/mock_dev.c b/components/usb/test_apps/enum/main/mock_dev.c index bd50c53509..bf9c23c334 100644 --- a/components/usb/test_apps/enum/main/mock_dev.c +++ b/components/usb/test_apps/enum/main/mock_dev.c @@ -202,7 +202,7 @@ uint16_t const *tud_descriptor_string_cb(uint8_t index, uint16_t langid) } // Advanced -uint8_t const * tud_descriptor_bos_cb(void) +uint8_t const *tud_descriptor_bos_cb(void) { printf("\t <- BOS Descriptor request\n"); return NULL; diff --git a/components/usb/test_apps/ext_port/main/ext_port_common.c b/components/usb/test_apps/ext_port/main/ext_port_common.c index 294c1642aa..d1e0df5726 100644 --- a/components/usb/test_apps/ext_port/main/ext_port_common.c +++ b/components/usb/test_apps/ext_port/main/ext_port_common.c @@ -77,7 +77,7 @@ typedef struct { ext_port_parent_request_data_t data; } ext_port_hub_request_msg_t; -static const ext_port_driver_api_t* port_api; +static const ext_port_driver_api_t *port_api; SemaphoreHandle_t _process_cd_req = NULL; QueueHandle_t _ext_port_hub_req_queue = NULL; QueueHandle_t _ext_port_event_queue = NULL; @@ -180,11 +180,11 @@ void test_ext_port_setup(void) // Install External Port driver ext_port_driver_config_t ext_port_config = { .proc_req_cb = test_ext_port_callback, - .proc_req_cb_arg = (void*)_process_cd_req, + .proc_req_cb_arg = (void *)_process_cd_req, .event_cb = test_ext_port_event_callback, - .event_cb_arg = (void*)_ext_port_event_queue, + .event_cb_arg = (void *)_ext_port_event_queue, .hub_request_cb = test_ext_port_hub_request, - .hub_request_cb_arg = (void*)_ext_port_hub_req_queue, + .hub_request_cb_arg = (void *)_ext_port_hub_req_queue, }; TEST_ASSERT_EQUAL(ESP_OK, ext_port_install(&ext_port_config)); port_api = ext_port_get_driver(); @@ -203,7 +203,7 @@ void test_ext_port_teardown(void) ext_port_hdl_t test_ext_port_new(ext_port_config_t *config) { ext_port_hdl_t port = NULL; - TEST_ASSERT_EQUAL(ESP_OK, port_api->new (config, (void**) &port)); + TEST_ASSERT_EQUAL(ESP_OK, port_api->new (config, (void **) &port)); TEST_ASSERT_NOT_NULL(port); // Adding the port should trigger the process request callback test_wait_ext_port_process_request(); diff --git a/components/usb/test_apps/ext_port/main/hub_common.c b/components/usb/test_apps/ext_port/main/hub_common.c index 5ec4f5ec22..6a3a18426b 100644 --- a/components/usb/test_apps/ext_port/main/hub_common.c +++ b/components/usb/test_apps/ext_port/main/hub_common.c @@ -199,9 +199,9 @@ void hub_detach(void) test_hcd_wait_for_disconn(hub.root_port_hdl, true); } -void* hub_get_context(void) +void *hub_get_context(void) { - return (void*) &hub; + return (void *) &hub; } uint8_t hub_get_port_num(void) diff --git a/components/usb/test_apps/ext_port/main/hub_common.h b/components/usb/test_apps/ext_port/main/hub_common.h index ffac58df2f..5eae6bd615 100644 --- a/components/usb/test_apps/ext_port/main/hub_common.h +++ b/components/usb/test_apps/ext_port/main/hub_common.h @@ -72,7 +72,7 @@ void hub_child_quick_enum(hcd_pipe_handle_t ctrl_pipe, uint8_t dev_addr, uint8_t * * @return void* pointer to a Hub context */ -void* hub_get_context(void); +void *hub_get_context(void); /** * @brief Get number of ports diff --git a/components/usb/test_apps/ext_port/main/test_ext_port.c b/components/usb/test_apps/ext_port/main/test_ext_port.c index 05658073f0..a81fe5bb78 100644 --- a/components/usb/test_apps/ext_port/main/test_ext_port.c +++ b/components/usb/test_apps/ext_port/main/test_ext_port.c @@ -92,8 +92,8 @@ TEST_CASE("Port: disconnected", "[low_speed][full_speed][high_speed]") TEST_ASSERT_TRUE(TEST_PORT_NUM_EMPTY <= port_num); // Create External Port ext_port_config_t port_config = { - .context = (void*) hub_get_context() /* use any before IDF-10023 */, - .parent_dev_hdl = (void*) hub_get_context() /* use any before IDF-10023 */, + .context = (void *) hub_get_context() /* use any before IDF-10023 */, + .parent_dev_hdl = (void *) hub_get_context() /* use any before IDF-10023 */, .parent_port_num = TEST_PORT_NUM_EMPTY, .port_power_delay_ms = hub_get_port_poweron_delay_ms(), }; @@ -136,8 +136,8 @@ TEST_CASE("Port: enumerate child device Low-speed", "[ext_port][low_speed]") TEST_ASSERT_TRUE(TEST_PORT_NUM_DEVICE_LS <= port_num); // Create External Port ext_port_config_t port_config = { - .context = (void*) hub_get_context() /* use any before IDF-10023 */, - .parent_dev_hdl = (void*) hub_get_context() /* use any before IDF-10023 */, + .context = (void *) hub_get_context() /* use any before IDF-10023 */, + .parent_dev_hdl = (void *) hub_get_context() /* use any before IDF-10023 */, .parent_port_num = TEST_PORT_NUM_DEVICE_LS, .port_power_delay_ms = hub_get_port_poweron_delay_ms(), }; @@ -146,7 +146,7 @@ TEST_CASE("Port: enumerate child device Low-speed", "[ext_port][low_speed]") test_ext_port_power_on(TEST_PORT_NUM_DEVICE_LS, port_hdl); // Wait connection usb_speed_t port_speed = test_ext_port_connected(TEST_PORT_NUM_DEVICE_LS, port_hdl); - printf("Hub port: %s speed device \n", (char*[]) { + printf("Hub port: %s speed device \n", (char *[]) { "Low", "Full", "High" }[port_speed]); // Check the device speed @@ -193,8 +193,8 @@ TEST_CASE("Port: enumerate child device Full-speed", "[ext_port][full_speed]") TEST_ASSERT_TRUE(TEST_PORT_NUM_DEVICE_FSHS <= port_num); // Create External Port ext_port_config_t port_config = { - .context = (void*) hub_get_context() /* use any before IDF-10023 */, - .parent_dev_hdl = (void*) hub_get_context() /* use any before IDF-10023 */, + .context = (void *) hub_get_context() /* use any before IDF-10023 */, + .parent_dev_hdl = (void *) hub_get_context() /* use any before IDF-10023 */, .parent_port_num = TEST_PORT_NUM_DEVICE_FSHS, .port_power_delay_ms = hub_get_port_poweron_delay_ms(), }; @@ -203,7 +203,7 @@ TEST_CASE("Port: enumerate child device Full-speed", "[ext_port][full_speed]") test_ext_port_power_on(TEST_PORT_NUM_DEVICE_FSHS, port_hdl); // Wait connection usb_speed_t port_speed = test_ext_port_connected(TEST_PORT_NUM_DEVICE_FSHS, port_hdl); - printf("Hub port: %s speed device \n", (char*[]) { + printf("Hub port: %s speed device \n", (char *[]) { "Low", "Full", "High" }[port_speed]); // Check the device speed @@ -250,8 +250,8 @@ TEST_CASE("Port: enumerate child device High-speed", "[ext_port][high_speed]") TEST_ASSERT_TRUE(TEST_PORT_NUM_DEVICE_FSHS <= port_num); // Create External Port ext_port_config_t port_config = { - .context = (void*) hub_get_context() /* use any before IDF-10023 */, - .parent_dev_hdl = (void*) hub_get_context() /* use any before IDF-10023 */, + .context = (void *) hub_get_context() /* use any before IDF-10023 */, + .parent_dev_hdl = (void *) hub_get_context() /* use any before IDF-10023 */, .parent_port_num = TEST_PORT_NUM_DEVICE_FSHS, .port_power_delay_ms = hub_get_port_poweron_delay_ms(), }; @@ -260,7 +260,7 @@ TEST_CASE("Port: enumerate child device High-speed", "[ext_port][high_speed]") test_ext_port_power_on(TEST_PORT_NUM_DEVICE_FSHS, port_hdl); // Wait connection usb_speed_t port_speed = test_ext_port_connected(TEST_PORT_NUM_DEVICE_FSHS, port_hdl); - printf("Hub port: %s speed device \n", (char*[]) { + printf("Hub port: %s speed device \n", (char *[]) { "Low", "Full", "High" }[port_speed]); // Check the device speed @@ -307,8 +307,8 @@ TEST_CASE("Port: recycle", "[ext_port][full_speed][high_speed]") TEST_ASSERT_TRUE(TEST_PORT_NUM_DEVICE_FSHS <= port_num); // Create External Port ext_port_config_t port_config = { - .context = (void*) hub_get_context() /* use any before IDF-10023 */, - .parent_dev_hdl = (void*) hub_get_context() /* use any before IDF-10023 */, + .context = (void *) hub_get_context() /* use any before IDF-10023 */, + .parent_dev_hdl = (void *) hub_get_context() /* use any before IDF-10023 */, .parent_port_num = TEST_PORT_NUM_DEVICE_FSHS, .port_power_delay_ms = hub_get_port_poweron_delay_ms(), }; @@ -317,7 +317,7 @@ TEST_CASE("Port: recycle", "[ext_port][full_speed][high_speed]") test_ext_port_power_on(TEST_PORT_NUM_DEVICE_FSHS, port_hdl); // Wait connection usb_speed_t port_speed = test_ext_port_connected(TEST_PORT_NUM_DEVICE_FSHS, port_hdl); - printf("Hub port: %s speed device \n", (char*[]) { + printf("Hub port: %s speed device \n", (char *[]) { "Low", "Full", "High" }[port_speed]); // Wait disconnection @@ -331,7 +331,7 @@ TEST_CASE("Port: recycle", "[ext_port][full_speed][high_speed]") // Verify that port still available printf("Verify the port is still available...\n"); port_speed = test_ext_port_connected(TEST_PORT_NUM_DEVICE_FSHS, port_hdl); - printf("Hub port: %s speed device \n", (char*[]) { + printf("Hub port: %s speed device \n", (char *[]) { "Low", "Full", "High" }[port_speed]); // Wait disconnection @@ -352,8 +352,8 @@ TEST_CASE("Port: recycle when port is gone", "[ext_port][low_speed][full_speed][ TEST_ASSERT_TRUE(TEST_PORT_NUM_DEVICE_FSHS <= port_num); // Create External Port ext_port_config_t port_config = { - .context = (void*) hub_get_context() /* use any before IDF-10023 */, - .parent_dev_hdl = (void*) hub_get_context() /* use any before IDF-10023 */, + .context = (void *) hub_get_context() /* use any before IDF-10023 */, + .parent_dev_hdl = (void *) hub_get_context() /* use any before IDF-10023 */, .parent_port_num = TEST_PORT_NUM_DEVICE_FSHS, .port_power_delay_ms = hub_get_port_poweron_delay_ms(), }; @@ -362,7 +362,7 @@ TEST_CASE("Port: recycle when port is gone", "[ext_port][low_speed][full_speed][ test_ext_port_power_on(TEST_PORT_NUM_DEVICE_FSHS, port_hdl); // Wait connection usb_speed_t port_speed = test_ext_port_connected(TEST_PORT_NUM_DEVICE_FSHS, port_hdl); - printf("Hub port: %s speed device \n", (char*[]) { + printf("Hub port: %s speed device \n", (char *[]) { "Low", "Full", "High" }[port_speed]); @@ -397,8 +397,8 @@ TEST_CASE("Port: disable", "[ext_port][full_speed][high_speed]") TEST_ASSERT_TRUE(TEST_PORT_NUM_DEVICE_FSHS <= port_num); // Create External Port ext_port_config_t port_config = { - .context = (void*) hub_get_context() /* use any before IDF-10023 */, - .parent_dev_hdl = (void*) hub_get_context() /* use any before IDF-10023 */, + .context = (void *) hub_get_context() /* use any before IDF-10023 */, + .parent_dev_hdl = (void *) hub_get_context() /* use any before IDF-10023 */, .parent_port_num = TEST_PORT_NUM_DEVICE_FSHS, .port_power_delay_ms = hub_get_port_poweron_delay_ms(), }; @@ -407,7 +407,7 @@ TEST_CASE("Port: disable", "[ext_port][full_speed][high_speed]") test_ext_port_power_on(TEST_PORT_NUM_DEVICE_FSHS, port_hdl); // Wait connection usb_speed_t port_speed = test_ext_port_connected(TEST_PORT_NUM_DEVICE_FSHS, port_hdl); - printf("Hub port: %s speed device \n", (char*[]) { + printf("Hub port: %s speed device \n", (char *[]) { "Low", "Full", "High" }[port_speed]); printf("Disable the port ...\n"); @@ -440,8 +440,8 @@ TEST_CASE("Port: gone in state - powered on", "[ext_port][full_speed][high_speed TEST_ASSERT_TRUE(TEST_PORT_NUM_DEVICE_FSHS <= port_num); // Create External Port ext_port_config_t port_config = { - .context = (void*) hub_get_context() /* use any before IDF-10023 */, - .parent_dev_hdl = (void*) hub_get_context() /* use any before IDF-10023 */, + .context = (void *) hub_get_context() /* use any before IDF-10023 */, + .parent_dev_hdl = (void *) hub_get_context() /* use any before IDF-10023 */, .parent_port_num = TEST_PORT_NUM_DEVICE_FSHS, .port_power_delay_ms = hub_get_port_poweron_delay_ms(), }; @@ -478,8 +478,8 @@ TEST_CASE("Port: gone in state - enabled", "[ext_port][full_speed][high_speed]") TEST_ASSERT_TRUE(TEST_PORT_NUM_DEVICE_FSHS <= port_num); // Create External Port ext_port_config_t port_config = { - .context = (void*) hub_get_context() /* use any before IDF-10023 */, - .parent_dev_hdl = (void*) hub_get_context() /* use any before IDF-10023 */, + .context = (void *) hub_get_context() /* use any before IDF-10023 */, + .parent_dev_hdl = (void *) hub_get_context() /* use any before IDF-10023 */, .parent_port_num = TEST_PORT_NUM_DEVICE_FSHS, .port_power_delay_ms = hub_get_port_poweron_delay_ms(), }; @@ -488,7 +488,7 @@ TEST_CASE("Port: gone in state - enabled", "[ext_port][full_speed][high_speed]") test_ext_port_power_on(TEST_PORT_NUM_DEVICE_FSHS, port_hdl); // Wait connection usb_speed_t port_speed = test_ext_port_connected(TEST_PORT_NUM_DEVICE_FSHS, port_hdl); - printf("Hub port: %s speed device \n", (char*[]) { + printf("Hub port: %s speed device \n", (char *[]) { "Low", "Full", "High" }[port_speed]); // diff --git a/components/usb/test_apps/hcd/main/test_hcd_port.c b/components/usb/test_apps/hcd/main/test_hcd_port.c index eafa712e48..8669a8637a 100644 --- a/components/usb/test_apps/hcd/main/test_hcd_port.c +++ b/components/usb/test_apps/hcd/main/test_hcd_port.c @@ -33,7 +33,7 @@ Procedure: TEST_CASE("Test HCD port disconnect event, port enabled", "[port][low_speed][full_speed][high_speed]") { usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection - printf("Connected %s speed device \n", (char*[]) { + printf("Connected %s speed device \n", (char *[]) { "Low", "Full", "High" }[port_speed]); vTaskDelay(pdMS_TO_TICKS(100)); // Short delay send of SOF (for FS) or EOPs (for LS) diff --git a/components/usb/test_apps/usb_host/README.md b/components/usb/test_apps/usb_host/README.md index 2b702ed65a..b7e94131db 100644 --- a/components/usb/test_apps/usb_host/README.md +++ b/components/usb/test_apps/usb_host/README.md @@ -9,4 +9,3 @@ There are three sets of tests in this application: 3. High-speed: Expects high-speed USB flash disk with 2 bulk endpoints to be connected For running these tests locally, you will have to update device definitions (VID, PID, ...) in [dev_msc.c](../common/dev_msc.c) and [dev_hid.c](../common/dev_hid.c). - diff --git a/components/usb/test_apps/usb_host/main/test_usb_host_async.c b/components/usb/test_apps/usb_host/main/test_usb_host_async.c index 3d68b06495..8ef2335a37 100644 --- a/components/usb/test_apps/usb_host/main/test_usb_host_async.c +++ b/components/usb/test_apps/usb_host/main/test_usb_host_async.c @@ -327,7 +327,7 @@ TEST_CASE("Test USB Host multiconfig client (single client)", "[usb_host][full_s .bConfigurationValue = B_CONFIGURATION_VALUE, }; - xTaskCreatePinnedToCore(multiconf_client_async_task, "async client", 4096, (void*)&multiconf_params, 2, &client_task, 0); + xTaskCreatePinnedToCore(multiconf_client_async_task, "async client", 4096, (void *)&multiconf_params, 2, &client_task, 0); TEST_ASSERT_NOT_NULL_MESSAGE(client_task, "Failed to create async client task"); // Start the task xTaskNotifyGive(client_task); @@ -335,7 +335,7 @@ TEST_CASE("Test USB Host multiconfig client (single client)", "[usb_host][full_s TaskHandle_t host_lib_task_hdl; // Get Current task handle TaskHandle_t pending_task = xTaskGetCurrentTaskHandle(); - xTaskCreatePinnedToCore(host_lib_task, "host lib", 4096, (void*)pending_task, 2, &host_lib_task_hdl, 0); + xTaskCreatePinnedToCore(host_lib_task, "host lib", 4096, (void *)pending_task, 2, &host_lib_task_hdl, 0); TEST_ASSERT_NOT_NULL_MESSAGE(host_lib_task_hdl, "Failed to create host lib task"); // Wait for the device to be open diff --git a/components/usb/usb_host.c b/components/usb/usb_host.c index 70ce6efcba..9ea9f3fcc1 100644 --- a/components/usb/usb_host.c +++ b/components/usb/usb_host.c @@ -1235,7 +1235,7 @@ exit: esp_err_t usb_host_free_config_desc(const usb_config_desc_t *config_desc) { HOST_CHECK(config_desc != NULL, ESP_ERR_INVALID_ARG); - heap_caps_free((usb_config_desc_t*)config_desc); + heap_caps_free((usb_config_desc_t *)config_desc); return ESP_OK; } diff --git a/examples/peripherals/usb/device/tusb_hid/main/tusb_hid_example_main.c b/examples/peripherals/usb/device/tusb_hid/main/tusb_hid_example_main.c index 38d9529c69..cd5b3527a9 100644 --- a/examples/peripherals/usb/device/tusb_hid/main/tusb_hid_example_main.c +++ b/examples/peripherals/usb/device/tusb_hid/main/tusb_hid_example_main.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -33,7 +33,7 @@ const uint8_t hid_report_descriptor[] = { /** * @brief String descriptor */ -const char* hid_string_descriptor[5] = { +const char *hid_string_descriptor[5] = { // array of pointer to string descriptors (char[]){0x09, 0x04}, // 0: is supported language is English (0x0409) "TinyUSB", // 1: Manufacturer @@ -68,7 +68,7 @@ uint8_t const *tud_hid_descriptor_report_cb(uint8_t instance) // Invoked when received GET_REPORT control request // Application must fill buffer report's content and return its length. // Return zero will cause the stack to STALL request -uint16_t tud_hid_get_report_cb(uint8_t instance, uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen) +uint16_t tud_hid_get_report_cb(uint8_t instance, uint8_t report_id, hid_report_type_t report_type, uint8_t *buffer, uint16_t reqlen) { (void) instance; (void) report_id; @@ -81,7 +81,7 @@ uint16_t tud_hid_get_report_cb(uint8_t instance, uint8_t report_id, hid_report_t // Invoked when received SET_REPORT control request or // received data on OUT endpoint ( Report ID = 0, Type = 0 ) -void tud_hid_set_report_cb(uint8_t instance, uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize) +void tud_hid_set_report_cb(uint8_t instance, uint8_t report_id, hid_report_type_t report_type, uint8_t const *buffer, uint16_t bufsize) { } diff --git a/examples/peripherals/usb/device/tusb_midi/main/tusb_midi_main.c b/examples/peripherals/usb/device/tusb_midi/main/tusb_midi_main.c index 04fe850b36..a91c25d6cc 100644 --- a/examples/peripherals/usb/device/tusb_midi/main/tusb_midi_main.c +++ b/examples/peripherals/usb/device/tusb_midi/main/tusb_midi_main.c @@ -42,7 +42,7 @@ enum usb_endpoints { /** * @brief String descriptor */ -static const char* s_str_desc[5] = { +static const char *s_str_desc[5] = { // array of pointer to string descriptors (char[]){0x09, 0x04}, // 0: is supported language is English (0x0409) "TinyUSB", // 1: Manufacturer diff --git a/examples/peripherals/usb/device/tusb_msc/README.md b/examples/peripherals/usb/device/tusb_msc/README.md index 134b2ecba2..84b9fd3ba4 100644 --- a/examples/peripherals/usb/device/tusb_msc/README.md +++ b/examples/peripherals/usb/device/tusb_msc/README.md @@ -24,7 +24,7 @@ As a USB stack, a TinyUSB component is used. 1. USB which accesses the ESP MSC Partition is unplugged initially and the board is powered-on. - Result: Host PC can't access the partition over USB MSC. Application example can perform operations (read, write) on partition. 2. USB which accesses the ESP MSC Partition is already plugged-in at boot time. - - Result: Host PC recongnize it as removable device and can access the partition over USB MSC. Application example can't perform any operation on partition. + - Result: Host PC recognize it as removable device and can access the partition over USB MSC. Application example can't perform any operation on partition. 3. USB which accesses the ESP MSC Partition is plugged-in at boot-up. After boot-up, it is ejected on Host PC manually by user. - Result: Host PC can't access the partition over USB MSC. Application example can perform operations (read, write) on partition. 4. USB which accesses the ESP MSC Partition is plugged-in at boot-up. It is then unplugged(removed) from Host PC manually by user. @@ -145,30 +145,30 @@ Type 'help' to get the list of commands. Use UP/DOWN arrows to navigate through command history. Press TAB when typing command name to auto-complete. I (724) main_task: Returned from app_main() -esp32s3> +esp32s3> esp32s3> help -help +help Print the list of registered commands -read +read read BASE_PATH/README.MD and print its contents -write +write create file BASE_PATH/README.MD if it does not exist -size +size show storage size and sector size -expose +expose Expose Storage to Host -status +status Status of storage exposure over USB -exit +exit exit from application -esp32s3> +esp32s3> esp32s3> read E (80054) example_main: storage exposed over USB. Application can't read from storage. Command returned non-zero error code: 0xffffffff (ESP_FAIL) @@ -183,8 +183,8 @@ storage exposed over USB: Yes esp32s3> expose E (108344) example_main: storage is already exposed Command returned non-zero error code: 0xffffffff (ESP_FAIL) -esp32s3> -esp32s3> +esp32s3> +esp32s3> esp32s3> read Mass Storage Devices are one of the most common USB devices. It use Mass Storage Class (MSC) that allow access to their internal data storage. In this example, ESP chip will be recognised by host (PC) as Mass Storage Device. @@ -198,6 +198,6 @@ esp32s3> expose I (181224) example_main: Unmount storage... esp32s3> status storage exposed over USB: Yes -esp32s3> +esp32s3> esp32s3> ``` diff --git a/examples/peripherals/usb/host/cdc/cdc_acm_host/README.md b/examples/peripherals/usb/host/cdc/cdc_acm_host/README.md index 504c16e549..8e69909f31 100644 --- a/examples/peripherals/usb/host/cdc/cdc_acm_host/README.md +++ b/examples/peripherals/usb/host/cdc/cdc_acm_host/README.md @@ -11,7 +11,7 @@ This example shows how to use the CDC-ACM Host Driver to allow an ESP chip to co ### Hardware Required -Two development boards with USB-OTG support. One will act as USB host and the other as USB device. +Two development boards with USB-OTG support. One will act as USB host and the other as USB device. #### Pin Assignment diff --git a/examples/peripherals/usb/host/hid/README.md b/examples/peripherals/usb/host/hid/README.md index 9c52850ee8..d2efef2792 100644 --- a/examples/peripherals/usb/host/hid/README.md +++ b/examples/peripherals/usb/host/hid/README.md @@ -37,25 +37,25 @@ Mouse X: 000883 Y: 000058 | |o| ``` -Where every keyboard key printed as char symbol if it is possible and a Hex value for any other key. +Where every keyboard key printed as char symbol if it is possible and a Hex value for any other key. #### Keyboard input data Keyboard input data starts with the word "Keyboard" and every pressed key is printed to the serial debug. -Left or right Shift modifier is also supported. +Left or right Shift modifier is also supported. ``` Keyboard Hello, ESP32 USB HID Keyboard is here! ``` -#### Mouse input data -Mouse input data starts with the word "Mouse" and has the following structure. +#### Mouse input data +Mouse input data starts with the word "Mouse" and has the following structure. ``` Mouse X: -00343 Y: 000183 | |o| | | | | | | | +- Right mouse button pressed status ("o" - pressed, " " - not pressed) | | +--- Left mouse button pressed status ("o" - pressed, " " - not pressed) - | +---------- Y relative coordinate of the cursor - +----------------------- X relative coordinate of the cursor + | +---------- Y relative coordinate of the cursor + +----------------------- X relative coordinate of the cursor ``` diff --git a/examples/peripherals/usb/host/msc/README.md b/examples/peripherals/usb/host/msc/README.md index 46a8cc007d..08bdcda8de 100644 --- a/examples/peripherals/usb/host/msc/README.md +++ b/examples/peripherals/usb/host/msc/README.md @@ -27,7 +27,7 @@ The example is run in a loop so that it can demonstrate USB connection and recon ### USB Host Limitations #### ESP32-S2 & ESP32-S3 -The USB OTG peripheral on ESP32-S2 and ESP32-S3 in host mode supports **up to 8 bidirectional endpoints**. Each of these endpoints can be configured as either IN or OUT. +The USB OTG peripheral on ESP32-S2 and ESP32-S3 in host mode supports **up to 8 bidirectional endpoints**. Each of these endpoints can be configured as either IN or OUT. Since each USB Mass Storage Class (MSC) device typically requires **3 endpoints** (Control, BULK IN, and BULK OUT), and USB hubs also consume endpoints (Control, INTERRUPT IN), this limits the theoretical maximum number of connected MSC devices to **2**. diff --git a/examples/peripherals/usb/host/usb_host_lib/README.md b/examples/peripherals/usb/host/usb_host_lib/README.md index e7a2028e18..3e09beb243 100644 --- a/examples/peripherals/usb/host/usb_host_lib/README.md +++ b/examples/peripherals/usb/host/usb_host_lib/README.md @@ -64,7 +64,7 @@ See the Getting Started Guide for full steps to configure and use ESP-IDF to bui I (305) main_task: Started on CPU0 I (315) main_task: Calling app_main() I (315) USB host lib: USB host library example -I (315) gpio: GPIO[0]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2 +I (315) gpio: GPIO[0]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2 I (325) USB host lib: Installing USB Host Library I (365) CLASS: Registering Client I (745) CLASS: Opening device at address 1 diff --git a/tools/mocks/usb/usb_host_full_mock/usb/mock_add_usb_device.c b/tools/mocks/usb/usb_host_full_mock/usb/mock_add_usb_device.c index f683af647a..29a646077f 100644 --- a/tools/mocks/usb/usb_host_full_mock/usb/mock_add_usb_device.c +++ b/tools/mocks/usb/usb_host_full_mock/usb/mock_add_usb_device.c @@ -14,7 +14,6 @@ #include "freertos/FreeRTOS.h" #include "freertos/semphr.h" - #define MOCK_CHECK(cond, ret_val) ({ \ if (!(cond)) { \ return (ret_val); \ @@ -32,7 +31,6 @@ #define IS_VALID_ADDRESS(address) ((address) != 0xFF) #define IS_EMPTY_ADDRESS(address) ((address) == 0xFF) - const char *MOCK_TAG_CB = "USB MOCK CB"; // Tag for callback functions const char *MOCK_TAG = "USB MOCK"; // Tag for the rest of the functions @@ -56,10 +54,9 @@ typedef struct { static device_list_t device_list[MAX_DEV_COUNT]; static unsigned mocked_devices_count = 0; - void usb_host_mock_dev_list_init(void) { - for(int index = 0; index < MAX_DEV_COUNT; index++) { + for (int index = 0; index < MAX_DEV_COUNT; index++) { device_list[index].address = 0xFF; device_list[index].opened = 0; device_list[index].dev_desc = NULL; @@ -98,7 +95,7 @@ esp_err_t usb_host_mock_add_device(uint8_t dev_address, const usb_device_desc_t */ static void _print_mocked_device(int index) { - ESP_LOGI(MOCK_TAG, "Device handle = %p", (void*)(&device_list[index])); + ESP_LOGI(MOCK_TAG, "Device handle = %p", (void *)(&device_list[index])); ESP_LOGI(MOCK_TAG, "Device address = %d", device_list[index].address); ESP_LOGI(MOCK_TAG, "Device opened by = %d clients", device_list[index].opened); @@ -113,12 +110,12 @@ esp_err_t usb_host_mock_print_mocked_devices(uint8_t dev_address) // dev_address is 0xFF, print all devices from device_list if (IS_EMPTY_ADDRESS(dev_address)) { - for(int index = 0; index < MAX_DEV_COUNT; index++) { - if(IS_VALID_ADDRESS(device_list[index].address)) { + for (int index = 0; index < MAX_DEV_COUNT; index++) { + if (IS_VALID_ADDRESS(device_list[index].address)) { _print_mocked_device(index); } } - // Print only device at dev_address + // Print only device at dev_address } else { if (IS_VALID_ADDRESS(device_list[dev_address].address)) { _print_mocked_device(dev_address); @@ -194,7 +191,7 @@ esp_err_t usb_host_client_register_mock_callback(const usb_host_client_config_t esp_err_t ret; // Create client object - client_t *client_obj = (client_t*)calloc(1, sizeof(client_t)); + client_t *client_obj = (client_t *)calloc(1, sizeof(client_t)); SemaphoreHandle_t event_sem = xSemaphoreCreateBinary(); if (client_obj == NULL || event_sem == NULL) { ret = ESP_ERR_NO_MEM; @@ -261,7 +258,7 @@ esp_err_t usb_host_device_open_mock_callback(usb_host_client_handle_t client_hdl MOCK_CHECK(dev_address < MAX_DEV_COUNT && client_hdl != NULL && dev_hdl_ret != NULL, ESP_ERR_INVALID_ARG); // Find a device in dev_list by dev_address for (int index = 0; index < MAX_DEV_COUNT; index++) { - if(device_list[index].address == dev_address) { + if (device_list[index].address == dev_address) { // We should check, if the device has not been opened by the same client // But we are keeping this mock implementation simple @@ -282,7 +279,7 @@ esp_err_t usb_host_device_open_mock_callback(usb_host_client_handle_t client_hdl esp_err_t usb_host_device_close_mock_callback(usb_host_client_handle_t client_hdl, usb_device_handle_t dev_hdl, int call_count) { MOCK_CHECK(dev_hdl != NULL && client_hdl != NULL, ESP_ERR_INVALID_ARG); - device_list_t* current_device = (device_list_t *) dev_hdl; + device_list_t *current_device = (device_list_t *) dev_hdl; if (current_device->opened == 0) { // Device was never opened @@ -305,7 +302,7 @@ esp_err_t usb_host_device_addr_list_fill_mock_callback(int list_len, uint8_t *de int found_devices_count = 0; for (int index = 0; index < MAX_DEV_COUNT; index++) { - if(IS_VALID_ADDRESS(device_list[index].address) && (found_devices_count < list_len)) { + if (IS_VALID_ADDRESS(device_list[index].address) && (found_devices_count < list_len)) { dev_addr_list[found_devices_count++] = device_list[index].address; } } @@ -325,7 +322,7 @@ esp_err_t usb_host_get_device_descriptor_mock_callback(usb_device_handle_t dev_h MOCK_CHECK(dev_hdl != NULL && device_desc != NULL, ESP_ERR_INVALID_ARG); ESP_LOGD(MOCK_TAG_CB, "Get device descriptor"); - const device_list_t* current_device = (const device_list_t *) dev_hdl; + const device_list_t *current_device = (const device_list_t *) dev_hdl; *device_desc = current_device->dev_desc; return ESP_OK; } @@ -335,7 +332,7 @@ esp_err_t usb_host_get_active_config_descriptor_mock_callback(usb_device_handle_ MOCK_CHECK(dev_hdl != NULL && config_desc != NULL, ESP_ERR_INVALID_ARG); ESP_LOGD(MOCK_TAG_CB, "Get active config descriptor"); - const device_list_t* current_device = (const device_list_t *) dev_hdl; + const device_list_t *current_device = (const device_list_t *) dev_hdl; *config_desc = current_device->config_desc; return ESP_OK; }