labgrid.driver package

Submodules

labgrid.driver.bareboxdriver module

class labgrid.driver.bareboxdriver.BareboxDriver(target, name, prompt='', autoboot='stop autoboot', interrupt='n', bootstring='Linux version \d', password='', login_timeout=60)[source]

Bases: labgrid.driver.commandmixin.CommandMixin, labgrid.driver.common.Driver, labgrid.protocol.commandprotocol.CommandProtocol, labgrid.protocol.linuxbootprotocol.LinuxBootProtocol

BareboxDriver - Driver to control barebox via the console.

BareboxDriver binds on top of a ConsoleProtocol.

Parameters
  • prompt (str) – The default Barebox Prompt

  • bootstring (str) – string that indicates that the Kernel is booting

  • password (str) – optional, password to use for access to the shell

  • login_timeout (int) – optional, timeout for access to the shell

bindings = {'console': <class 'labgrid.protocol.consoleprotocol.ConsoleProtocol'>}
__attrs_post_init__()[source]
on_activate()[source]

Activate the BareboxDriver

This function tries to login if not already active

on_deactivate()[source]

Deactivate the BareboxDriver

Simply sets the internal status to 0

run(cmd: str, *, timeout: int = 30)[source]

Run a command

reset()[source]

Reset the board via a CPU reset

get_status()[source]

Retrieve status of the BareboxDriver 0 means inactive, 1 means active.

Returns

status of the driver

Return type

int

await_boot()[source]

Wait for the initial Linux version string to verify we succesfully jumped into the kernel.

boot(name: str)[source]

Boot the default or a specific boot entry

Parameters

name (str) – name of the entry to boot

__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='prompt', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='autoboot', default='stop autoboot', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='interrupt', default='\n', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='bootstring', default='Linux version \\d', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='password', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='login_timeout', default=60, validator=<instance_of validator for type <class 'int'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, prompt='', autoboot='stop autoboot', interrupt='\n', bootstring='Linux version \\d', password='', login_timeout=60) → None

Method generated by attrs for class BareboxDriver.

__module__ = 'labgrid.driver.bareboxdriver'
__repr__()

Method generated by attrs for class BareboxDriver.

labgrid.driver.commandmixin module

class labgrid.driver.commandmixin.CommandMixin[source]

Bases: object

CommandMixin implementing common functions for drivers which support the CommandProtocol

__attrs_post_init__()[source]
wait_for(cmd, pattern, timeout=30.0, sleepduration=1)[source]

Wait until the pattern is detected in the output of cmd. Raises ExecutionError when the timeout expires.

Parameters
  • cmd (str) – command to run on the shell

  • pattern (str) – pattern as a string to look for in the output

  • timeout (float) – timeout for the pattern detection

  • sleepduration (int) – sleep time between the runs of the cmd

poll_until_success(cmd, *, expected=0, tries=None, timeout=30.0, sleepduration=1)[source]

Poll a command until a specific exit code is detected. Takes a timeout and the number of tries to run the cmd. The sleepduration argument sets the duration between runs of the cmd.

Parameters
  • cmd (str) – command to run on the shell

  • expected (int) – exitcode to detect

  • tries (int) – number of tries, can be None for infinite tries

  • timeout (float) – timeout for the exitcode detection

  • sleepduration (int) – sleep time between the runs of the cmd

Returns

whether the command finally executed sucessfully

Return type

bool

run_check(cmd: str, *, timeout=30, codec='utf-8', decodeerrors='strict')[source]

External run_check function, only available if the driver is active. Runs the supplied command and returns the stdout, raises an ExecutionError otherwise.

Parameters

cmd (str) – command to run on the shell

Returns

stdout of the executed command

Return type

List[str]

__dict__ = mappingproxy({'__module__': 'labgrid.driver.commandmixin', '__doc__': '\n CommandMixin implementing common functions for drivers which support the CommandProtocol\n ', '__attrs_post_init__': <function CommandMixin.__attrs_post_init__>, 'wait_for': <function CommandMixin.wait_for>, 'poll_until_success': <function CommandMixin.poll_until_success>, '_run_check': <function CommandMixin._run_check>, 'run_check': <function CommandMixin.run_check>, '__dict__': <attribute '__dict__' of 'CommandMixin' objects>, '__weakref__': <attribute '__weakref__' of 'CommandMixin' objects>})
__module__ = 'labgrid.driver.commandmixin'
__weakref__

list of weak references to the object (if defined)

labgrid.driver.common module

class labgrid.driver.common.Driver(target, name)[source]

Bases: labgrid.binding.BindingMixin

Represents a driver which is used externally or by other drivers. It implements functionality based on directly accessing the Resource or by building on top of other Drivers.

Life cycle: - create - bind (n times) - activate - usage - deactivate

__attrs_post_init__()[source]
get_priority(protocol)[source]

Retrieve the priority for a given protocol

Arguments: protocol - protocol to search for in the MRO

Returns

value of the priority if it is found, 0 otherwise.

Return type

Int

__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None))
__init__(target, name) → None

Method generated by attrs for class Driver.

__module__ = 'labgrid.driver.common'
__repr__()

Method generated by attrs for class Driver.

labgrid.driver.common.check_file(filename, *, command_prefix=[])[source]

labgrid.driver.consoleexpectmixin module

class labgrid.driver.consoleexpectmixin.ConsoleExpectMixin[source]

Bases: object

Console driver mixin to implement the read, write, expect and sendline methods. It uses the internal _read and _write methods.

The class using the ConsoleExpectMixin must provide a logger and a txdelay attribute.

__attrs_post_init__()[source]
read(size=1, timeout=0.0)[source]
write(data)[source]
sendline(line)[source]
sendcontrol(char)[source]
expect(pattern, timeout=-1)[source]
resolve_conflicts(client)[source]
__dict__ = mappingproxy({'__module__': 'labgrid.driver.consoleexpectmixin', '__doc__': '\n Console driver mixin to implement the read, write, expect and sendline methods. It uses\n the internal _read and _write methods.\n\n The class using the ConsoleExpectMixin must provide a logger and a txdelay attribute.\n ', '__attrs_post_init__': <function ConsoleExpectMixin.__attrs_post_init__>, 'read': <function ConsoleExpectMixin.read>, 'write': <function ConsoleExpectMixin.write>, 'sendline': <function ConsoleExpectMixin.sendline>, 'sendcontrol': <function ConsoleExpectMixin.sendcontrol>, 'expect': <function ConsoleExpectMixin.expect>, 'resolve_conflicts': <function ConsoleExpectMixin.resolve_conflicts>, '__dict__': <attribute '__dict__' of 'ConsoleExpectMixin' objects>, '__weakref__': <attribute '__weakref__' of 'ConsoleExpectMixin' objects>})
__module__ = 'labgrid.driver.consoleexpectmixin'
__weakref__

list of weak references to the object (if defined)

labgrid.driver.deditecrelaisdriver module

class labgrid.driver.deditecrelaisdriver.DeditecRelaisDriver(target, name)[source]

Bases: labgrid.driver.common.Driver, labgrid.protocol.digitaloutputprotocol.DigitalOutputProtocol

bindings = {'relais': {<class 'labgrid.resource.remote.NetworkDeditecRelais8'>, 'DeditecRelais8'}}
__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

on_deactivate()[source]

Called by the Target when this object has been deactivated

set(status)[source]

Implementations should set the status of the OneWirePort

get()[source]

Implementations should return the status of the OneWirePort.

__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None))
__init__(target, name) → None

Method generated by attrs for class DeditecRelaisDriver.

__module__ = 'labgrid.driver.deditecrelaisdriver'
__repr__()

Method generated by attrs for class DeditecRelaisDriver.

labgrid.driver.dockerdriver module

Class for connecting to a docker daemon running on the host machine.

class labgrid.driver.dockerdriver.DockerDriver(target, name, image_uri=None, command=None, volumes=None, container_name=None, environment=None, host_config=None, network_services=None)[source]

Bases: labgrid.protocol.powerprotocol.PowerProtocol, labgrid.driver.common.Driver

The DockerDriver is used to create docker containers. This is done via communication with a docker daemon.

When a container is created the container is labeled with an cleanup strategy identifier. Currently only one strategy is implemented. This strategy simply deletes all labgrid created containers before each test run. This is to ensure cleanup of dangling containers from crashed tests or hanging containers.

Image pruning is not done by the driver.

For detailed information about the arguments see the “Docker SDK for Python” documentation https://docker-py.readthedocs.io/en/stable/containers.html#container-objects

Parameters

bindings (dict) – The labgrid bindings

Args passed to docker.create_container:

image_uri (str): The uri of the image to fetch command (str): The command to execute once container has been created volumes (list): The volumes to declare environment (list): Docker environment variables to set host_config (dict): Docker host configuration parameters network_services (list): Sequence of dicts each specifying a network service that the docker container exposes.

bindings = {'docker_daemon': {'DockerDaemon'}}
__attrs_post_init__()[source]
on_activate()[source]

On activation: 1. Import docker module (_client and _container remain available) 2. Connect to the docker daemon 3. Pull requested image from docker registry if needed 4. Create the new container according to parameters from conf

on_deactivate()[source]

Remove container after use

on()[source]

Start the container created during activation

off()[source]

Stop the container created during activation

cycle()[source]

Cycle the docker container by stopping and starting it

__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='image_uri', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='command', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='volumes', default=None, validator=<optional validator for <instance_of validator for type <class 'list'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='container_name', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='environment', default=None, validator=<optional validator for <instance_of validator for type <class 'list'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='host_config', default=None, validator=<optional validator for <instance_of validator for type <class 'dict'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='network_services', default=None, validator=<optional validator for <instance_of validator for type <class 'list'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, image_uri=None, command=None, volumes=None, container_name=None, environment=None, host_config=None, network_services=None) → None

Method generated by attrs for class DockerDriver.

__module__ = 'labgrid.driver.dockerdriver'
__repr__()

Method generated by attrs for class DockerDriver.

labgrid.driver.exception module

exception labgrid.driver.exception.ExecutionError(msg, stdout=None, stderr=None)[source]

Bases: Exception

__attrs_attrs__ = (Attribute(name='msg', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='stdout', default=None, validator=<optional validator for <instance_of validator for type <class 'list'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='stderr', default=None, validator=<optional validator for <instance_of validator for type <class 'list'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(msg, stdout=None, stderr=None) → None

Method generated by attrs for class ExecutionError.

__module__ = 'labgrid.driver.exception'
__repr__()

Method generated by attrs for class ExecutionError.

__weakref__

list of weak references to the object (if defined)

exception labgrid.driver.exception.CleanUpError(msg)[source]

Bases: Exception

__attrs_attrs__ = (Attribute(name='msg', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None),)
__init__(msg) → None

Method generated by attrs for class CleanUpError.

__module__ = 'labgrid.driver.exception'
__repr__()

Method generated by attrs for class CleanUpError.

__weakref__

list of weak references to the object (if defined)

labgrid.driver.externalconsoledriver module

class labgrid.driver.externalconsoledriver.ExternalConsoleDriver(target, name, cmd, txdelay=0.0)[source]

Bases: labgrid.driver.consoleexpectmixin.ConsoleExpectMixin, labgrid.driver.common.Driver, labgrid.protocol.consoleprotocol.ConsoleProtocol

Driver implementing the ConsoleProtocol interface using a subprocess

__attrs_post_init__()[source]
open()[source]

Starts the subprocess, does nothing if it is already closed

close()[source]

Stops the subprocess, does nothing if it is already closed

on_deactivate()[source]

Called by the Target when this object has been deactivated

__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='cmd', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='txdelay', default=0.0, validator=<instance_of validator for type <class 'float'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, cmd, txdelay=0.0) → None

Method generated by attrs for class ExternalConsoleDriver.

__module__ = 'labgrid.driver.externalconsoledriver'
__repr__()

Method generated by attrs for class ExternalConsoleDriver.

labgrid.driver.fake module

class labgrid.driver.fake.FakeConsoleDriver(target, name, txdelay=0.0)[source]

Bases: labgrid.driver.consoleexpectmixin.ConsoleExpectMixin, labgrid.driver.common.Driver, labgrid.protocol.consoleprotocol.ConsoleProtocol

__attrs_post_init__()[source]
open()[source]
close()[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='txdelay', default=0.0, validator=<instance_of validator for type <class 'float'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, txdelay=0.0) → None

Method generated by attrs for class FakeConsoleDriver.

__module__ = 'labgrid.driver.fake'
__repr__()

Method generated by attrs for class FakeConsoleDriver.

class labgrid.driver.fake.FakeCommandDriver(target, name)[source]

Bases: labgrid.driver.commandmixin.CommandMixin, labgrid.driver.common.Driver, labgrid.protocol.commandprotocol.CommandProtocol

run(*args, timeout=None)[source]

Run a command

run_check(*args)[source]

External run_check function, only available if the driver is active. Runs the supplied command and returns the stdout, raises an ExecutionError otherwise.

Parameters

cmd (str) – command to run on the shell

Returns

stdout of the executed command

Return type

List[str]

get_status()[source]

Get status of the Driver

__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None))
__init__(target, name) → None

Method generated by attrs for class FakeCommandDriver.

__module__ = 'labgrid.driver.fake'
__repr__()

Method generated by attrs for class FakeCommandDriver.

class labgrid.driver.fake.FakeFileTransferDriver(target, name)[source]

Bases: labgrid.driver.common.Driver, labgrid.protocol.filetransferprotocol.FileTransferProtocol

get(*args)[source]
put(*args)[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None))
__init__(target, name) → None

Method generated by attrs for class FakeFileTransferDriver.

__module__ = 'labgrid.driver.fake'
__repr__()

Method generated by attrs for class FakeFileTransferDriver.

class labgrid.driver.fake.FakePowerDriver(target, name)[source]

Bases: labgrid.driver.common.Driver, labgrid.protocol.powerprotocol.PowerProtocol

on(*args)[source]
off(*args)[source]
cycle(*args)[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None))
__init__(target, name) → None

Method generated by attrs for class FakePowerDriver.

__module__ = 'labgrid.driver.fake'
__repr__()

Method generated by attrs for class FakePowerDriver.

labgrid.driver.fastbootdriver module

class labgrid.driver.fastbootdriver.AndroidFastbootDriver(target, name, image=None, sparse_size=None)[source]

Bases: labgrid.driver.common.Driver

bindings = {'fastboot': {'AndroidFastboot', 'NetworkAndroidFastboot'}}
__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

on_deactivate()[source]

Called by the Target when this object has been deactivated

__call__(*args)[source]

Call self as a function.

boot(filename)[source]
flash(partition, filename)[source]
run(cmd)[source]
continue_boot()[source]
getvar(var)[source]

Return variable value via ‘fastboot getvar <var>’.

oem_getenv(var)[source]

Return barebox environment variable value via ‘fastboot oem getenv <var>’.

__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='image', default=None, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='sparse_size', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, image=None, sparse_size=None) → None

Method generated by attrs for class AndroidFastbootDriver.

__module__ = 'labgrid.driver.fastbootdriver'
__repr__()

Method generated by attrs for class AndroidFastbootDriver.

labgrid.driver.filedigitaloutput module

class labgrid.driver.filedigitaloutput.FileDigitalOutputDriver(target, name, filepath, false_repr='0n', true_repr='1n')[source]

Bases: labgrid.driver.common.Driver, labgrid.protocol.digitaloutputprotocol.DigitalOutputProtocol

Two arbitrary string values false_repr and true_repr are defined as representations for False and True. These values are written to a file and read from it. If the file’s content does not match any of the representations it defaults to False. A prime example for using this driver is Linux’s sysfs.

bindings = {}
__attrs_post_init__()[source]
get()[source]

Implementations should return the status of the OneWirePort.

set(status)[source]

Implementations should set the status of the OneWirePort

__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='filepath', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='false_repr', default='0\n', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='true_repr', default='1\n', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, filepath, false_repr='0\n', true_repr='1\n') → None

Method generated by attrs for class FileDigitalOutputDriver.

__module__ = 'labgrid.driver.filedigitaloutput'
__repr__()

Method generated by attrs for class FileDigitalOutputDriver.

labgrid.driver.flashromdriver module

class labgrid.driver.flashromdriver.FlashromDriver(target, name, image=None)[source]

Bases: labgrid.driver.common.Driver, labgrid.protocol.bootstrapprotocol.BootstrapProtocol

The Flashrom driver used the flashrom utility to write an image to a raw rom. The driver is a pure wrapper of the flashrom utility

bindings = {'flashrom_resource': {'Flashrom', <class 'labgrid.resource.flashrom.NetworkFlashrom'>}}
__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

on_deactivate()[source]

Called by the Target when this object has been deactivated

__call__(*args)[source]

Call self as a function.

load(filename=None)[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='image', default=None, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, image=None) → None

Method generated by attrs for class FlashromDriver.

__module__ = 'labgrid.driver.flashromdriver'
__repr__()

Method generated by attrs for class FlashromDriver.

labgrid.driver.gpiodriver module

All GPIO-related drivers

class labgrid.driver.gpiodriver.GpioDigitalOutputDriver(target, name)[source]

Bases: labgrid.driver.common.Driver, labgrid.protocol.digitaloutputprotocol.DigitalOutputProtocol

bindings = {'gpio': {'NetworkSysfsGPIO', 'SysfsGPIO'}}
__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

on_deactivate()[source]

Called by the Target when this object has been deactivated

set(status)[source]

Implementations should set the status of the OneWirePort

get()[source]

Implementations should return the status of the OneWirePort.

__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None))
__init__(target, name) → None

Method generated by attrs for class GpioDigitalOutputDriver.

__module__ = 'labgrid.driver.gpiodriver'
__repr__()

Method generated by attrs for class GpioDigitalOutputDriver.

labgrid.driver.lxaiobusdriver module

class labgrid.driver.lxaiobusdriver.LXAIOBusPIODriver(target, name)[source]

Bases: labgrid.driver.common.Driver, labgrid.protocol.digitaloutputprotocol.DigitalOutputProtocol

bindings = {'pio': {'LXAIOBusPIO', 'NetworkLXAIOBusPIO'}}
__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

set(status)[source]

Implementations should set the status of the OneWirePort

get()[source]

Implementations should return the status of the OneWirePort.

__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None))
__init__(target, name) → None

Method generated by attrs for class LXAIOBusPIODriver.

__module__ = 'labgrid.driver.lxaiobusdriver'
__repr__()

Method generated by attrs for class LXAIOBusPIODriver.

labgrid.driver.modbusdriver module

class labgrid.driver.modbusdriver.ModbusCoilDriver(target, name)[source]

Bases: labgrid.driver.common.Driver, labgrid.protocol.digitaloutputprotocol.DigitalOutputProtocol

bindings = {'coil': 'ModbusTCPCoil'}
__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

on_deactivate()[source]

Called by the Target when this object has been deactivated

set(status)[source]

Implementations should set the status of the OneWirePort

get()[source]

Implementations should return the status of the OneWirePort.

__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None))
__init__(target, name) → None

Method generated by attrs for class ModbusCoilDriver.

__module__ = 'labgrid.driver.modbusdriver'
__repr__()

Method generated by attrs for class ModbusCoilDriver.

labgrid.driver.onewiredriver module

class labgrid.driver.onewiredriver.OneWirePIODriver(target, name)[source]

Bases: labgrid.driver.common.Driver, labgrid.protocol.digitaloutputprotocol.DigitalOutputProtocol

bindings = {'port': 'OneWirePIO'}
__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

on_deactivate()[source]

Called by the Target when this object has been deactivated

set(status)[source]

Implementations should set the status of the OneWirePort

get()[source]

Implementations should return the status of the OneWirePort.

__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None))
__init__(target, name) → None

Method generated by attrs for class OneWirePIODriver.

__module__ = 'labgrid.driver.onewiredriver'
__repr__()

Method generated by attrs for class OneWirePIODriver.

labgrid.driver.openocddriver module

class labgrid.driver.openocddriver.OpenOCDDriver(target, name, config, search=[], image=None)[source]

Bases: labgrid.driver.common.Driver, labgrid.protocol.bootstrapprotocol.BootstrapProtocol

bindings = {'interface': {'AlteraUSBBlaster', 'NetworkAlteraUSBBlaster'}}
__attrs_post_init__()[source]
load(filename=None)[source]
execute(commands: list)[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='config', default=NOTHING, validator=<instance_of validator for type (<class 'str'>, <class 'list'>)>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='search', default=[], validator=<optional validator for <instance_of validator for type (<class 'str'>, <class 'list'>)> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='image', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, config, search=[], image=None) → None

Method generated by attrs for class OpenOCDDriver.

__module__ = 'labgrid.driver.openocddriver'
__repr__()

Method generated by attrs for class OpenOCDDriver.

labgrid.driver.powerdriver module

class labgrid.driver.powerdriver.PowerResetMixin[source]

Bases: labgrid.protocol.resetprotocol.ResetProtocol

ResetMixin implements the ResetProtocol for drivers which support the PowerProtocol

priorities = {<class 'labgrid.protocol.resetprotocol.ResetProtocol'>: -10}
__attrs_post_init__()[source]
reset()[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = ()
__init__() → None

Method generated by attrs for class PowerResetMixin.

__module__ = 'labgrid.driver.powerdriver'
__repr__()

Method generated by attrs for class PowerResetMixin.

class labgrid.driver.powerdriver.ManualPowerDriver(target, name)[source]

Bases: labgrid.driver.common.Driver, labgrid.driver.powerdriver.PowerResetMixin, labgrid.protocol.powerprotocol.PowerProtocol

ManualPowerDriver - Driver to tell the user to control a target’s power

on()[source]
off()[source]
cycle()[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None))
__init__(target, name) → None

Method generated by attrs for class ManualPowerDriver.

__module__ = 'labgrid.driver.powerdriver'
__repr__()

Method generated by attrs for class ManualPowerDriver.

class labgrid.driver.powerdriver.SiSPMPowerDriver(target, name, delay=2.0)[source]

Bases: labgrid.driver.common.Driver, labgrid.driver.powerdriver.PowerResetMixin, labgrid.protocol.powerprotocol.PowerProtocol

SiSPMPowerDriver - Driver using a SiS-PM (Silver Shield PM) to control a target’s power using the sispmctl tool - http://sispmctl.sourceforge.net/

bindings = {'port': {'NetworkSiSPMPowerPort', 'SiSPMPowerPort'}}
__attrs_post_init__()[source]
on()[source]
off()[source]
cycle()[source]
get()[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='delay', default=2.0, validator=<instance_of validator for type <class 'float'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, delay=2.0) → None

Method generated by attrs for class SiSPMPowerDriver.

__module__ = 'labgrid.driver.powerdriver'
__repr__()

Method generated by attrs for class SiSPMPowerDriver.

class labgrid.driver.powerdriver.ExternalPowerDriver(target, name, cmd_on, cmd_off, cmd_cycle=None, delay=2.0)[source]

Bases: labgrid.driver.common.Driver, labgrid.driver.powerdriver.PowerResetMixin, labgrid.protocol.powerprotocol.PowerProtocol

ExternalPowerDriver - Driver using an external command to control a target’s power

on()[source]
off()[source]
cycle()[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='cmd_on', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='cmd_off', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='cmd_cycle', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='delay', default=2.0, validator=<instance_of validator for type <class 'float'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, cmd_on, cmd_off, cmd_cycle=None, delay=2.0) → None

Method generated by attrs for class ExternalPowerDriver.

__module__ = 'labgrid.driver.powerdriver'
__repr__()

Method generated by attrs for class ExternalPowerDriver.

class labgrid.driver.powerdriver.NetworkPowerDriver(target, name, delay=2.0)[source]

Bases: labgrid.driver.common.Driver, labgrid.driver.powerdriver.PowerResetMixin, labgrid.protocol.powerprotocol.PowerProtocol

NetworkPowerDriver - Driver using a networked power switch to control a target’s power

bindings = {'port': <class 'labgrid.resource.power.NetworkPowerPort'>}
__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

on()[source]
off()[source]
cycle()[source]
get()[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='delay', default=2.0, validator=<instance_of validator for type <class 'float'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, delay=2.0) → None

Method generated by attrs for class NetworkPowerDriver.

__module__ = 'labgrid.driver.powerdriver'
__repr__()

Method generated by attrs for class NetworkPowerDriver.

class labgrid.driver.powerdriver.DigitalOutputPowerDriver(target, name, delay=1.0)[source]

Bases: labgrid.driver.common.Driver, labgrid.driver.powerdriver.PowerResetMixin, labgrid.protocol.powerprotocol.PowerProtocol

DigitalOutputPowerDriver uses a DigitalOutput to control the power of a DUT.

bindings = {'output': <class 'labgrid.protocol.digitaloutputprotocol.DigitalOutputProtocol'>}
__attrs_post_init__()[source]
on()[source]
off()[source]
cycle()[source]
get()[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='delay', default=1.0, validator=<instance_of validator for type <class 'float'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, delay=1.0) → None

Method generated by attrs for class DigitalOutputPowerDriver.

__module__ = 'labgrid.driver.powerdriver'
__repr__()

Method generated by attrs for class DigitalOutputPowerDriver.

class labgrid.driver.powerdriver.YKUSHPowerDriver(target, name, delay=2.0)[source]

Bases: labgrid.driver.common.Driver, labgrid.driver.powerdriver.PowerResetMixin, labgrid.protocol.powerprotocol.PowerProtocol

YKUSHPowerDriver - Driver using a YEPKIT YKUSH switchable USB hub to control a target’s power - https://www.yepkit.com/products/ykush

bindings = {'port': 'YKUSHPowerPort'}
__attrs_post_init__()[source]
on()[source]
off()[source]
cycle()[source]
get()[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='delay', default=2.0, validator=<instance_of validator for type <class 'float'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, delay=2.0) → None

Method generated by attrs for class YKUSHPowerDriver.

__module__ = 'labgrid.driver.powerdriver'
__repr__()

Method generated by attrs for class YKUSHPowerDriver.

class labgrid.driver.powerdriver.USBPowerDriver(target, name, delay=2.0)[source]

Bases: labgrid.driver.common.Driver, labgrid.driver.powerdriver.PowerResetMixin, labgrid.protocol.powerprotocol.PowerProtocol

USBPowerDriver - Driver using a power switchable USB hub and the uhubctl tool (https://github.com/mvp/uhubctl) to control a target’s power

bindings = {'hub': {'NetworkUSBPowerPort', 'USBPowerPort'}}
__attrs_post_init__()[source]
on()[source]
off()[source]
cycle()[source]
get()[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='delay', default=2.0, validator=<instance_of validator for type <class 'float'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, delay=2.0) → None

Method generated by attrs for class USBPowerDriver.

__module__ = 'labgrid.driver.powerdriver'
__repr__()

Method generated by attrs for class USBPowerDriver.

class labgrid.driver.powerdriver.PDUDaemonDriver(target, name, delay=5)[source]

Bases: labgrid.driver.common.Driver, labgrid.driver.powerdriver.PowerResetMixin, labgrid.protocol.powerprotocol.PowerProtocol

PDUDaemonDriver - Driver using a PDU port available via pdudaemon

bindings = {'port': 'PDUDaemonPort'}
__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

on()[source]
off()[source]
cycle()[source]
get()[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='delay', default=5, validator=<instance_of validator for type <class 'int'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, delay=5) → None

Method generated by attrs for class PDUDaemonDriver.

__module__ = 'labgrid.driver.powerdriver'
__repr__()

Method generated by attrs for class PDUDaemonDriver.

labgrid.driver.pyvisadriver module

class labgrid.driver.pyvisadriver.PyVISADriver(target, name)[source]

Bases: labgrid.driver.common.Driver

The PyVISADriver provides a transparent layer to the PyVISA module allowing to get a pyvisa resource

Parameters

bindings (dict) – driver to use with PyVISA

bindings = {'pyvisa_resource': 'PyVISADevice'}
__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

on_deactivate()[source]

Called by the Target when this object has been deactivated

get_session()[source]
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None))
__init__(target, name) → None

Method generated by attrs for class PyVISADriver.

__module__ = 'labgrid.driver.pyvisadriver'
__repr__()

Method generated by attrs for class PyVISADriver.

labgrid.driver.qemudriver module

The QEMUDriver implements a driver to use a QEMU target

class labgrid.driver.qemudriver.QEMUDriver(target, name, qemu_bin, machine, cpu, memory, extra_args, boot_args=None, kernel=None, disk=None, rootfs=None, dtb=None, flash=None)[source]

Bases: labgrid.driver.consoleexpectmixin.ConsoleExpectMixin, labgrid.driver.common.Driver, labgrid.protocol.powerprotocol.PowerProtocol, labgrid.protocol.consoleprotocol.ConsoleProtocol

The QEMUDriver implements an interface to start targets as qemu instances.

The kernel, flash, rootfs and dtb arguments refer to images and paths declared in the environment configuration.

Parameters
  • qemu_bin (str) – reference to the tools key for the QEMU binary

  • machine (str) – QEMU machine type

  • cpu (str) – QEMU cpu type

  • memory (str) – QEMU memory size (ends with M or G)

  • extra_args (str) – extra QEMU arguments, they are passed directly to the QEMU binary

  • boot_args (str) – optional, additional kernel boot argument

  • kernel (str) – optional, reference to the images key for the kernel

  • disk (str) – optional, reference to the images key for the disk image

  • flash (str) – optional, reference to the images key for the flash image

  • rootfs (str) – optional, reference to the paths key for use as the virtio-9p filesystem

  • dtb (str) – optional, reference to the image key for the device tree

__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

on_deactivate()[source]

Called by the Target when this object has been deactivated

on()[source]

Start the QEMU subprocess, accept the unix socket connection and afterwards start the emulator using a QMP Command

off()[source]

Stop the emulator using a monitor command and await the exitcode

cycle()[source]

Cycle the emulator by restarting it

monitor_command(command)[source]

Execute a monitor_command via the QMP

__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='qemu_bin', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='machine', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='cpu', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='memory', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='extra_args', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='boot_args', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='kernel', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='disk', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='rootfs', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='dtb', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='flash', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, qemu_bin, machine, cpu, memory, extra_args, boot_args=None, kernel=None, disk=None, rootfs=None, dtb=None, flash=None) → None

Method generated by attrs for class QEMUDriver.

__module__ = 'labgrid.driver.qemudriver'
__repr__()

Method generated by attrs for class QEMUDriver.

labgrid.driver.quartushpsdriver module

class labgrid.driver.quartushpsdriver.QuartusHPSDriver(target, name, image=None)[source]

Bases: labgrid.driver.common.Driver

bindings = {'interface': {'AlteraUSBBlaster', 'NetworkAlteraUSBBlaster'}}
__attrs_post_init__()[source]
flash(filename=None, address=0)[source]
erase(address=None, size=None)[source]
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='image', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, image=None) → None

Method generated by attrs for class QuartusHPSDriver.

__module__ = 'labgrid.driver.quartushpsdriver'
__repr__()

Method generated by attrs for class QuartusHPSDriver.

labgrid.driver.resetdriver module

class labgrid.driver.resetdriver.DigitalOutputResetDriver(target, name, delay=1.0)[source]

Bases: labgrid.driver.common.Driver, labgrid.protocol.resetprotocol.ResetProtocol

DigitalOutputResetDriver - Driver using a DigitalOutput to reset the target

bindings = {'output': <class 'labgrid.protocol.digitaloutputprotocol.DigitalOutputProtocol'>}
__attrs_post_init__()[source]
reset()[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='delay', default=1.0, validator=<instance_of validator for type <class 'float'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, delay=1.0) → None

Method generated by attrs for class DigitalOutputResetDriver.

__module__ = 'labgrid.driver.resetdriver'
__repr__()

Method generated by attrs for class DigitalOutputResetDriver.

labgrid.driver.serialdigitaloutput module

class labgrid.driver.serialdigitaloutput.SerialPortDigitalOutputDriver(target, name, signal, invert)[source]

Bases: labgrid.driver.common.Driver, labgrid.protocol.digitaloutputprotocol.DigitalOutputProtocol

Controls the state of a GPIO using the control lines of a serial port.

This driver uses the flow-control pins of a serial port (for example an USB-UART-dongle) to control some external power switch. You may connect some kind of relay board to the flow control pins.

The serial port should NOT be used for serial communication at the same time. This will probably reset the flow-control signals.

Usable signals are DTR and RTS.

bindings = {'serial': <class 'labgrid.driver.serialdriver.SerialDriver'>}
__attrs_post_init__()[source]
get()[source]

Implementations should return the status of the OneWirePort.

set(value)[source]

Implementations should set the status of the OneWirePort

__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='signal', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='invert', default=NOTHING, validator=<instance_of validator for type <class 'bool'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, signal, invert) → None

Method generated by attrs for class SerialPortDigitalOutputDriver.

__module__ = 'labgrid.driver.serialdigitaloutput'
__repr__()

Method generated by attrs for class SerialPortDigitalOutputDriver.

labgrid.driver.serialdriver module

class labgrid.driver.serialdriver.SerialDriver(target, name, txdelay=0.0, timeout=3.0)[source]

Bases: labgrid.driver.consoleexpectmixin.ConsoleExpectMixin, labgrid.driver.common.Driver, labgrid.protocol.consoleprotocol.ConsoleProtocol

Driver implementing the ConsoleProtocol interface over a SerialPort connection

bindings = {'port': {'NetworkSerialPort', 'SerialPort'}}
message = 'The installed pyserial version does not contain important RFC2217 fixes.\nYou can install the labgrid fork via:\npip uninstall pyserial\npip install https://github.com/labgrid-project/pyserial/archive/v3.4.0.1.zip#egg=pyserial\n'
__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

on_deactivate()[source]

Called by the Target when this object has been deactivated

open()[source]

Opens the serialport, does nothing if it is already closed

__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='txdelay', default=0.0, validator=<instance_of validator for type <class 'float'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='timeout', default=3.0, validator=<instance_of validator for type <class 'float'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, txdelay=0.0, timeout=3.0) → None

Method generated by attrs for class SerialDriver.

__module__ = 'labgrid.driver.serialdriver'
__repr__()

Method generated by attrs for class SerialDriver.

close()[source]

Closes the serialport, does nothing if it is already closed

labgrid.driver.shelldriver module

The ShellDriver provides the CommandProtocol, ConsoleProtocol and InfoProtocol on top of a SerialPort.

class labgrid.driver.shelldriver.ShellDriver(target, name, prompt, login_prompt, username, password='', keyfile='', login_timeout=60, console_ready='', await_login_timeout=2)[source]

Bases: labgrid.driver.commandmixin.CommandMixin, labgrid.driver.common.Driver, labgrid.protocol.commandprotocol.CommandProtocol, labgrid.protocol.filetransferprotocol.FileTransferProtocol

ShellDriver - Driver to execute commands on the shell ShellDriver binds on top of a ConsoleProtocol.

Parameters
  • prompt (regex) – the shell prompt to detect

  • login_prompt (regex) – the login prompt to detect

  • username (str) – username to login with

  • password (str) – password to login with

  • keyfile (str) – keyfile to bind mount over users authorized keys

  • login_timeout (int) – optional, timeout for login prompt detection

bindings = {'console': <class 'labgrid.protocol.consoleprotocol.ConsoleProtocol'>}
__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

on_deactivate()[source]

Called by the Target when this object has been deactivated

run(cmd, timeout=30.0, codec='utf-8', decodeerrors='strict')[source]

Run a command

get_status()[source]

Returns the status of the shell-driver. 0 means not connected/found, 1 means shell

put_ssh_key(keyfile_path)[source]
put_bytes(buf: bytes, remotefile: str)[source]

Upload a file to the target. Will silently overwrite the remote file if it already exists.

Parameters
  • buf (bytes) – file contents

  • remotefile (str) – destination filename on the target

Raises

ExecutionError – if something went wrong

put(localfile: str, remotefile: str)[source]

Upload a file to the target. Will silently overwrite the remote file if it already exists.

Parameters
  • localfile (str) – source filename on the local machine

  • remotefile (str) – destination filename on the target

Raises
  • IOError – if the provided localfile could not be found

  • ExecutionError – if something else went wrong

get_bytes(remotefile: str)[source]

Download a file from the target.

Parameters

remotefile (str) – source filename on the target

Returns

(bytes) file contents

Raises

ExecutionError – if something went wrong

get(remotefile: str, localfile: str)[source]

Download a file from the target. Will silently overwrite the local file if it already exists.

Parameters
  • remotefile (str) – source filename on the target

  • localfile (str) – destination filename on the local machine (can be relative)

Raises
  • IOError – if localfile could not be written

  • ExecutionError – if something went wrong

run_script(data: bytes, timeout: int = 60)[source]

Upload a script to the target and run it.

Parameters
  • data (bytes) – script data

  • timeout (int) – timeout for the script to finish execution

Returns

str, stderr: str, return_value: int)

Return type

Tuple of (stdout

Raises

ExecutionError – if something went wrong

run_script_file(scriptfile: str, *args, timeout: int = 60)[source]

Upload a script file to the target and run it.

Parameters
  • scriptfile (str) – source file on the local file system to upload to the target

  • *args – (list of str): any arguments for the script as positional arguments

  • timeout (int) – timeout for the script to finish execution

Returns

str, stderr: str, return_value: int)

Return type

Tuple of (stdout

Raises
  • ExecutionError – if something went wrong

  • IOError – if the provided localfile could not be found

__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='prompt', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='login_prompt', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='username', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='password', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='keyfile', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='login_timeout', default=60, validator=<instance_of validator for type <class 'int'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='console_ready', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='await_login_timeout', default=2, validator=<instance_of validator for type <class 'int'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, prompt, login_prompt, username, password='', keyfile='', login_timeout=60, console_ready='', await_login_timeout=2) → None

Method generated by attrs for class ShellDriver.

__module__ = 'labgrid.driver.shelldriver'
__repr__()

Method generated by attrs for class ShellDriver.

labgrid.driver.sigrokdriver module

class labgrid.driver.sigrokdriver.SigrokCommon(target, name)[source]

Bases: labgrid.driver.common.Driver

__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

on_deactivate()[source]

Called by the Target when this object has been deactivated

__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None))
__init__(target, name) → None

Method generated by attrs for class SigrokCommon.

__module__ = 'labgrid.driver.sigrokdriver'
__repr__()

Method generated by attrs for class SigrokCommon.

class labgrid.driver.sigrokdriver.SigrokDriver(target, name)[source]

Bases: labgrid.driver.sigrokdriver.SigrokCommon

The SigrokDriver uses sigrok-cli to record samples and expose them as python dictionaries.

Parameters

bindings (dict) – driver to use with sigrok

bindings = {'sigrok': {<class 'labgrid.resource.remote.NetworkSigrokUSBDevice'>, <class 'labgrid.resource.udev.SigrokUSBDevice'>, <class 'labgrid.resource.sigrok.SigrokDevice'>}}
capture(filename, samplerate='200k')[source]
stop()[source]
analyze(args, filename=None)[source]
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None))
__init__(target, name) → None

Method generated by attrs for class SigrokDriver.

__module__ = 'labgrid.driver.sigrokdriver'
__repr__()

Method generated by attrs for class SigrokDriver.

class labgrid.driver.sigrokdriver.SigrokPowerDriver(target, name, delay=3.0, max_voltage=None, max_current=None)[source]

Bases: labgrid.driver.sigrokdriver.SigrokCommon, labgrid.driver.powerdriver.PowerResetMixin, labgrid.protocol.powerprotocol.PowerProtocol

The SigrokPowerDriverDriver uses sigrok-cli to control a PSU and collect measurements.

Parameters

bindings (dict) – driver to use with sigrok

bindings = {'sigrok': {<class 'labgrid.resource.remote.NetworkSigrokUSBSerialDevice'>, <class 'labgrid.resource.udev.SigrokUSBSerialDevice'>}}
on()[source]
off()[source]
cycle()[source]
set_voltage_target(value)[source]
set_current_limit(value)[source]
get()[source]
measure()[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='delay', default=3.0, validator=<instance_of validator for type <class 'float'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='max_voltage', default=None, validator=<optional validator for <instance_of validator for type <class 'float'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=<function optional.<locals>.optional_converter>, kw_only=False, inherited=False, on_setattr=None), Attribute(name='max_current', default=None, validator=<optional validator for <instance_of validator for type <class 'float'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=<function optional.<locals>.optional_converter>, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, delay=3.0, max_voltage=None, max_current=None) → None

Method generated by attrs for class SigrokPowerDriver.

__module__ = 'labgrid.driver.sigrokdriver'
__repr__()

Method generated by attrs for class SigrokPowerDriver.

labgrid.driver.smallubootdriver module

class labgrid.driver.smallubootdriver.SmallUBootDriver(target, name, prompt='', autoboot='stop autoboot', password='', interrupt='n', init_commands=NOTHING, password_prompt='enter Password:', boot_expression='U-Boot 20\d+', bootstring='Linux version \d', boot_command='run bootcmd', boot_secret='a', login_timeout=60)[source]

Bases: labgrid.driver.ubootdriver.UBootDriver

SmallUBootDriver is meant as a driver for UBoot with only little functionality compared to standard a standard UBoot. Especially is copes with the following limitations:

  • The UBoot does not have a real password-prompt but can be activated by entering a “secret” after a message was displayed.

  • The command line is does not have a build-in echo command. Thus this driver uses ‘Unknown Command’ messages as marker before and after the output of a command.

  • Since there is no echo we can not return the exit code of the command. Commands will always return 0 unless the command was not found.

This driver needs the following features activated in UBoot to work:

  • The UBoot must not have real password prompt. Instead it must be keyword activated. For example it should be activated by a dialog like the following: UBoot: “Autobooting in 1s…” Labgrid: “secret” UBoot: <switching to console>

  • The UBoot must be able to parse multiple commands in a single line separated by “;”.

  • The UBoot must support the “bootm” command to boot from a memory location.

This driver was created especially for the following devices:

  • TP-Link WR841 v11

Parameters
  • boot_secret (str) – optional, secret used to unlock prompt

  • login_timeout (int) – optional, timeout for login prompt detection,

boot(name)[source]

Boot the device from the given memory location using ‘bootm’.

Parameters

name (str) – address to boot

__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='prompt', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='autoboot', default='stop autoboot', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='password', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='interrupt', default='\n', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='init_commands', default=Factory(factory=<class 'tuple'>, takes_self=False), validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=<class 'tuple'>, kw_only=False, inherited=True, on_setattr=None), Attribute(name='password_prompt', default='enter Password:', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='boot_expression', default='U-Boot 20\\d+', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='bootstring', default='Linux version \\d', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='boot_command', default='run bootcmd', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='boot_secret', default='a', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='login_timeout', default=60, validator=<instance_of validator for type <class 'int'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, prompt='', autoboot='stop autoboot', password='', interrupt='\n', init_commands=NOTHING, password_prompt='enter Password:', boot_expression='U-Boot 20\\d+', bootstring='Linux version \\d', boot_command='run bootcmd', boot_secret='a', login_timeout=60) → None

Method generated by attrs for class SmallUBootDriver.

__module__ = 'labgrid.driver.smallubootdriver'
__repr__()

Method generated by attrs for class SmallUBootDriver.

labgrid.driver.sshdriver module

The SSHDriver uses SSH as a transport to implement CommandProtocol and FileTransferProtocol

class labgrid.driver.sshdriver.SSHDriver(target, name, keyfile='', stderr_merge=False)[source]

Bases: labgrid.driver.commandmixin.CommandMixin, labgrid.driver.common.Driver, labgrid.protocol.commandprotocol.CommandProtocol, labgrid.protocol.filetransferprotocol.FileTransferProtocol

SSHDriver - Driver to execute commands via SSH

bindings = {'networkservice': 'NetworkService'}
priorities = {<class 'labgrid.protocol.commandprotocol.CommandProtocol'>: 10, <class 'labgrid.protocol.filetransferprotocol.FileTransferProtocol'>: 10}
__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

on_deactivate()[source]

Called by the Target when this object has been deactivated

run(cmd, codec='utf-8', decodeerrors='strict', timeout=None)[source]

Run a command

interact(cmd=None)[source]
scp(*, src, dst)[source]
rsync(*, src, dst, extra=[])[source]
sshfs(*, path, mountpoint)[source]
get_status()[source]

The SSHDriver is always connected, return 1

put(filename, remotepath='')[source]
get(filename, destination='.')[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='keyfile', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='stderr_merge', default=False, validator=<instance_of validator for type <class 'bool'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, keyfile='', stderr_merge=False) → None

Method generated by attrs for class SSHDriver.

__module__ = 'labgrid.driver.sshdriver'
__repr__()

Method generated by attrs for class SSHDriver.

labgrid.driver.ubootdriver module

The U-Boot Module contains the UBootDriver

class labgrid.driver.ubootdriver.UBootDriver(target, name, prompt='', autoboot='stop autoboot', password='', interrupt='n', init_commands=NOTHING, password_prompt='enter Password:', boot_expression='U-Boot 20\d+', bootstring='Linux version \d', boot_command='run bootcmd', login_timeout=30)[source]

Bases: labgrid.driver.commandmixin.CommandMixin, labgrid.driver.common.Driver, labgrid.protocol.commandprotocol.CommandProtocol, labgrid.protocol.linuxbootprotocol.LinuxBootProtocol

UBootDriver - Driver to control uboot via the console. UBootDriver binds on top of a ConsoleProtocol.

Parameters
  • prompt (str) – The default UBoot Prompt

  • password (str) – optional password to unlock UBoot

  • init_commands (Tuple[str]) – a tuple of commands to run after unlock

  • interrupt (str) – interrupt character to use to go to prompt

  • password_prompt (str) – string to detect the password prompt

  • boot_expression (str) – string to search for on UBoot start

  • bootstring (str) – string that indicates that the Kernel is booting

  • boot_command (str) – optional boot command to boot target

  • login_timeout (int) – optional, timeout for login prompt detection

bindings = {'console': <class 'labgrid.protocol.consoleprotocol.ConsoleProtocol'>}
__attrs_post_init__()[source]
on_activate()[source]

Activate the UBootDriver

This function checks for a prompt and awaits it if not already active

on_deactivate()[source]

Deactivate the UBootDriver

Simply sets the internal status to 0

run(cmd, timeout=30)[source]

Runs the specified command on the shell and returns the output.

Parameters
  • cmd (str) – command to run on the shell

  • timeout (int) – optional, how long to wait for completion

Returns

if successful, None otherwise

Return type

Tuple[List[str],List[str], int]

get_status()[source]

Retrieve status of the UBootDriver. 0 means inactive, 1 means active.

Returns

status of the driver

Return type

int

reset()[source]

Reset the board via a CPU reset

await_boot()[source]

Wait for the initial Linux version string to verify we succesfully jumped into the kernel.

boot(name)[source]

Boot the default or a specific boot entry

Parameters

name (str) – name of the entry to boot

__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='prompt', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='autoboot', default='stop autoboot', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='password', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='interrupt', default='\n', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='init_commands', default=Factory(factory=<class 'tuple'>, takes_self=False), validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=<class 'tuple'>, kw_only=False, inherited=False, on_setattr=None), Attribute(name='password_prompt', default='enter Password:', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='boot_expression', default='U-Boot 20\\d+', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='bootstring', default='Linux version \\d', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='boot_command', default='run bootcmd', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='login_timeout', default=30, validator=<instance_of validator for type <class 'int'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, prompt='', autoboot='stop autoboot', password='', interrupt='\n', init_commands=NOTHING, password_prompt='enter Password:', boot_expression='U-Boot 20\\d+', bootstring='Linux version \\d', boot_command='run bootcmd', login_timeout=30) → None

Method generated by attrs for class UBootDriver.

__module__ = 'labgrid.driver.ubootdriver'
__repr__()

Method generated by attrs for class UBootDriver.

labgrid.driver.usbloader module

class labgrid.driver.usbloader.MXSUSBDriver(target, name, image=None)[source]

Bases: labgrid.driver.common.Driver, labgrid.protocol.bootstrapprotocol.BootstrapProtocol

bindings = {'loader': {'MXSUSBLoader', 'NetworkMXSUSBLoader'}}
__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

on_deactivate()[source]

Called by the Target when this object has been deactivated

load(filename=None)[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='image', default=None, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, image=None) → None

Method generated by attrs for class MXSUSBDriver.

__module__ = 'labgrid.driver.usbloader'
__repr__()

Method generated by attrs for class MXSUSBDriver.

class labgrid.driver.usbloader.IMXUSBDriver(target, name, image=None)[source]

Bases: labgrid.driver.common.Driver, labgrid.protocol.bootstrapprotocol.BootstrapProtocol

bindings = {'loader': {'IMXUSBLoader', 'MXSUSBLoader', 'NetworkIMXUSBLoader', 'NetworkMXSUSBLoader'}}
__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

on_deactivate()[source]

Called by the Target when this object has been deactivated

load(filename=None)[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='image', default=None, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, image=None) → None

Method generated by attrs for class IMXUSBDriver.

__module__ = 'labgrid.driver.usbloader'
__repr__()

Method generated by attrs for class IMXUSBDriver.

class labgrid.driver.usbloader.RKUSBDriver(target, name, image=None, usb_loader=None)[source]

Bases: labgrid.driver.common.Driver, labgrid.protocol.bootstrapprotocol.BootstrapProtocol

bindings = {'loader': {'NetworkRKUSBLoader', 'RKUSBLoader'}}
__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

on_deactivate()[source]

Called by the Target when this object has been deactivated

load(filename=None)[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='image', default=None, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='usb_loader', default=None, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, image=None, usb_loader=None) → None

Method generated by attrs for class RKUSBDriver.

__module__ = 'labgrid.driver.usbloader'
__repr__()

Method generated by attrs for class RKUSBDriver.

class labgrid.driver.usbloader.UUUDriver(target, name, image=None, cmd='spl')[source]

Bases: labgrid.driver.common.Driver, labgrid.protocol.bootstrapprotocol.BootstrapProtocol

bindings = {'loader': {'IMXUSBLoader', 'MXSUSBLoader', 'NetworkIMXUSBLoader', 'NetworkMXSUSBLoader'}}
__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

on_deactivate()[source]

Called by the Target when this object has been deactivated

load(filename=None)[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='image', default=None, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), Attribute(name='cmd', default='spl', validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, image=None, cmd='spl') → None

Method generated by attrs for class UUUDriver.

__module__ = 'labgrid.driver.usbloader'
__repr__()

Method generated by attrs for class UUUDriver.

labgrid.driver.usbsdmuxdriver module

class labgrid.driver.usbsdmuxdriver.USBSDMuxDriver(target, name)[source]

Bases: labgrid.driver.common.Driver

The USBSDMuxDriver uses the usbsdmux tool (https://github.com/pengutronix/usbsdmux) to control the USB-SD-Mux hardware

Parameters

bindings (dict) – driver to use with usbsdmux

bindings = {'mux': {'NetworkUSBSDMuxDevice', 'USBSDMuxDevice'}}
__attrs_post_init__()[source]
set_mode(mode)[source]
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None))
__init__(target, name) → None

Method generated by attrs for class USBSDMuxDriver.

__module__ = 'labgrid.driver.usbsdmuxdriver'
__repr__()

Method generated by attrs for class USBSDMuxDriver.

labgrid.driver.usbsdwiredriver module

class labgrid.driver.usbsdwiredriver.USBSDWireDriver(target, name)[source]

Bases: labgrid.driver.common.Driver

The USBSDWireDriver uses the sd-mux-ctrl tool to control SDWire hardware

Parameters

bindings (dict) – driver to use with usbsdmux

bindings = {'mux': {'NetworkUSBSDWireDevice', 'USBSDWireDevice'}}
__attrs_post_init__()[source]
set_mode(mode)[source]
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None))
__init__(target, name) → None

Method generated by attrs for class USBSDWireDriver.

__module__ = 'labgrid.driver.usbsdwiredriver'
__repr__()

Method generated by attrs for class USBSDWireDriver.

labgrid.driver.usbstoragedriver module

class labgrid.driver.usbstoragedriver.Mode[source]

Bases: enum.Enum

An enumeration.

DD = 'dd'
BMAPTOOL = 'bmaptool'
__module__ = 'labgrid.driver.usbstoragedriver'
class labgrid.driver.usbstoragedriver.USBStorageDriver(target, name, image=None)[source]

Bases: labgrid.driver.common.Driver

bindings = {'storage': {'NetworkUSBMassStorage', 'NetworkUSBSDMuxDevice', 'NetworkUSBSDWireDevice', 'USBMassStorage', 'USBSDMuxDevice', 'USBSDWireDevice'}}
__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

on_deactivate()[source]

Called by the Target when this object has been deactivated

write_image(filename=None, mode=<Mode.DD: 'dd'>, partition=None, skip=0, seek=0)[source]

Writes the file specified by filename or if not specified by config image subkey to the bound USB storage root device or partition.

Parameters
  • filename (str) – optional, path to the image to write to bound USB storage

  • mode (Mode) – optional, Mode.DD or Mode.BMAPTOOL (defaults to Mode.DD)

  • partition (int or None) – optional, write to the specified partition or None for writing to root device (defaults to None)

  • skip (int) – optional, skip n 512-sized blocks at start of input file (defaults to 0)

  • seek (int) – optional, skip n 512-sized blocks at start of output (defaults to 0)

get_size()[source]
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='image', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None))
__init__(target, name, image=None) → None

Method generated by attrs for class USBStorageDriver.

__module__ = 'labgrid.driver.usbstoragedriver'
__repr__()

Method generated by attrs for class USBStorageDriver.

class labgrid.driver.usbstoragedriver.NetworkUSBStorageDriver(target, name, image=None)[source]

Bases: labgrid.driver.usbstoragedriver.USBStorageDriver

__attrs_post_init__()[source]
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='image', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None))
__init__(target, name, image=None) → None

Method generated by attrs for class NetworkUSBStorageDriver.

__module__ = 'labgrid.driver.usbstoragedriver'
__repr__()

Method generated by attrs for class NetworkUSBStorageDriver.

labgrid.driver.usbtmcdriver module

class labgrid.driver.usbtmcdriver.USBTMCDriver(target, name)[source]

Bases: labgrid.driver.common.Driver

bindings = {'tmc': {'NetworkUSBTMC', 'USBTMC'}}
__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

on_deactivate()[source]

Called by the Target when this object has been deactivated

command(cmd)[source]
query(cmd, binary=False, raw=False)[source]
identify()[source]
get_channel_info(channel)[source]
get_channel_values(channel)[source]
get_screenshot()[source]
get_bool(cmd)[source]
get_int(cmd)[source]
get_decimal(cmd)[source]
get_str(cmd)[source]
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None))
__init__(target, name) → None

Method generated by attrs for class USBTMCDriver.

__module__ = 'labgrid.driver.usbtmcdriver'
__repr__()

Method generated by attrs for class USBTMCDriver.

labgrid.driver.usbvideodriver module

class labgrid.driver.usbvideodriver.USBVideoDriver(target, name)[source]

Bases: labgrid.driver.common.Driver

bindings = {'video': {'NetworkUSBVideo', 'USBVideo'}}
get_caps()[source]
select_caps(hint=None)[source]
get_pipeline()[source]
stream(caps_hint=None)[source]
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None))
__init__(target, name) → None

Method generated by attrs for class USBVideoDriver.

__module__ = 'labgrid.driver.usbvideodriver'
__repr__()

Method generated by attrs for class USBVideoDriver.

labgrid.driver.xenadriver module

class labgrid.driver.xenadriver.XenaDriver(target, name)[source]

Bases: labgrid.driver.common.Driver

Xena Driver

bindings = {'xena_manager': 'XenaManager'}
__attrs_post_init__()[source]
on_activate()[source]

Called by the Target when this object has been activated

on_deactivate()[source]

Called by the Target when this object has been deactivated

get_session()[source]
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, eq=True, order=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=True, on_setattr=None))
__init__(target, name) → None

Method generated by attrs for class XenaDriver.

__module__ = 'labgrid.driver.xenadriver'
__repr__()

Method generated by attrs for class XenaDriver.