Support multiple devices to connect with usb host if usb hub is used#99591
Support multiple devices to connect with usb host if usb hub is used#99591AidenHu wants to merge 2 commits intozephyrproject-rtos:mainfrom
Conversation
091e8b6 to
0be1c7c
Compare
| SYS_DLIST_FOR_EACH_NODE(&uhs_ctx->udevs, node) { | ||
| device_count++; | ||
| } |
There was a problem hiding this comment.
I think you can use device_count = sys_dlist_len(&uhs_ctx->udevs); in this case.
But let's discuss on https://github.com/zephyrproject-rtos/zephyr/pull/99591/files#r2538708506 first?
There was a problem hiding this comment.
@
I think you can use
device_count = sys_dlist_len(&uhs_ctx->udevs);in this case.But let's discuss on https://github.com/zephyrproject-rtos/zephyr/pull/99591/files#r2538708506 first?
@josuah agree, already done for sys_dlist_len
| if (device_count == 1U) { | ||
| err = uhc_bus_reset(uhs_ctx->dev); | ||
| if (err) { | ||
| LOG_ERR("Failed to signal bus reset"); | ||
| return err; | ||
| } |
There was a problem hiding this comment.
What about PORT_RESET hub class feature? Where this should be handled? At high-level Linux solves the issue by having a software-only hub at the top level.
There was a problem hiding this comment.
What about PORT_RESET hub class feature? Where this should be handled? At high-level Linux solves the issue by having a software-only hub at the top level.
Hi @tmon-nordic
The PORT_RESET of HUB is handled by a set feature request. This is handled in hub class layer. Actually I have finished the first version USB hub class and tested in my local project. Recently I will created one PR about it.
When hub is used, need to consider about multiple devices are attached. Signed-off-by: Aiden Hu <weiwei.hu@nxp.com>
46ef4c9 to
111a8d6
Compare
111a8d6 to
caaeeff
Compare
|
@josuah |
|
|
||
| udev = usbh_device_get_root(ctx); | ||
|
|
||
| if (udev) { |
There was a problem hiding this comment.
Comparing explicitly against NULL helps with MISRA compliance.
See rule 85 here:
https://docs.zephyrproject.org/latest/contribute/coding_guidelines/index.html#coding-guidelines
This is not strictly applied, as I remember, but it can also help keeping the code a bit more homogene.
There was a problem hiding this comment.
Comparing explicitly against
NULLhelps with MISRA compliance.See rule 85 here: https://docs.zephyrproject.org/latest/contribute/coding_guidelines/index.html#coding-guidelines
This is not strictly applied, as I remember, but it can also help keeping the code a bit more homogene.
Thanks, fixed it as the rule.
add usbh_device_get_root and usbh_device_is_root function to check root device Signed-off-by: Aiden Hu <weiwei.hu@nxp.com>
caaeeff to
4f2a48f
Compare
|




When USB hub is used, maybe multiple devices are attached, so need to consider about this.