-
Notifications
You must be signed in to change notification settings - Fork 34
refactor(usb_host): Move parent-child tree management to Hub Driver #267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(usb_host): Move parent-child tree management to Hub Driver #267
Conversation
eccd779 to
33e40ea
Compare
33e40ea to
a6bb309
Compare
| } | ||
| #endif // ENABLE_USB_HUBS | ||
|
|
||
| memset(parent_info, 0, sizeof(usb_parent_dev_info_t)); |
Check warning
Code scanning / clang-tidy
Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling] Warning
a6bb309 to
e928ef9
Compare
e928ef9 to
ba45f1c
Compare
ba45f1c to
e3e2d8c
Compare
e3e2d8c to
eee4e89
Compare
eee4e89 to
1e9a582
Compare
…uld come any moment
1e9a582 to
d9045f6
Compare
Description
parent_dev_hdlfrom the layers, that don't keep the device opened).Changes
parent_dev_hdlfrom the Enumeration and External Port DriversThe Enumeration Driver
Removed parent device information from the Enumeration Driver. The Driver operates only with device tree node and its uid.
Changes in:
The Hub Driver and device tree node
Removed parent device handle from the device tree node. Device tree node has the void* pointer to the parent (which is NULL when the port is part of the Root Hub, and external hub handle when the port is a part of external hub).
As the device tree node doesn't contain parent information and contain the external hub handle, we don't need to convert
usb_device_handle_ttoext_hub_handle_t.Added the possibility to get the external hub device speed to compare it with the speed of the port.
Changes in:
The External Port Driver
Removed parent device handle from the External Port Driver and updated the test accordingly.
Refactored the output, as the Driver doesn't have any information about the parent device from the USBH now (address, speed ...).
Changes in:
The USBH Driver
Now, the parent information contains in the device tree node, so when the
usb_host_device_infois requested we collect information from two drivers: Hub (parent information) and USBH (device itself).Changes in:
Additional Information
Device tree node
Device Tree Node - is a combination of the Port (Root Hub port or External downstream port) and inserted in this port USB Device.
When both (port and device) are present, Device Tree Node is available.
Device tree node creation:
Related
Testing
Checklist
Before submitting a Pull Request, please ensure the following:
Note
Shift parent-child management to the Hub driver; replace parent handle/port with node UID across stack, update APIs/events, add helpers, and align tests/logging.
Core Refactor (topology ownership):
dev_hdl/port_numflow with node UID across Enumerator, Hub, USBH, and usb_host layers.parentcontext (NULL for root,ext_hub_handle_tfor hubs) andport_num.Hub Driver (
hub.c/hub.h):hub_node_recycle(),hub_node_reset(),hub_node_active(),hub_node_disable(),hub_node_get_info(); removedhub_port_*usage.port_numand hub speed viaext_hub_get_speed().Enumerator (
enum.h/.c):node_uidand optionaldev_hdlonly; removed parent handle/port in events and context.node_uid.External Hub (
ext_hub.h/.c):ext_hub_get_handle(); add gettersext_hub_get_speed()andext_hub_get_dev_addr().port_num.External Port (
ext_port.h/.c):ext_port_event_cb_t(ext_port_hdl_t, ext_port_event_t, ...)(no event payload struct).ext_port_config_tdrops parent device handle; usescontext+port_num.USBH (
usbh.h/.c) & Host (usb_host.c):usbh_dev_get_uid().USBH_EVENT_DEV_FREEpayload trimmed; host now useshub_node_*APIs andhub_node_get_info()to assemble parent info inusb_host_device_info.Types (
usb_types_stack.h):usb_parent_dev_info_t: deprecatedev_hdl, adddev_addr; keepport_num.Tests:
Written by Cursor Bugbot for commit e928ef9. This will update automatically on new commits. Configure here.