Skip to content

support OpenOCD bootstrap without environment - #1

Open
ozan956 wants to merge 16 commits into
adi-nextfrom
enhance-openocd
Open

support OpenOCD bootstrap without environment#1
ozan956 wants to merge 16 commits into
adi-nextfrom
enhance-openocd

Conversation

@ozan956

@ozan956 ozan956 commented Aug 7, 2026

Copy link
Copy Markdown
Member

The bootstrap fallback path was too narrow for OpenOCD-based setupswithout a local environment.

So far, labgrid-client bootstrap only auto-created OpenOCDDriver for NetworkAlteraUSBBlaster. If a place exposed only NetworkUSBDebugger, the client failed with "target has no compatible resource available" even though OpenOCDDriver can bind to that resource type.

In addition, the existing bootstrap_args path only handled raw 'key=valuestrings. This was not sufficient forOpenOCDDriverarguments such asload_commands, search, or config`, which often need structured values like lists.

Extend the bootstrap fallback to NetworkUSBDebugger and parse bootstrap driver arguments as YAML values. This allows CLI-only OpenOCD bootstrap flows to pass structured driver arguments without requiring a local environment file.

ozan956 and others added 16 commits August 7, 2026 09:59
So far, `NetworkService.username` was required and `SSHDriver` always
passed it to `ssh` and `scp`. This prevented setups where the SSH
username is intentionally resolved through the user's SSH configuration
or by the default SSH user selection.

This change makes `NetworkService.username` optional and updates
`SSHDriver` to only pass `-l <username>` or `user@host` when a username
is explicitly set.

In addition, the client-side fallback `NetworkService` creation path no
longer forces `username="root"` and now instantiates the resource with
`name=None`, so ad-hoc SSH access can use the normal SSH configuration
of the user.

This improves compatibility with existing SSH setups and avoids
hardcoding a username when it is not actually required.

Add regression tests covering the no-username path in SSHDriver and the
client-side fallback NetworkService creation.

Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
Clarify that `NetworkService.username` is optional.

If no username is configured on `NetworkService` or `SSHDriver`,
labgrid lets SSH resolve the username through the local SSH
configuration or the default SSH user selection.

Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
Add local and remote resources for FTDI data-bus GPIO lines exposed
through asynchronous bit-bang mode.

The resource models one output-capable bit on a selected FTDI
interface and exports the USB identity, interface, index, and inversion
metadata needed by the driver.

Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
Add FTDIGPIODriver and a labgrid agent for FTDI asynchronous bit-bang
GPIO outputs. The agent opens the selected USB interface per operation,
sets async bit-bang mode with the data bus configured as output, reads
the current pin byte, and writes back only the requested bit change.

Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
Allow labgrid-client io to create an FTDIGPIODriver for acquired
NetworkFTDIGPIO resources.

Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
Cover FTDI GPIO resource validation, supported USB IDs, driver set/get
behavior, agent read-modify-write output handling, exporter parameters,
and labgrid-client io integration.

Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
Document FTDIGPIO and NetworkFTDIGPIO resources for FTDI asynchronous
bit-bang data-bus outputs.

Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
Add power backend for the Minuteman RPM1521 series of
power switches(2,4,8 ports).

Signed-off-by: Caleb Ethridge <caleb.ethridge@analog.com>
Signed-off-by: Caleb Ethridge <caleb.ethridge@analog.com>
Add a dedicated DigitalInputProtocol for drivers which can read a
digital signal without also exposing writes. Keep DigitalOutputProtocol
as a specialization of the input protocol, matching existing output
drivers which already implement get().

Co-developed-by: Felix Zwettler <Felix.Zwettler@duagon.com>
Signed-off-by: Felix Zwettler <Felix.Zwettler@duagon.com>
Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
Add GpioDigitalInputDriver for sysfs GPIO resources. Extend the
sysfsgpio agent to configure lines for input reads while keeping
output as the default path for existing users.

Reconfigure cached GPIO lines before reuse so switching between
input and output access leaves the sysfs direction in the state
requested by the active driver.

Co-developed-by: Felix Zwettler <Felix.Zwettler@duagon.com>
Signed-off-by: Felix Zwettler <Felix.Zwettler@duagon.com>
Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
Resolve labgrid-client io get via DigitalInputProtocol when a matching
driver is configured. This allows input-only drivers to use the
existing io command.

Keep the existing NetworkSysfsGPIO fallback on GpioDigitalOutputDriver
so resource-only configurations continue to behave as before.

Co-developed-by: Felix Zwettler <Felix.Zwettler@duagon.com>
Signed-off-by: Felix Zwettler <Felix.Zwettler@duagon.com>
Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
Document GpioDigitalInputDriver and add coverage for sysfsgpio input
direction handling, cached direction reconfiguration, input driver
reads, protocol compatibility, and labgrid-client io get routing.

Co-developed-by: Felix Zwettler <Felix.Zwettler@duagon.com>
Signed-off-by: Felix Zwettler <Felix.Zwettler@duagon.com>
Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
Add unit tests for OpenOCD bootstrap argument parsing and the
NetworkUSBDebugger fallback path in the client.

Keep these tests separate from the OpenOCD integration tests so they do
not depend on the openocd binary being installed.

Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
The bootstrap fallback path was too narrow for OpenOCD-based setups
without a local environment.

So far, `labgrid-client bootstrap` only auto-created `OpenOCDDriver`
for `NetworkAlteraUSBBlaster`. If a place exposed only
`NetworkUSBDebugger`, the client failed with "target has no compatible
resource available" even though `OpenOCDDriver` can bind to that
resource type.

In addition, the existing `bootstrap_args` path only handled raw
`key=value` strings. This was not sufficient for `OpenOCDDriver`
arguments such as `load_commands`, `search`, or `config`, which often
need structured values like lists.

Extend the bootstrap fallback to `NetworkUSBDebugger` and parse
bootstrap driver arguments as YAML values. This allows CLI-only OpenOCD
bootstrap flows to pass structured driver arguments without requiring a
local environment file.

Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
@ozan956 ozan956 self-assigned this Aug 7, 2026
@gastmaier gastmaier added the llm review Request a review from a LLM Reviewer label Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

LLM review

This series extends labgrid-client bootstrap's driver fallback to also cover NetworkUSBDebugger resources (matching OpenOCDDriver's existing bindings and documentation), and switches bootstrap_args parsing from raw key=value strings to YAML-parsed values so structured OpenOCDDriver arguments (e.g. load_commands, search) can be passed from the CLI.

run: 31177809422

ebd8e7d - remote/client: support OpenOCD bootstrap without environment

Ordering bug: args = self._parse_driver_args(self.args.bootstrap_args) was moved to the top of bootstrap(), executing unconditionally before checking whether an existing BootstrapProtocol driver can be used. Previously this parsing only happened inside the NetworkAlteraUSBBlaster branch, i.e. only when an OpenOCDDriver was actually being constructed.

As a result, any leftover/malformed token in bootstrap_args now breaks bootstrap for IMXUSBDriver/MXSUSBDriver/RKUSBDriver, or even an environment-configured OpenOCDDriver found via get_driver("BootstrapProtocol"), even though those args are never consumed on that path.

Reproduced with a script instantiating an IMXUSBDriver + NetworkIMXUSBLoader and calling bootstrap() with bootstrap_args=["--verbose"]:

  • at the parent commit (46569aa): succeeds.
  • at ebd8e7d: raises UserError: invalid bootstrap argument '--verbose', expected key=value.

Fix: move the _parse_driver_args() call back into the OpenOCD branch, right before constructing a new OpenOCDDriver. Verified the repro succeeds again and all existing tests in tests/test_openocd_client.py still pass.

CI warnings

No CI logs were available for this run (CI notes input was empty). pyflakes and pycodestyle (110 cols) on labgrid/remote/client.py show no new issues introduced by this series.

Verification data

Reproduced the regression directly by checking out labgrid/remote/client.py at both 46569aa and ebd8e7d and calling ClientSession.bootstrap() against a mocked Target/NetworkIMXUSBLoader/IMXUSBDriver. Also added a regression test (test_bootstrap_ignores_bad_args_for_existing_driver) confirmed to fail without the fix and pass with it. Cross-checked OpenOCDDriver.bindings in labgrid/driver/openocddriver.py and doc/configuration.rst to confirm NetworkUSBDebugger support is consistent with existing driver capability/documentation (no doc changes needed). Confirmed PyYAML is already a declared dependency in pyproject.toml, so import yaml adds no new dependency.

Suggested patches

Apply the suggested patches with:

cd path/to/repository
export GITHUB_TOKEN=ghp_***
apply-patches --repo=analogdevicesinc/labgrid 31177809422
Install instructions

The following one-liner installs the script if not present already:

curl -fSsL "https://raw.githubusercontent.com/analogdevicesinc/doctools/refs/heads/main/ci/scripts/apply-patches.sh"      -o ~/.local/bin/apply-patches.sh &&   grep -q "/apply-patches.sh" ~/.bashrc || echo "source ~/.local/bin/apply-patches.sh" >> $_ ; . $_

More information at AI Usage.

@pamolloy pamolloy added this to ADSP Aug 13, 2026
@ozan956
ozan956 force-pushed the adi-next branch 2 times, most recently from b3f66b7 to 61b5254 Compare August 28, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llm review Request a review from a LLM Reviewer

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants