Skip to content

Commit 3fd17b8

Browse files
committed
refactor(hub): Applied new ext_hub api, refactor func names
1 parent fc61875 commit 3fd17b8

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

components/usb/hub.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ esp_err_t hub_port_disable(usb_device_handle_t parent_dev_hdl, uint8_t parent_po
771771
return ret;
772772
}
773773

774-
esp_err_t hub_notify_new_dev(uint8_t dev_addr)
774+
esp_err_t hub_dev_new(uint8_t dev_addr)
775775
{
776776
HUB_DRIVER_ENTER_CRITICAL();
777777
HUB_DRIVER_CHECK_FROM_CRIT(p_hub_driver_obj != NULL, ESP_ERR_INVALID_STATE);
@@ -794,15 +794,15 @@ esp_err_t hub_notify_new_dev(uint8_t dev_addr)
794794
}
795795
}
796796
// Close device
797-
usbh_dev_close(dev_hdl);
797+
ESP_ERROR_CHECK(usbh_dev_close(dev_hdl));
798798
}
799-
// Logic should not stop the flow, so no error to return
800-
ret = ESP_OK;
799+
// Nothing to do, while Hubs support is not enabled
800+
ret = ESP_ERR_NOT_SUPPORTED;
801801
#endif // ENABLE_USB_HUBS
802802
return ret;
803803
}
804804

805-
esp_err_t hub_notify_dev_gone(uint8_t dev_addr)
805+
esp_err_t hub_dev_gone(uint8_t dev_addr)
806806
{
807807
HUB_DRIVER_ENTER_CRITICAL();
808808
HUB_DRIVER_CHECK_FROM_CRIT(p_hub_driver_obj != NULL, ESP_ERR_INVALID_STATE);
@@ -813,7 +813,7 @@ esp_err_t hub_notify_dev_gone(uint8_t dev_addr)
813813
ret = ext_hub_dev_gone(dev_addr);
814814
#else
815815
// Nothing to do, while Hubs support is not enabled
816-
ret = ESP_OK;
816+
ret = ESP_ERR_NOT_SUPPORTED;
817817
#endif // ENABLE_USB_HUBS
818818
return ret;
819819
}
@@ -825,7 +825,9 @@ esp_err_t hub_notify_all_free(void)
825825
HUB_DRIVER_CHECK_FROM_CRIT(p_hub_driver_obj != NULL, ESP_ERR_INVALID_STATE);
826826
HUB_DRIVER_EXIT_CRITICAL();
827827

828-
return ext_hub_all_free();
828+
ext_hub_mark_all_free();
829+
830+
return ESP_OK;
829831
}
830832
#endif // ENABLE_USB_HUBS
831833

components/usb/private_include/hub.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ esp_err_t hub_port_disable(usb_device_handle_t parent_dev_hdl, uint8_t parent_po
206206
* - ESP_OK: New device added successfully
207207
* - ESP_ERR_INVALID_STATE: Hub driver is not in a correct state
208208
*/
209-
esp_err_t hub_notify_new_dev(uint8_t dev_addr);
209+
esp_err_t hub_dev_new(uint8_t dev_addr);
210210

211211
/**
212212
* @brief Notify Hub driver that device has been removed
@@ -222,7 +222,7 @@ esp_err_t hub_notify_new_dev(uint8_t dev_addr);
222222
* - ESP_OK: A device removed successfully
223223
* - ESP_ERR_INVALID_STATE: Hub driver is not in a correct state
224224
*/
225-
esp_err_t hub_notify_dev_gone(uint8_t dev_addr);
225+
esp_err_t hub_dev_gone(uint8_t dev_addr);
226226

227227
#if ENABLE_USB_HUBS
228228
/**

0 commit comments

Comments
 (0)