Skip to content

arch/arm/src/stm32h5/stm32_usbdrdhost.c: Fixed Hub support#18761

Merged
xiaoxiang781216 merged 1 commit intoapache:masterfrom
dlizewski:feature/dl.stm32h5_hub
Apr 19, 2026
Merged

arch/arm/src/stm32h5/stm32_usbdrdhost.c: Fixed Hub support#18761
xiaoxiang781216 merged 1 commit intoapache:masterfrom
dlizewski:feature/dl.stm32h5_hub

Conversation

@dlizewski
Copy link
Copy Markdown

Fixed a few bugs in the initial stm32_usbdrdhost.c implementation when using a USB hub. Fixed fault when freeing control endpoints. Fixed crash when disconnecting devices from hubs due ot use after free.

Note: Please adhere to Contributing Guidelines.

Summary

In the initial STM32H5 USB host support I forgot to test devices with a USB hub.
A few changes were needed to get USB hub working.
Added missing hub specific calls and fixed freeing control endpoints that were allocated through the hub.

I also fixed a crash when disconnecting a device from a hub becasue connport->devclass->connect was
already set to NULL after CLASS_DISCONNECTED

Impact

  • Given that I only merged STM32H5 USB host 2 days ago and this only adds support, there should ne no negative impact.
    Only adds new features.

Testing

  • I have updated nucleo-h563zi:nshmsc to enable USB hub support.
  • With full USB info debugs enabled,:
  • I connected a hub
  • connected a USB thumb drive to the hub
  • disconnected the drive from the hub
  • reconnected the drive
  • disconnected the hub and drive together
  • reconnected
  • verified the thumb drive is still working by running the commands:
mount -t vfat /dev/sda /mnt/flash
ls /mnt/flash
cat /mnt/flash/TEST_F~1.TXT

Logs of the above are attached:
stm32h5_usb_with_hub.txt

Fixed a few bugs in the initial stm32_usbdrdhost.c implementation
when using a USB hub. Fixed fault when freeing control endpoints.
Fixed crash when disconnecting devices from hubs due ot use after free.

Signed-off-by: daniellizewski <daniellizewski@geotab.com>
@github-actions github-actions Bot added Arch: arm Issues related to ARM (32-bit) architecture Size: M The size of the change in this PR is medium Area: USB Board: arm labels Apr 18, 2026
@xiaoxiang781216 xiaoxiang781216 merged commit 1632bea into apache:master Apr 19, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm Issues related to ARM (32-bit) architecture Area: USB Board: arm Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants