Skip to content

tests_hw: Reset USB Port Upon Workflow Start#191

Merged
kr-t merged 2 commits intoproject-ocre:mainfrom
mgeeIOL:tests/bugfix-fix-cancelled-flash-usb-device-lockup
Mar 16, 2026
Merged

tests_hw: Reset USB Port Upon Workflow Start#191
kr-t merged 2 commits intoproject-ocre:mainfrom
mgeeIOL:tests/bugfix-fix-cancelled-flash-usb-device-lockup

Conversation

@mgeeIOL
Copy link
Copy Markdown
Collaborator

@mgeeIOL mgeeIOL commented Mar 12, 2026

Description

When a GHA run was cancelled while on a west flash command the USB port would be left in an unexpected state and future GHA runs would fail as west flash could not successfully run. The aim of this PR is to find a fix

Current planned fix is to add a step to the setup job for the b_u585i_iot02a workflow file to reset the USB connection. This should fix unexpected states the connection is left in as the result of an interrupted west flash command during a cancelled GHA run.

@mgeeIOL mgeeIOL force-pushed the tests/bugfix-fix-cancelled-flash-usb-device-lockup branch 9 times, most recently from ef21fd0 to 3beceff Compare March 12, 2026 19:16
Added step to the setup job for the b_u585i_iot02a workflow file to reset
the USB connection. This should fix unexpected states the connection is
left in as the result of an interrupted west flash command during a
cancelled GHA run.

Also added additional step to do the same process within the container
as it appears the USB connection on the container is affecting the
workflow.

Signed-off-by: Matthew Gee <mgee@iol.unh.edu>
@mgeeIOL mgeeIOL force-pushed the tests/bugfix-fix-cancelled-flash-usb-device-lockup branch from 3beceff to 72abea0 Compare March 12, 2026 20:00
Comment thread .github/workflows/hardware-bu585.yml Outdated

steps:
- name: Reset USB Connection
run: usbreset STLINK-V3 # Product name for the b_u585i_iot02a, may have to update if we add additional STM boards to the workflow
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

For clarification this is from libusb as the product name of the board, since this is generic I suspect other STMicroelectronics products may share the same product name seen by usbutils.

@mgeeIOL mgeeIOL marked this pull request as ready for review March 12, 2026 20:36
@kr-t
Copy link
Copy Markdown
Collaborator

kr-t commented Mar 13, 2026

image Why do you need to reset it twice?

Also, while I don't oppose setting up your container with whatever privileges you want to, giving following full privileges
--user root --privileged is usually very unsafe. I recommend to check out what alternative would work (just checking which capabilities you need and giving only those) to make the container safer.

casaroli
casaroli previously approved these changes Mar 13, 2026
Removes the --privileged flag from container usage and instead uses an
additional --device to allow the container to manage usb devices as
needed.

This commit also removes the setup-container step as through testing it
is no longer needed.

Signed-off-by: Matthew Gee <mgee@iol.unh.edu>
@mgeeIOL
Copy link
Copy Markdown
Collaborator Author

mgeeIOL commented Mar 13, 2026

image Why do you need to reset it twice?

Also, while I don't oppose setting up your container with whatever privileges you want to, giving following full privileges --user root --privileged is usually very unsafe. I recommend to check out what alternative would work (just checking which capabilities you need and giving only those) to make the container safer.

The second reset is from some test runs I did where there was a failure when I only reset it once but succeeded when I did it the way I had it above. I looked into this a bit more and was able to remove it with the additional changes I pushed. Due to this I was also able to remove changes from the docker container.

I did some experimenting and was able to reduce the permissions regarding the container and remove the use of --privileged.

This PR should be good to go at this point, let me know if you have any other comments.

@kr-t kr-t merged commit aee470a into project-ocre:main Mar 16, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants