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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='prompt', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='autoboot', default='stop autoboot', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='interrupt', default='\n', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='bootstring', default='Linux version \\d', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='password', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='login_timeout', default=60, validator=<instance_of validator for type <class 'int'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, prompt='', autoboot='stop autoboot', interrupt='\n', bootstring='Linux version \\d', password='', login_timeout=60) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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'>, <class 'labgrid.resource.udev.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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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': {<class 'labgrid.resource.docker.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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='image_uri', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='command', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='volumes', default=None, validator=<optional validator for <instance_of validator for type <class 'list'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='container_name', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='environment', default=None, validator=<optional validator for <instance_of validator for type <class 'list'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='host_config', default=None, validator=<optional validator for <instance_of validator for type <class 'dict'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='network_services', default=None, validator=<optional validator for <instance_of validator for type <class 'list'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, image_uri=None, command=None, volumes=None, container_name=None, environment=None, host_config=None, network_services=None) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='stdout', default=None, validator=<optional validator for <instance_of validator for type <class 'list'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='stderr', default=None, validator=<optional validator for <instance_of validator for type <class 'list'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(msg, stdout=None, stderr=None) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

__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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False),)
__init__(msg) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

__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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='cmd', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='txdelay', default=0.0, validator=<instance_of validator for type <class 'float'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, cmd, txdelay=0.0) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='txdelay', default=0.0, validator=<instance_of validator for type <class 'float'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, txdelay=0.0) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

labgrid.driver.fastbootdriver module

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

Bases: labgrid.driver.common.Driver

bindings = {'fastboot': {<class 'labgrid.resource.remote.NetworkAndroidFastboot'>, <class 'labgrid.resource.udev.AndroidFastboot'>}}
__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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='image', default=None, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='sparse_size', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, image=None, sparse_size=None) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='filepath', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='false_repr', default='0\n', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='true_repr', default='1\n', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, filepath, false_repr='0\n', true_repr='1\n') → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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': {<class 'labgrid.resource.flashrom.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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='image', default=None, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, image=None) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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': {<class 'labgrid.resource.base.SysfsGPIO'>, <class 'labgrid.resource.remote.NetworkSysfsGPIO'>}}
__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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

labgrid.driver.modbusdriver module

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

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

bindings = {'coil': <class 'labgrid.resource.modbus.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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

labgrid.driver.networkusbstoragedriver module

class labgrid.driver.networkusbstoragedriver.Mode[source]

Bases: enum.Enum

An enumeration.

DD = 1
BMAPTOOL = 2
__module__ = 'labgrid.driver.networkusbstoragedriver'
class labgrid.driver.networkusbstoragedriver.NetworkUSBStorageDriver(target, name, image=None)[source]

Bases: labgrid.driver.common.Driver

bindings = {'storage': {<class 'labgrid.resource.udev.USBMassStorage'>, <class 'labgrid.resource.remote.NetworkUSBSDMuxDevice'>, <class 'labgrid.resource.remote.NetworkUSBMassStorage'>, <class 'labgrid.resource.udev.USBSDMuxDevice'>}}
__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: 1>)[source]
get_size()[source]
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='image', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, image=None) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

labgrid.driver.onewiredriver module

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

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

bindings = {'port': <class 'labgrid.resource.onewireport.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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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': {<class 'labgrid.resource.remote.NetworkAlteraUSBBlaster'>, <class 'labgrid.resource.udev.AlteraUSBBlaster'>}}
__attrs_post_init__()[source]
resolve_path_str_or_list(path)[source]
load(filename=None)[source]
execute(commands: list)[source]
__abstractmethods__ = frozenset({})
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='config', default=NOTHING, validator=<instance_of validator for type (<class 'str'>, <class 'list'>)>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='search', default=[], validator=<optional validator for <instance_of validator for type (<class 'str'>, <class 'list'>)> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='image', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, config, search=[], image=None) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='cmd_on', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='cmd_off', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='cmd_cycle', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='delay', default=2.0, validator=<instance_of validator for type <class 'float'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, cmd_on, cmd_off, cmd_cycle=None, delay=2.0) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='delay', default=2.0, validator=<instance_of validator for type <class 'float'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, delay=2.0) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='delay', default=1.0, validator=<instance_of validator for type <class 'float'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, delay=1.0) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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': <class 'labgrid.resource.ykushpowerport.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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='delay', default=2.0, validator=<instance_of validator for type <class 'float'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, delay=2.0) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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': {<class 'labgrid.resource.remote.NetworkUSBPowerPort'>, <class 'labgrid.resource.udev.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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='delay', default=2.0, validator=<instance_of validator for type <class 'float'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, delay=2.0) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='qemu_bin', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='machine', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='cpu', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='memory', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='extra_args', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='boot_args', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='kernel', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='disk', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='rootfs', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='dtb', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='flash', default=None, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, qemu_bin, machine, cpu, memory, extra_args, boot_args=None, kernel=None, disk=None, rootfs=None, dtb=None, flash=None) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

labgrid.driver.quartushpsdriver module

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

Bases: labgrid.driver.common.Driver

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

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='delay', default=1.0, validator=<instance_of validator for type <class 'float'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, delay=1.0) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

labgrid.driver.serialdigitaloutput module

class labgrid.driver.serialdigitaloutput.SerialPortDigitalOutputDriver(target, name, signal)[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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='signal', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, signal) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

labgrid.driver.serialdriver module

class labgrid.driver.serialdriver.SerialDriver(target, name, txdelay=0.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': {<class 'labgrid.resource.base.SerialPort'>, <class 'labgrid.resource.serialport.NetworkSerialPort'>}}
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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='txdelay', default=0.0, validator=<instance_of validator for type <class 'float'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, txdelay=0.0) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='prompt', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='login_prompt', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='username', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='password', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='keyfile', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='login_timeout', default=60, validator=<instance_of validator for type <class 'int'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='console_ready', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='await_login_timeout', default=2, validator=<instance_of validator for type <class 'int'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, prompt, login_prompt, username, password='', keyfile='', login_timeout=60, console_ready='', await_login_timeout=2) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

labgrid.driver.sigrokdriver module

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

Bases: labgrid.driver.common.Driver

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'>}}
__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

capture(filename, samplerate='200k')[source]
stop()[source]
analyze(args, filename=None)[source]
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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_secret='a', login_timeout=60.0)[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

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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='prompt', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='autoboot', default='stop autoboot', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='password', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='interrupt', default='\n', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='init_commands', default=Factory(factory=<class 'tuple'>, takes_self=False), validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=<class 'tuple'>, kw_only=False), Attribute(name='password_prompt', default='enter Password:', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='boot_expression', default='U-Boot 20\\d+', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='bootstring', default='Linux version \\d', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='boot_secret', default='a', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='login_timeout', default=60.0, validator=<instance_of validator for type <class 'float'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__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_secret='a', login_timeout=60.0) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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': <class 'labgrid.resource.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

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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='keyfile', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='stderr_merge', default=False, validator=<instance_of validator for type <class 'bool'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, keyfile='', stderr_merge=False) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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', 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

  • 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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='prompt', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='autoboot', default='stop autoboot', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='password', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='interrupt', default='\n', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='init_commands', default=Factory(factory=<class 'tuple'>, takes_self=False), validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=<class 'tuple'>, kw_only=False), Attribute(name='password_prompt', default='enter Password:', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='boot_expression', default='U-Boot 20\\d+', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='bootstring', default='Linux version \\d', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='login_timeout', default=30, validator=<instance_of validator for type <class 'int'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__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', login_timeout=30) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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': {<class 'labgrid.resource.remote.NetworkMXSUSBLoader'>, <class 'labgrid.resource.udev.MXSUSBLoader'>}}
__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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='image', default=None, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, image=None) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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

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

bindings = {'loader': {<class 'labgrid.resource.remote.NetworkMXSUSBLoader'>, <class 'labgrid.resource.udev.IMXUSBLoader'>, <class 'labgrid.resource.udev.MXSUSBLoader'>, <class 'labgrid.resource.remote.NetworkIMXUSBLoader'>}}
__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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='image', default=None, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, image=None) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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

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

bindings = {'loader': {<class 'labgrid.resource.udev.RKUSBLoader'>, <class 'labgrid.resource.remote.NetworkRKUSBLoader'>}}
__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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='image', default=None, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='usb_loader', default=None, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name, image=None, usb_loader=None) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

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': {<class 'labgrid.resource.remote.NetworkUSBSDMuxDevice'>, <class 'labgrid.resource.udev.USBSDMuxDevice'>}}
__attrs_post_init__()[source]
set_mode(mode)[source]
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

labgrid.driver.usbstorage module

class labgrid.driver.usbstorage.USBStorageDriver(target, name)[source]

Bases: labgrid.driver.common.Driver

bindings = {'storage': {<class 'labgrid.resource.udev.USBMassStorage'>, <class 'labgrid.resource.udev.USBSDMuxDevice'>}}
__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)[source]
get_size()[source]
__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

labgrid.driver.usbtmcdriver module

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

Bases: labgrid.driver.common.Driver

bindings = {'tmc': {<class 'labgrid.resource.remote.NetworkUSBTMC'>, <class 'labgrid.resource.udev.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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

labgrid.driver.usbvideodriver module

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

Bases: labgrid.driver.common.Driver

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

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.

labgrid.driver.xenadriver module

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

Bases: labgrid.driver.common.Driver

Xena Driver

bindings = {'xena_manager': <class 'labgrid.resource.xenamanager.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, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='name', default=NOTHING, validator=<optional validator for <instance_of validator for type <class 'str'>> or None>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='state', default=<BindingState.idle: 0>, validator=None, repr=True, cmp=True, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__init__(target, name) → None

Initialize self. See help(type(self)) for accurate signature.

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

Automatically created by attrs.