Add embassy-usb-host support#5283
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
New commits in main has made this PR unmergable. Please resolve the conflicts. |
|
Amazing! Do you also plan on adding UVC device support? |
I think that's a little out of scope for this whole repository 😅 |
|
oh I thought that comment was made against the embassy repo 😅 I don't know if I have an appropriate camera, but maybe Claude can draft something up? |
|
New commits in main has made this PR unmergable. Please resolve the conflicts. |
There was a problem hiding this comment.
Pull request overview
This PR adds USB OTG FS host-mode support via embassy-usb-host and refactors the existing OTG FS support into a dedicated otg_fs/ module layout, updating examples and metadata to use the new driver modules.
Changes:
- Introduces
esp_hal::otg_fs::embassy_usb_hosthost controller driver based onembassy-usb-host. - Moves the existing embassy USB device-mode integration into
esp_hal::otg_fs::embassy_usb_deviceand updates async examples accordingly. - Updates esp-metadata (and generated metadata) to attach the
USBperipheral interrupt toUSB0.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| examples/async/embassy_usb_serial/src/main.rs | Updates import path to the new otg_fs::embassy_usb_device module. |
| examples/async/embassy_usb_ethernet/src/main.rs | Updates import path to the new otg_fs::embassy_usb_device module. |
| examples/async/embassy_usb_ethernet/Cargo.lock | Updates esp-pacs git rev in the example lockfile. |
| examples/async/embassy_usb_hid_host/src/main.rs | Adds a new async HID host example using embassy-usb-host. |
| examples/async/embassy_usb_hid_host/Cargo.toml | Adds a new example crate manifest for the HID host example. |
| examples/async/embassy_usb_hid_host/.cargo/config.toml | Adds example-specific runner/rustflags and build-std config. |
| esp-metadata/devices/esp32s2.toml | Associates USB0 with the USB peripheral interrupt. |
| esp-metadata/devices/esp32s3.toml | Associates USB0 with the USB peripheral interrupt. |
| esp-metadata-generated/src/_generated_esp32s2.rs | Regenerates peripheral interrupt bindings for USB0. |
| esp-metadata-generated/src/_generated_esp32s3.rs | Regenerates peripheral interrupt bindings for USB0. |
| esp-hal/src/otg_fs/mod.rs | New OTG FS module root, factoring common USB peripheral setup and exposing host/device submodules. |
| esp-hal/src/otg_fs/embassy_usb_device.rs | New embassy-usb device-mode driver wrapper with custom init/interrupt binding. |
| esp-hal/src/otg_fs/embassy_usb_host.rs | New embassy-usb-host controller driver and interrupt wiring. |
| esp-hal/src/otg_fs.rs | Removes the previous monolithic OTG FS module file (replaced by otg_fs/). |
| esp-hal/Cargo.toml | Enables embassy-usb-synopsys-otg host feature to support host mode. |
| esp-hal/CHANGELOG.md | Adds changelog entries for host support and the device module move. |
| on_host_interrupt( | ||
| Driver::REGISTERS, | ||
| &HOST_STATE, | ||
| Usb::MAX_EP_COUNT.min(Usb::MAX_HOST_CH_COUNT), | ||
| ) | ||
| } |
|
New commits in main have made this PR unmergeable. Please resolve the conflicts. |
|
New commits in main have made this PR unmergeable. Please resolve the conflicts. |
|
New commits in main have made this PR unmergeable. Please resolve the conflicts. |
|
Seems the hid-host doesn't work for me - it doesn't enumerate. Might be my soldering however - so would be good if someone else could give it a try. usb-device still works fine for me, code LGTM |
|
New commits in main have made this PR unmergeable. Please resolve the conflicts. |
|
New commits in main have made this PR unmergeable. Please resolve the conflicts. |

Implementation for embassy-rs/embassy#5633