Skip to content

Commit 36c2532

Browse files
committed
Use uhubctl to disable and enable usb ports
1 parent b4ccb35 commit 36c2532

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

.github/workflows/hil.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,29 +153,29 @@ jobs:
153153
# RISC-V devices:
154154
- soc: esp32c2
155155
runner: esp32c2-jtag
156-
usb: USB2
157156
host: aarch64
157+
hubs: "1 3"
158158
- soc: esp32c3
159159
runner: esp32c3-usb
160-
usb: ACM0
161160
host: armv7
161+
hubs: "1-1"
162162
- soc: esp32c6
163163
runner: esp32c6-usb
164-
usb: ACM0
165164
host: armv7
165+
hubs: "1-1"
166166
- soc: esp32h2
167167
runner: esp32h2-usb
168-
usb: USB0
169168
host: armv7
169+
hubs: "1-1"
170170
# Xtensa devices:
171171
- soc: esp32s2
172172
runner: esp32s2-jtag
173-
usb: USB1
174173
host: armv7
174+
hubs: "1-1"
175175
- soc: esp32s3
176176
runner: esp32s3-usb
177-
usb: USB0
178177
host: armv7
178+
hubs: "1-1"
179179
steps:
180180
- uses: actions/download-artifact@v4
181181
with:
@@ -186,9 +186,22 @@ jobs:
186186
with:
187187
name: xtask-${{ matrix.target.host }}
188188

189+
- name: Enable USB ports
190+
run: |
191+
for hub in ${{ matrix.target.hubs }}; do
192+
sudo uhubctl -a on -l $hub
193+
done
194+
189195
- name: Run Tests
190196
id: run-tests
191197
run: |
192198
export PATH=$PATH:/home/espressif/.cargo/bin
193199
chmod +x xtask
194200
./xtask run-elfs ${{ matrix.target.soc }} tests-${{ matrix.target.soc }}
201+
202+
- name: Disable USB ports
203+
if: ${{ always() }}
204+
run: |
205+
for hub in ${{ matrix.target.hubs }}; do
206+
sudo uhubctl -a off -l $hub
207+
done

hil-test/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ Some tests will require physical connections, please see the current [configurat
6565
### Running Tests Remotes (ie. on Self-Hosted Runners)
6666
The [`hil.yml`] workflow builds the test suite for all our available targets and executes them.
6767

68+
> The USB ports that are used by the devkits are powered DOWN between runs!
69+
6870
Our self-hosted runners have the following setup:
6971
- ESP32-C2 (`esp32c2-jtag`):
7072
- Devkit: `ESP8684-DevKitM-1` connected via UART.
@@ -112,7 +114,7 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-t
112114
# Source the current shell:
113115
. "$HOME/.cargo/env"
114116
# Install dependencies
115-
sudo apt install -y pkg-config libudev-dev
117+
sudo apt install -y pkg-config libudev-dev uhubctl
116118
# Install probe-rs
117119
cargo install probe-rs-tools --git https://github.com/probe-rs/probe-rs --rev 9bde591 --force
118120
# Add the udev rules

0 commit comments

Comments
 (0)