Skip to content

GPIO support in USBSDMuxDrive #1846

@hamztouiz

Description

@hamztouiz

Feature request: GPIO support in USBSDMuxDriver

Description

The current USBSDMuxDriver only exposes basic mode control:

  • set_mode
  • get_mode

However, the underlying usbsdmux tool already supports GPIO operations:

  • gpio <n> get
  • gpio <n> high/low

These capabilities are not currently exposed in the driver.

Problem

This limitation prevents using the GPIOs of the USB-SD-Mux in HIL setups. In practice, this blocks use cases such as:

  • resetting the DUT
  • controlling power lines
  • synchronizing external hardware during tests

In our case, this is particularly needed to simulate SD card insertion and removal events in our automated tests.

As a result, additional external tools or workarounds are required, even though the hardware already supports it.

Proposed solution

Extend USBSDMuxDriver with minimal GPIO support, for example:

  • gpio_get(gpio: int) -> int
  • gpio_set(gpio: int, value: int)

This would directly map to the existing usbsdmux CLI without introducing additional complexity.

Benefits

  • Enables simulation of SD card insertion/removal in automated HIL tests
  • Unlocks more advanced hardware control scenarios
  • Aligns the driver capabilities with the underlying tool
  • Keeps the implementation simple and backward-compatible

Additional context

GPIO support is already implemented and stable in the usbsdmux tool, so this would mainly be an exposure of existing functionality in Labgrid.

Contribution

I’d be happy to implement this as a PR if this is considered useful and if I’m not missing any existing mechanism or design constraint.

Please let me know if this aligns with the project direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions