Skip to content

Commit 341db16

Browse files
authored
Use uhubctl to disable and enable usb ports (#1997)
1 parent 5f0dc14 commit 341db16

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

.github/workflows/hil.yml

Lines changed: 27 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,6 +186,27 @@ jobs:
186186
with:
187187
name: xtask-${{ matrix.target.host }}
188188

189+
- name: Cycle USB ports
190+
run: |
191+
export PATH=$PATH:/home/espressif/.cargo/bin
192+
for i in {1..10}; do
193+
# Disable all used hubs
194+
for hub in ${{ matrix.target.hubs }}; do
195+
sudo uhubctl -a off -l $hub
196+
done
197+
198+
# Enable all used hubs
199+
for hub in ${{ matrix.target.hubs }}; do
200+
sudo uhubctl -a on -l $hub
201+
done
202+
203+
sleep 0.5
204+
205+
if probe-rs list | grep -q "\[0\]:"; then
206+
break
207+
fi
208+
done
209+
189210
- name: Run Tests
190211
id: run-tests
191212
run: |

hil-test/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-t
112112
# Source the current shell:
113113
. "$HOME/.cargo/env"
114114
# Install dependencies
115-
sudo apt install -y pkg-config libudev-dev
115+
sudo apt install -y pkg-config libudev-dev uhubctl
116116
# Install probe-rs
117117
cargo install probe-rs-tools --git https://github.com/probe-rs/probe-rs --rev 9bde591 --force
118118
# Add the udev rules

0 commit comments

Comments
 (0)