From 6ca8cf4f1a755a9eb8f8213e7683626f3ca3bcb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Mon, 26 Aug 2024 09:03:46 +0200 Subject: [PATCH] Use uhubctl to disable and enable usb ports --- .github/workflows/hil.yml | 32 ++++++++++++++++++++++++++------ hil-test/README.md | 2 +- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.github/workflows/hil.yml b/.github/workflows/hil.yml index f1a139ede42..7e0f33323c6 100644 --- a/.github/workflows/hil.yml +++ b/.github/workflows/hil.yml @@ -153,29 +153,29 @@ jobs: # RISC-V devices: - soc: esp32c2 runner: esp32c2-jtag - usb: USB2 host: aarch64 + hubs: "1 3" - soc: esp32c3 runner: esp32c3-usb - usb: ACM0 host: armv7 + hubs: "1-1" - soc: esp32c6 runner: esp32c6-usb - usb: ACM0 host: armv7 + hubs: "1-1" - soc: esp32h2 runner: esp32h2-usb - usb: USB0 host: armv7 + hubs: "1-1" # Xtensa devices: - soc: esp32s2 runner: esp32s2-jtag - usb: USB1 host: armv7 + hubs: "1-1" - soc: esp32s3 runner: esp32s3-usb - usb: USB0 host: armv7 + hubs: "1-1" steps: - uses: actions/download-artifact@v4 with: @@ -186,6 +186,26 @@ jobs: with: name: xtask-${{ matrix.target.host }} + - name: Cycle USB ports + run: | + for i in {1..10}; do + # Disable all used hubs + for hub in ${{ matrix.target.hubs }}; do + sudo uhubctl -a off -l $hub + done + + # Enable all used hubs + for hub in ${{ matrix.target.hubs }}; do + sudo uhubctl -a on -l $hub + done + + sleep 0.5 + + if probe-rs list | grep -q "\[0\]:"; then + break + fi + done + - name: Run Tests id: run-tests run: | diff --git a/hil-test/README.md b/hil-test/README.md index b9ba7ebfb6b..9ba953aa098 100644 --- a/hil-test/README.md +++ b/hil-test/README.md @@ -112,7 +112,7 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-t # Source the current shell: . "$HOME/.cargo/env" # Install dependencies -sudo apt install -y pkg-config libudev-dev +sudo apt install -y pkg-config libudev-dev uhubctl # Install probe-rs cargo install probe-rs-tools --git https://github.com/probe-rs/probe-rs --rev 9bde591 --force # Add the udev rules