samples: subsys: usb: shell: allow host-only operation#105005
samples: subsys: usb: shell: allow host-only operation#105005kartben merged 1 commit intozephyrproject-rtos:mainfrom
Conversation
c341247 to
e708d95
Compare
|
Force-push:
|
|
|
This pull request has been marked as stale because it has been open (more than) 30 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 7 days. Note, that you can always re-open a closed pull request at any time. |
e708d95 to
6411aa8
Compare
|
Force-push:
|
|
|
||
| For the USB host functionality a supported host controller is required, | ||
| currently it is only MAX3421E. The example can be built as follows: | ||
| Assuming the board has a supported USB device controller, the example can be |
There was a problem hiding this comment.
| Assuming the board has a supported USB device controller, the example can be | |
| Assuming the board has a supported USB host controller, the example can be |
host not device
| .. zephyr-app-commands:: | ||
| :zephyr-app: samples/subsys/usb/shell | ||
| :board: nrf52840dk/nrf52840 | ||
| :shield: sparkfun_max3421e |
There was a problem hiding this comment.
if we assume that the board ahs a host controller, then the shield should not be needed
There was a problem hiding this comment.
Very true, the description does say "assuming the board has a supported USB host controller", picking FRDM-RW612 in the meantime that nRF54LM20's DWC2 is ready.
| platform_allow: | ||
| - nrf52840dk/nrf52840 | ||
| - frdm_k64f | ||
| build_only: true |
There was a problem hiding this comment.
if we take the changes of #105083 for adding the usbh tag
nrf52840dk/nrf52840 and frdm_k64f both don't not have that tag, so it wouldn't be tested
Might be an idea to have two cases of this, one that depends of the usbh tag but without the shield and one for the shield variant but then without the usbh tag, as the original boards don't have a host controller
There was a problem hiding this comment.
Good point, there is no tag for shields.
| - shield | ||
| extra_args: | ||
| - CONF_FILE="device_and_host_prj.conf" | ||
| - CONF_FILE="prj_host.conf" |
There was a problem hiding this comment.
if we use the CONF_FILE argument the board specific files in boards are ignored. see https://docs.zephyrproject.org/latest/build/kconfig/setting.html#the-initial-configuration But for qemu boards i need to set
CONFIG_QEMU_EXTRA_FLAGS="-device usb-ccid"
for example (see https://qemu-project.gitlab.io/qemu/system/devices/usb.html) to add usb devices to the bus
There was a problem hiding this comment.
To avoid skipping board-specific conf, there need to be no -DCONF_FILE, we can only rely on -DEXTRA_CONF_FILE= and -DFILE_SUFFIX=.
I suspect enabling the USB Host/Device controllers might happen in a board-specific way, so this narrows it down to FILE_SUFFIX= to have have per-board host/device variants too.
I will try with this thank you.
6411aa8 to
310c63c
Compare
|
@maass-hamburg does it solve your use-case now? It should be possible to have a |
|
|
||
| .. zephyr-app-commands:: | ||
| :zephyr-app: samples/subsys/usb/shell | ||
| :board: frdm_k11f |
There was a problem hiding this comment.
What board is frdm_k11f?
There was a problem hiding this comment.
This is a plain typo! In reaction to #105005 (comment) I tried to pick a board with zephyr_uhc0 enabled, and found frdm_k22f.
What board should I target for the host-only operation?
| Assuming the board has **both** a supported USB device and host controller | ||
| (i.e. using an USB host shield), the example can be built like: |
There was a problem hiding this comment.
| Assuming the board has **both** a supported USB device and host controller | |
| (i.e. using an USB host shield), the example can be built like: | |
| Assuming the board has a supported USB device and host controller, | |
| the example can be built like: |
Also, I want to keep device_and_host, perhaps renamed to prj_device_and_host.conf. The meaning of both is unclear. I also prefer to explicitly describe how prj_*.conf is supposed to be used because things like -DFILE_SUFFIX=both are less accessible.
There was a problem hiding this comment.
done
I confirm native_sim works:
$ west twister -s sample.usbh.shell.virtual
...
$ twister-out/native_sim_native_64/host_gnu/samples/subsys/usb/shell/sample.usbh.shell.virtual/zephyr/zephyr.exe
uart connected to pseudotty: /dev/pts/3
*** Booting Zephyr OS build v4.4.0-1127-ga63b0b2b2587 ***
Then connecting to /dev/pts/3 permits communication with the USB host and device shell to
| @@ -1,12 +1,13 @@ | |||
| CONFIG_SHELL=y | |||
There was a problem hiding this comment.
What is the point to reorder all the lines? I do not see a good reason and it just makes it harder to review.
There was a problem hiding this comment.
I wanted to merge the host and device side back together after splitting them, but now I realize this is already there upstream, so I should use this instead.
| depends_on: | ||
| - usbd | ||
| tags: | ||
| - usbd |
There was a problem hiding this comment.
The tag is usb and should not be changed. Should not be mixed with the supported feature usbd this sample depends on. Same applies to usbh.
There was a problem hiding this comment.
Thank you for the distinction between features and tags.
| extra_args: | ||
| - FILE_SUFFIX=host | ||
| platform_allow: | ||
| - rd_rw612_bga |
There was a problem hiding this comment.
Could you verify that this board is working?
There was a problem hiding this comment.
No as unfortunately not available to the public.
This was used for UVC Host by @AidenHu.
Glad to know which board to use in the meantime this gets ready. Maybe still using the nRF52840 with the shield for now?
(In the meantime, I am hurrying on DWC2 Host...)
There was a problem hiding this comment.
Let's keep rd_rw612_bga, we can replace it with integration_platforms later.
| tags: usb | ||
| extra_args: CONF_FILE="device_and_host_prj.conf" | ||
| depends_on: | ||
| - usbh | ||
| - usbd | ||
| tags: | ||
| - usbh | ||
| - usbd | ||
| extra_args: | ||
| - FILE_SUFFIX=both | ||
| - EXTRA_DTC_OVERLAY_FILE="virtual.conf" |
There was a problem hiding this comment.
I wanted to replace qemu_contex_m3 with native_sim for a long time. As you are changing it, please replace platform_allow: qemu_cortex_m3 with platform_allow: native_sim. Note, EXTRA_DTC_OVERLAY_FILE should be EXTRA_DTC_OVERLAY_FILE="virtual.overlay". Remove boards/qemu_cortex_m3.* overlays.
There was a problem hiding this comment.
I will double-check what the CI is doing, maybe it ignored this so did not raise an error. Sorry for this typo.
In order to allow host-only operation, replace the configuration files
by prj_{host,device,device_and_host}.conf selected by the extra command
line flag -DFILE_SUFFIX={host,device,device_and_host}.
The virtual USB bus is still usable by adding this to any configuration
-DEXTRA_DTC_OVERLAY_FILE=virtual.overlay
Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
310c63c to
59fce8d
Compare
|



Update build instructions to allow host-only operation.
Doc build https://builds.zephyrproject.io/zephyr/pr/105005/docs/samples/subsys/usb/shell/README.html#usb-shell
Testing
device(hardware):Testing
host+virtual(native_sim):Testing
device+host+virtual(native_sim):