Skip to content

executor/pdu: add a USB hub PDU

Martin Roukala requested to merge mupuf/ci-tron:usb_hub_pdu into main

When trying to test phone-like platforms that rely on USB for power and data, the most logical way of forcing them to turn ON/OFF is to cut the power from the USB port.

Fortunately, some hubs can be bought that support Per-Port Power Switching: https://github.com/mvp/uhubctl#compatible-usb-hubs

Unlike projects like uhubctl, I decided to exclusively use the Linux kernel's sysfs interface for both simplicity and reliability reasons. It however comes with the following drawbacks:

  • We cannot automatically de-duplicate USB2 / USB3 since we cannot get the container id of the hub as the BOS descriptor is not yet exposed[1]
  • We need to make the "disable" files user-writable using udev rules... but that's better than having to run the executor as root

[1] https://lore.kernel.org/lkml/2024030142-gloater-stem-fe94@gregkh/t/

Merge request reports