Skip to content

Conversation

@roma-jam
Copy link
Contributor

@roma-jam roma-jam commented Oct 10, 2025

Description

Removed parent device information from the Enumeration Driver. The Driver operates only with device tree node and its uid.

Related

Testing

USB Host target tests with and without external hub.


Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

Note

Switches Enum and Hub to operate by device-tree node UID, renaming hub_port_* -> hub_node_* and simplifying enum events to carry node_uid/dev_hdl.

  • API:
    • Enum events: enum_event_data_t simplified to event, node_uid, dev_hdl; per-event unions and parent port fields removed.
    • Hub API rename: hub_port_{recycle,reset,active,disable} -> hub_node_{recycle,reset,active,disable}; params now node_uid; add ESP_ERR_NOT_FOUND when node missing.
  • Hub Driver:
    • Add dev_tree_node_get_by_uid() and use node-based operations for root/external hubs in recycle/reset/active/disable paths.
    • Node removal now keyed by parent info retrieved from node; improved messages.
  • Enum Driver:
    • Track node_uid instead of parent handle/port; update event emissions (started/reset-required/completed/canceled) and logging; cleanup state accordingly.
    • No functional enum sequence change; internal logs/error handling slightly adjusted.
  • Host Library:
    • Update callbacks to use hub_node_* and new enum event data; on DEV_FREE call hub_node_recycle(uid).
  • Meta: SPDX year ranges updated in touched files.

Written by Cursor Bugbot for commit 257d193. This will update automatically on new commits. Configure here.

@roma-jam roma-jam changed the title refactor(enum): Removed parent_dev_hdl and parent_port_num refactor(usb_host): Removed parent_dev_hdl and parent_port_num from Enum Driver Oct 10, 2025
@roma-jam roma-jam changed the title refactor(usb_host): Removed parent_dev_hdl and parent_port_num from Enum Driver refactor(usb_host): Removed parent_dev_hdl and parent_port_num from Enum Driver (part1/4) Oct 10, 2025
@roma-jam roma-jam self-assigned this Oct 10, 2025
@roma-jam roma-jam marked this pull request as ready for review October 10, 2025 14:28
@roma-jam roma-jam added the Component: usb_host Issue affects usb_host component label Oct 10, 2025
Copy link
Collaborator

@tore-espressif tore-espressif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roma-jam LGTM. What is the reason for targeting refactor/usb_host_parent_child_deps instead of master?

Copy link
Collaborator

@peter-marcisovsky peter-marcisovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just minor corrections

@roma-jam
Copy link
Contributor Author

roma-jam commented Oct 14, 2025

@tore-espressif,

the goal is to remove the parent_dev_hdl from the External Port driver, so the changes mainly affect external hubs and do not provide any potential risk for the devices, connected to the root port directly.

As we do not have the external hubs verification in CI, I did it manually (launch the pytest) and only for the last (part4/4) MR, which delivers the complete refactoring.

So, as reviewing the large amount of changes can provide difficulties and hide the main idea of the changes, I decided to split them to several logically independent PRs, targeting to a separate branch, to merge this branch later to master (with full refactoring in all layers).

UPD: but actually, I reviewed the changes in this exactly PR, keeping in mind your note and I see, that this one can be merged directly to master.
I will check the pytest locally with external hubs, and if there will be no problems, I could change the target branch to master for this one.

@tore-espressif
Copy link
Collaborator

@roma-jam up to you. I agree that this 1st PR is simple enough and can be merged to master after 1.0.1 release

@roma-jam
Copy link
Contributor Author

@tore-espressif I checked the usb_host test locally and we can change the target branch to master for with one.

can be merged to master after 1.0.1 release

I have created the next milestone after 1.0.1 release for this case.

@roma-jam roma-jam added this to the usb_host v1.0.2 milestone Oct 14, 2025
@roma-jam roma-jam changed the base branch from refactor/usb_host_parent_child_deps to master October 14, 2025 08:51
@roma-jam roma-jam force-pushed the refactor/usb_host_parent_child_deps_part1 branch from 138be1b to 37de6d7 Compare October 14, 2025 09:00
…with node uid

- Changed the interaction between two layers: Enum and Hub. Instead of keeping the parent_dev_hdl and parent_port_num the Enumerator operates with node_uid.
@roma-jam roma-jam force-pushed the refactor/usb_host_parent_child_deps_part1 branch from 37de6d7 to 257d193 Compare November 20, 2025 11:40
@roma-jam roma-jam merged commit 561b647 into master Nov 20, 2025
65 checks passed
@roma-jam roma-jam deleted the refactor/usb_host_parent_child_deps_part1 branch November 20, 2025 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: usb_host Issue affects usb_host component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants