| 1 |
Configuration |
| 2 |
============= |
| 3 |
This chapter describes the individual drivers and resources used in a device |
| 4 |
configuration. |
| 5 |
Drivers can depend on resources or other drivers, whereas resources |
| 6 |
have no dependencies. |
| 7 |
|
| 8 |
.. image:: res/config_graph.svg |
| 9 |
:width: 50% |
| 10 |
|
| 11 |
Here the resource `RawSerialPort`_ provides the information for the |
| 12 |
`SerialDriver`_, which in turn is needed by the `ShellDriver`_. |
| 13 |
Driver dependency resolution is done by searching for the driver which |
| 14 |
implements the dependent protocol, all drivers implement one or more protocols. |
| 15 |
|
| 16 |
Resources |
| 17 |
--------- |
| 18 |
|
| 19 |
Serial Ports |
| 20 |
~~~~~~~~~~~~ |
| 21 |
|
| 22 |
RawSerialPort |
| 23 |
+++++++++++++ |
| 24 |
A :any:`RawSerialPort` is a serial port which is identified via the device path |
| 25 |
on the local computer. |
| 26 |
Take note that re-plugging USB serial converters can result in a different |
| 27 |
enumeration order. |
| 28 |
|
| 29 |
.. code-block:: yaml |
| 30 |
|
| 31 |
RawSerialPort: |
| 32 |
port: '/dev/ttyUSB0' |
| 33 |
speed: 115200 |
| 34 |
|
| 35 |
The example would access the serial port ``/dev/ttyUSB0`` on the local computer |
| 36 |
with a baud rate of ``115200``. |
| 37 |
|
| 38 |
Arguments: |
| 39 |
- port (str): path to the serial device |
| 40 |
- speed (int, default=115200): desired baud rate |
| 41 |
|
| 42 |
Used by: |
| 43 |
- `SerialDriver`_ |
| 44 |
|
| 45 |
NetworkSerialPort |
| 46 |
+++++++++++++++++ |
| 47 |
A :any:`NetworkSerialPort` describes a serial port which is exported over the |
| 48 |
network, usually using `RFC2217 <https://datatracker.ietf.org/doc/rfc2217/>`_ |
| 49 |
or raw TCP. |
| 50 |
|
| 51 |
.. code-block:: yaml |
| 52 |
|
| 53 |
NetworkSerialPort: |
| 54 |
host: 'remote.example.computer' |
| 55 |
port: 53867 |
| 56 |
speed: 115200 |
| 57 |
|
| 58 |
The example would access the serial port on computer |
| 59 |
``remote.example.computer`` via port ``53867`` and use a baud rate of |
| 60 |
``115200`` with the RFC2217 protocol. |
| 61 |
|
| 62 |
Arguments: |
| 63 |
- host (str): hostname of the remote host |
| 64 |
- port (str): TCP port on the remote host to connect to |
| 65 |
- speed (int, default=115200): baud rate of the serial port |
| 66 |
- protocol (str, default="rfc2217"): protocol used for connection: raw or |
| 67 |
rfc2217 |
| 68 |
|
| 69 |
Used by: |
| 70 |
- `SerialDriver`_ |
| 71 |
|
| 72 |
ModbusRTU |
| 73 |
+++++++++ |
| 74 |
A :any:`ModbusRTU` resource is required to use the `ModbusRTUDriver`_. |
| 75 |
`Modbus RTU <https://en.wikipedia.org/wiki/Modbus>`_ is a communication |
| 76 |
protocol used to control many different kinds of electronic systems, such as |
| 77 |
thermostats, power plants, etc. |
| 78 |
Modbus is normally implemented on top of RS-485, though this is not strictly |
| 79 |
necessary, as long as the Modbus network only has one master (and up to 256 |
| 80 |
slaves). |
| 81 |
|
| 82 |
This resource only supports local usage and will not work with an exporter. |
| 83 |
|
| 84 |
.. code-block:: yaml |
| 85 |
|
| 86 |
ModbusRTU: |
| 87 |
port: '/dev/ttyUSB0' |
| 88 |
address: 16 |
| 89 |
speed: 115200 |
| 90 |
timeout: 0.25 |
| 91 |
|
| 92 |
Arguments: |
| 93 |
- port (str): tty the instrument is connected to, e.g. ``/dev/ttyUSB0`` |
| 94 |
- address (int): slave address on the modbus, e.g. 16 |
| 95 |
- speed (int, default=115200): baud rate of the serial port |
| 96 |
- timeout (float, default=0.25): timeout in seconds |
| 97 |
|
| 98 |
Used by: |
| 99 |
- `ModbusRTUDriver`_ |
| 100 |
|
| 101 |
USBSerialPort |
| 102 |
+++++++++++++ |
| 103 |
A :any:`USBSerialPort` describes a serial port which is connected via USB and |
| 104 |
is identified by matching udev properties. |
| 105 |
This allows identification through hot-plugging or rebooting. |
| 106 |
|
| 107 |
.. code-block:: yaml |
| 108 |
|
| 109 |
USBSerialPort: |
| 110 |
match: |
| 111 |
ID_SERIAL_SHORT: 'P-00-00682' |
| 112 |
ID_USB_INTERFACE_NUM: '00' |
| 113 |
speed: 115200 |
| 114 |
|
| 115 |
The example would search for a USB serial converter with a given serial number |
| 116 |
(``ID_SERIAL_SHORT`` = ``P-00-00682``) and use first interface |
| 117 |
(``ID_USB_INTERFACE_NUM`` = ``00``) with a baud rate of 115200. |
| 118 |
|
| 119 |
The ``ID_SERIAL_SHORT`` and ``ID_USB_INTERFACE_NUM`` properties are set by the |
| 120 |
``usb_id`` builtin helper program. |
| 121 |
|
| 122 |
Arguments: |
| 123 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 124 |
- speed (int, default=115200): baud rate of the serial port |
| 125 |
|
| 126 |
Used by: |
| 127 |
- `SerialDriver`_ |
| 128 |
|
| 129 |
Power Ports |
| 130 |
~~~~~~~~~~~ |
| 131 |
|
| 132 |
NetworkPowerPort |
| 133 |
++++++++++++++++ |
| 134 |
A :any:`NetworkPowerPort` describes a remotely switchable power port. |
| 135 |
|
| 136 |
.. code-block:: yaml |
| 137 |
|
| 138 |
NetworkPowerPort: |
| 139 |
model: 'gude' |
| 140 |
host: 'powerswitch.example.computer' |
| 141 |
index: 0 |
| 142 |
|
| 143 |
The example describes port 0 on the remote power switch |
| 144 |
``powerswitch.example.computer``, which is a ``gude`` model. |
| 145 |
|
| 146 |
Arguments: |
| 147 |
- model (str): model of the power switch |
| 148 |
- host (str): hostname of the power switch |
| 149 |
- index (int): number of the port to switch |
| 150 |
|
| 151 |
The ``model`` property selects one of several `backend implementations |
| 152 |
<https://github.com/labgrid-project/labgrid/tree/master/labgrid/driver/power>`_. |
| 153 |
Currently available are: |
| 154 |
|
| 155 |
``apc`` |
| 156 |
Controls *APU PDUs* via SNMP. |
| 157 |
|
| 158 |
``digipower`` |
| 159 |
Controls *DigiPower PDUs* via a simple HTTP API. |
| 160 |
|
| 161 |
``digitalloggers_http`` |
| 162 |
Controls *Digital Loggers PDUs* that use the legacy HTTP API. Note that |
| 163 |
host argument must include the protocol, such as |
| 164 |
``http://192.168.0.3`` or ``http://admin:[email protected]``. |
| 165 |
|
| 166 |
``digitalloggers_restapi`` |
| 167 |
Controls *Digital Loggers PDUs* that use the REST API. Note that |
| 168 |
host argument must include the protocol, such as |
| 169 |
``http://192.168.0.3`` or ``https://admin:[email protected]``. |
| 170 |
By default, only authenticated users may access the REST API. |
| 171 |
HTTPS queries intentially ignore ssl certificate validation, since |
| 172 |
the as-shipped certificate is self-signed. |
| 173 |
|
| 174 |
``eaton`` |
| 175 |
Controls *Eaton ePDUs* via SNMP. |
| 176 |
|
| 177 |
``eg_pms2_network`` |
| 178 |
Controls *EG_PMS2_LAN* and *EG_PMS2_WLAN* devices, through simple HTTP POST |
| 179 |
and GET requests. The device requires a password for logging into the |
| 180 |
control interface, this module deliberately uses the standard password ``1`` |
| 181 |
and is not compatible with a different password. |
| 182 |
|
| 183 |
``eth008`` |
| 184 |
Controls *Robot-Electronics eth008* via a simple HTTP API. |
| 185 |
|
| 186 |
``gude`` |
| 187 |
Controls *Gude PDUs* via a simple HTTP API. |
| 188 |
|
| 189 |
``gude24`` |
| 190 |
Controls *Gude Expert Power Control 8008 PDUs* via a simple HTTP API. |
| 191 |
|
| 192 |
``gude8031`` |
| 193 |
Controls *Gude Expert Power Control 8031 PDUs* and *Gude Expert Power Control 87-1210-18 PDUs* via a simple HTTP API. |
| 194 |
|
| 195 |
``gude8225`` |
| 196 |
Controls *Gude Expert Power Control 8225 PDUs* via a simple HTTP API. |
| 197 |
|
| 198 |
``gude8316`` |
| 199 |
Controls *Gude Expert Power Control 8316 PDUs* via a simple HTTP API. |
| 200 |
|
| 201 |
``mfi_mpower`` |
| 202 |
Controls the *Ubiquity mFi mPower* Power Strip with Ethernet and Wi-Fi connectivity via HTTP. |
| 203 |
Tested on a mFi mPower Pro EU device. |
| 204 |
|
| 205 |
``netio`` |
| 206 |
Controls *NETIO 4-Port PDUs* via a simple HTTP API. |
| 207 |
|
| 208 |
``netio_kshell`` |
| 209 |
Controls *NETIO 4C PDUs* via a Telnet interface. |
| 210 |
|
| 211 |
``pe6216`` |
| 212 |
Controls an Aten PE6216 PDU via a simple HTTP API. |
| 213 |
This backend deliberately uses the standard username ``administrator`` and the default password |
| 214 |
``password`` and is not compatible with other credentials. |
| 215 |
|
| 216 |
``poe_mib`` |
| 217 |
Controls PoE switches using the PoE SNMP administration MiBs. |
| 218 |
|
| 219 |
``poe_netgear_plus`` |
| 220 |
Controls NETGEAR Plus switches using an HTTP interface. |
| 221 |
|
| 222 |
``raritan`` |
| 223 |
Controls *Raritan PDUs* via SNMP. |
| 224 |
|
| 225 |
``rest`` |
| 226 |
This is a generic backend for PDU implementations which can be controlled via |
| 227 |
HTTP PUT and GET requests. |
| 228 |
See the `docstring in the module |
| 229 |
<https://github.com/labgrid-project/labgrid/blob/master/labgrid/driver/power/rest.py>`__ |
| 230 |
for details. |
| 231 |
|
| 232 |
``sentry`` |
| 233 |
Controls *Sentry PDUs* via SNMP using Sentry3-MIB. |
| 234 |
It was tested on *CW-24VDD* and *4805-XLS-16*. |
| 235 |
|
| 236 |
``shelly_gen1`` |
| 237 |
Controls relays of *Shelly* devices using the Gen 1 Device API. |
| 238 |
See the `docstring in the module |
| 239 |
<https://github.com/labgrid-project/labgrid/blob/master/labgrid/driver/power/shelly_gen1.py>`__ |
| 240 |
for details. |
| 241 |
|
| 242 |
``shelly_gen2`` |
| 243 |
Controls relays of *Shelly* devices using the |
| 244 |
`Gen2+ API <https://shelly-api-docs.shelly.cloud/gen2/General/RPCProtocol/>`__. |
| 245 |
See the `docstring in the module |
| 246 |
<https://github.com/labgrid-project/labgrid/blob/master/labgrid/driver/power/shelly_gen2.py>`__ |
| 247 |
for details. |
| 248 |
|
| 249 |
``siglent`` |
| 250 |
Controls *Siglent SPD3000X* series modules via the `vxi11 Python module |
| 251 |
<https://pypi.org/project/python-vxi11/>`_. |
| 252 |
|
| 253 |
``simplerest`` |
| 254 |
This is a generic backend for PDU implementations which can be controlled via |
| 255 |
HTTP GET requests (both set and get). |
| 256 |
See the `docstring in the module |
| 257 |
<https://github.com/labgrid-project/labgrid/blob/master/labgrid/driver/power/simplerest.py>`__ |
| 258 |
for details. |
| 259 |
|
| 260 |
``tinycontrol`` |
| 261 |
Controls a tinycontrol.eu IP Power Socket via HTTP. |
| 262 |
It was tested on the *6G10A v2* model. |
| 263 |
`Manual <https://tinycontrol.pl/media/documents/manual_IP_Power_Socket__6G10A_v2_LANLIS-010-015_En-1.pdf>`__ |
| 264 |
|
| 265 |
``tinycontrol_tcpdu`` |
| 266 |
Controls a Tinycontrol tcPDU via HTTP. |
| 267 |
See the `documentation <https://docs.tinycontrol.pl/en/tcpdu/api/commands/>`__ |
| 268 |
|
| 269 |
``tplink`` |
| 270 |
Controls *TP-Link power strips* via `python-kasa |
| 271 |
<https://github.com/python-kasa/python-kasa>`_. |
| 272 |
|
| 273 |
``ubus`` |
| 274 |
Controls *PoE switches* running OpenWrt using the |
| 275 |
`ubus interface <https://openwrt.org/docs/techref/ubus>`__, |
| 276 |
|
| 277 |
Used by: |
| 278 |
- `NetworkPowerDriver`_ |
| 279 |
|
| 280 |
PDUDaemonPort |
| 281 |
+++++++++++++ |
| 282 |
A :any:`PDUDaemonPort` describes a Power Distribution Unit (PDU) port accessible via `PDUDaemon |
| 283 |
<https://github.com/pdudaemon/pdudaemon>`_. |
| 284 |
As one PDUDaemon instance can control many PDUs, the instance name from the |
| 285 |
PDUDaemon configuration file needs to be specified. |
| 286 |
|
| 287 |
.. code-block:: yaml |
| 288 |
|
| 289 |
PDUDaemonPort: |
| 290 |
host: 'pduserver' |
| 291 |
pdu: 'apc-snmpv3-noauth' |
| 292 |
index: 1 |
| 293 |
|
| 294 |
The example describes port ``1`` on the PDU configured as |
| 295 |
``apc-snmpv3-noauth``, with PDUDaemon running on the host ``pduserver``. |
| 296 |
|
| 297 |
Arguments: |
| 298 |
- host (str): name of the host running the PDUDaemon |
| 299 |
- pdu (str): name of the PDU in the configuration file |
| 300 |
- index (int): index of the power port on the PDU |
| 301 |
|
| 302 |
Used by: |
| 303 |
- `PDUDaemonDriver`_ |
| 304 |
|
| 305 |
YKUSHPowerPort |
| 306 |
++++++++++++++ |
| 307 |
A :any:`YKUSHPowerPort` describes a *YEPKIT YKUSH*-family USB (HID) |
| 308 |
switchable USB hub. |
| 309 |
Models supported include YKUSH, YKUSH 3, and YKUSH XS. |
| 310 |
|
| 311 |
.. code-block:: yaml |
| 312 |
|
| 313 |
YKUSHPowerPort: |
| 314 |
serial: 'Y3N12345' |
| 315 |
index: '1' |
| 316 |
|
| 317 |
The example describes port 1 on the YKUSH 3 USB hub with the |
| 318 |
serial ``Y3N12345``. |
| 319 |
Use ``ykushcmd ykush3 -l`` to get your serial number. |
| 320 |
|
| 321 |
Arguments: |
| 322 |
- serial (str): serial number of the YKUSH hub |
| 323 |
- index (str): number of the port to switch, use ``a`` to control the whole hub as one logical |
| 324 |
port |
| 325 |
|
| 326 |
Used by: |
| 327 |
- `YKUSHPowerDriver`_ |
| 328 |
|
| 329 |
NetworkYKUSHPowerPort |
| 330 |
+++++++++++++++++++++ |
| 331 |
A :any:`NetworkYKUSHPowerPort` describes a `YKUSHPowerPort`_ resource available |
| 332 |
on a remote computer. |
| 333 |
|
| 334 |
USBPowerPort |
| 335 |
++++++++++++ |
| 336 |
A :any:`USBPowerPort` describes a generic switchable USB hub as supported by |
| 337 |
`uhubctl <https://github.com/mvp/uhubctl>`_. |
| 338 |
|
| 339 |
.. code-block:: yaml |
| 340 |
|
| 341 |
USBPowerPort: |
| 342 |
match: |
| 343 |
ID_PATH: 'pci-0000:00:14.0-usb-0:2:1.0' |
| 344 |
index: 1 |
| 345 |
|
| 346 |
The example describes port 1 on the hub with the ID_PATH |
| 347 |
``pci-0000:00:14.0-usb-0:2:1.0``. |
| 348 |
(use ``udevadm info /sys/bus/usb/devices/...`` to find the ID_PATH value) |
| 349 |
|
| 350 |
Arguments: |
| 351 |
- index (int): number of the port to switch |
| 352 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 353 |
|
| 354 |
Used by: |
| 355 |
- `USBPowerDriver`_ |
| 356 |
|
| 357 |
.. note:: |
| 358 |
labgrid requires that the interface is contained in the ID_PATH. |
| 359 |
This usually means that the ID_PATH should end with ``:1.0``. |
| 360 |
Only this first interface is registered with the ``hub`` driver labgrid is |
| 361 |
looking for, paths without the interface will fail to match since they use |
| 362 |
the ``usb`` driver. |
| 363 |
|
| 364 |
NetworkUSBPowerPort |
| 365 |
+++++++++++++++++++ |
| 366 |
A :any:`NetworkUSBPowerPort` describes a `USBPowerPort`_ resource available on |
| 367 |
a remote computer. |
| 368 |
|
| 369 |
SiSPMPowerPort |
| 370 |
++++++++++++++ |
| 371 |
A :any:`SiSPMPowerPort` describes a *GEMBIRD SiS-PM* as supported by |
| 372 |
`sispmctl <https://sourceforge.net/projects/sispmctl/>`_. |
| 373 |
|
| 374 |
.. code-block:: yaml |
| 375 |
|
| 376 |
SiSPMPowerPort: |
| 377 |
match: |
| 378 |
ID_PATH: 'platform-1c1a400.usb-usb-0:2' |
| 379 |
index: 1 |
| 380 |
|
| 381 |
The example describes port 1 on the hub with the ID_PATH |
| 382 |
``platform-1c1a400.usb-usb-0:2``. |
| 383 |
|
| 384 |
Arguments: |
| 385 |
- index (int): number of the port to switch |
| 386 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 387 |
|
| 388 |
Used by: |
| 389 |
- `SiSPMPowerDriver`_ |
| 390 |
|
| 391 |
NetworkSiSPMPowerPort |
| 392 |
+++++++++++++++++++++ |
| 393 |
A :any:`NetworkSiSPMPowerPort` describes a `SiSPMPowerPort`_ resource available |
| 394 |
on a remote computer. |
| 395 |
|
| 396 |
TasmotaPowerPort |
| 397 |
++++++++++++++++ |
| 398 |
A :any:`TasmotaPowerPort` resource describes a switchable `Tasmota |
| 399 |
<https://tasmota.github.io/docs/>`_ power outlet accessed over *MQTT*. |
| 400 |
|
| 401 |
.. code-block:: yaml |
| 402 |
|
| 403 |
TasmotaPowerPort: |
| 404 |
host: 'this.is.an.example.host.com' |
| 405 |
status_topic: 'stat/tasmota_575A2B/POWER' |
| 406 |
power_topic: 'cmnd/tasmota_575A2B/POWER' |
| 407 |
avail_topic: 'tele/tasmota_575A2B/LWT' |
| 408 |
|
| 409 |
The example uses a *Mosquitto* server at ``this.is.an.example.host.com`` and |
| 410 |
has the topics setup for a Tasmota power port that has the ID ``575A2B``. |
| 411 |
|
| 412 |
Arguments: |
| 413 |
- host (str): hostname of the MQTT server |
| 414 |
- status_topic (str): topic that signals the current status as "ON" or "OFF" |
| 415 |
- power_topic (str): topic that allows switching the status between "ON" and |
| 416 |
"OFF" |
| 417 |
- avail_topic (str): topic that signals the availability of the Tasmota power |
| 418 |
outlet |
| 419 |
- username (str): Optional, MQTT username to authenticate as |
| 420 |
- password (str): Optional, MQTT password to authenticate with |
| 421 |
|
| 422 |
Used by: |
| 423 |
- `TasmotaPowerDriver`_ |
| 424 |
|
| 425 |
Digital Outputs |
| 426 |
~~~~~~~~~~~~~~~ |
| 427 |
|
| 428 |
ModbusTCPCoil |
| 429 |
+++++++++++++ |
| 430 |
A :any:`ModbusTCPCoil` describes a coil accessible via *Modbus TCP*. |
| 431 |
|
| 432 |
.. code-block:: yaml |
| 433 |
|
| 434 |
ModbusTCPCoil: |
| 435 |
host: '192.168.23.42' |
| 436 |
coil: 1 |
| 437 |
|
| 438 |
The example describes the coil with the address ``1`` on the Modbus TCP device |
| 439 |
``192.168.23.42``. |
| 440 |
|
| 441 |
Arguments: |
| 442 |
- host (str): hostname of the Modbus TCP server e.g. ``192.168.23.42:502`` |
| 443 |
- coil (int): index of the coil, e.g. ``3`` |
| 444 |
- invert (bool, default=False): whether the logic level is inverted |
| 445 |
(active-low) |
| 446 |
- write_multiple_coils (bool, default=False): whether to perform write |
| 447 |
using "write multiple coils" method instead of "write single coil" |
| 448 |
|
| 449 |
Used by: |
| 450 |
- `ModbusCoilDriver`_ |
| 451 |
|
| 452 |
WaveshareModbusTCPCoil |
| 453 |
++++++++++++++++++++++ |
| 454 |
A :any:`WaveshareModbusTCPCoil` describes a Waveshare branded coil accessible via *Modbus TCP*. |
| 455 |
|
| 456 |
.. code-block:: yaml |
| 457 |
|
| 458 |
WaveshareModbusTCPCoil: |
| 459 |
host: '192.168.23.42' |
| 460 |
coil: 1 |
| 461 |
coil_count: 8 |
| 462 |
|
| 463 |
The example describes the coil ``1`` (zero indexed) of ``8`` on the Waveshare Modbus TCP relay |
| 464 |
module ``192.168.23.42``. |
| 465 |
|
| 466 |
Arguments: |
| 467 |
- host (str): hostname of the Modbus TCP server e.g. ``192.168.23.42:502`` |
| 468 |
- coil (int): index of the coil, e.g. ``3`` |
| 469 |
- coil_count (int, default=8): total number of coils on this module |
| 470 |
- invert (bool, default=False): whether the logic level is inverted |
| 471 |
(active-low) |
| 472 |
- write_multiple_coils (bool, default=False): whether to perform write |
| 473 |
using "write multiple coils" method instead of "write single coil" |
| 474 |
|
| 475 |
Used by: |
| 476 |
- `WaveShareModbusCoilDriver`_ |
| 477 |
|
| 478 |
DeditecRelais8 |
| 479 |
++++++++++++++ |
| 480 |
A :any:`DeditecRelais8` describes a *Deditec USB GPO module* with 8 relays. |
| 481 |
|
| 482 |
.. code-block:: yaml |
| 483 |
|
| 484 |
DeditecRelais8: |
| 485 |
index: 1 |
| 486 |
invert: false |
| 487 |
match: |
| 488 |
ID_PATH: 'pci-0000:00:14.0-usb-0:2:1.0' |
| 489 |
|
| 490 |
Arguments: |
| 491 |
- index (int): number of the relay to use |
| 492 |
- invert (bool, default=False): whether the logic level is inverted |
| 493 |
(active-low) |
| 494 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 495 |
|
| 496 |
Used by: |
| 497 |
- `DeditecRelaisDriver`_ |
| 498 |
|
| 499 |
NetworkDeditecRelais8 |
| 500 |
+++++++++++++++++++++ |
| 501 |
A :any:`NetworkDeditecRelais8` describes a `DeditecRelais8`_ resource available |
| 502 |
on a remote computer. |
| 503 |
|
| 504 |
OneWirePIO |
| 505 |
++++++++++ |
| 506 |
A :any:`OneWirePIO` describes a *1-Wire* programmable I/O pin. |
| 507 |
|
| 508 |
.. code-block:: yaml |
| 509 |
|
| 510 |
OneWirePIO: |
| 511 |
host: 'example.computer' |
| 512 |
path: '/29.7D6913000000/PIO.0' |
| 513 |
invert: false |
| 514 |
|
| 515 |
The example describes a ``PIO.0`` at device address ``29.7D6913000000`` via the |
| 516 |
1-Wire server on ``example.computer``. |
| 517 |
|
| 518 |
Arguments: |
| 519 |
- host (str): hostname of the remote system running the 1-Wire server |
| 520 |
- path (str): path on the server to the programmable I/O pin |
| 521 |
- invert (bool, default=False): whether the logic level is inverted |
| 522 |
(active-low) |
| 523 |
|
| 524 |
Used by: |
| 525 |
- `OneWirePIODriver`_ |
| 526 |
|
| 527 |
LXAIOBusPIO |
| 528 |
+++++++++++ |
| 529 |
An :any:`LXAIOBusPIO` resource describes a single PIO pin on an LXAIOBusNode. |
| 530 |
|
| 531 |
.. code-block:: yaml |
| 532 |
|
| 533 |
LXAIOBusPIO: |
| 534 |
host: 'localhost:8080' |
| 535 |
node: 'IOMux-00000003' |
| 536 |
pin: 'OUT0' |
| 537 |
invert: false |
| 538 |
|
| 539 |
The example uses an lxa-iobus-server running on ``localhost:8080``, with node |
| 540 |
``IOMux-00000003`` and pin ``OUT0``. |
| 541 |
|
| 542 |
Arguments: |
| 543 |
- host (str): hostname with port of the lxa-io-bus server |
| 544 |
- node (str): name of the node to use |
| 545 |
- pin (str): name of the pin to use |
| 546 |
- invert (bool, default=False): whether to invert the pin |
| 547 |
|
| 548 |
Used by: |
| 549 |
- `LXAIOBusPIODriver`_ |
| 550 |
|
| 551 |
NetworkLXAIOBusPIO |
| 552 |
++++++++++++++++++ |
| 553 |
A :any:`NetworkLXAIOBusPIO` describes an `LXAIOBusPIO`_ resource available on a |
| 554 |
remote computer. |
| 555 |
|
| 556 |
HIDRelay |
| 557 |
++++++++ |
| 558 |
An :any:`HIDRelay` resource describes a single output of an HID protocol based |
| 559 |
USB relays. |
| 560 |
It currently supports the widely used *dcttech USBRelay* and *lctech LCUS* |
| 561 |
|
| 562 |
.. code-block:: yaml |
| 563 |
|
| 564 |
HIDRelay: |
| 565 |
index: 2 |
| 566 |
invert: false |
| 567 |
match: |
| 568 |
ID_PATH: 'pci-0000:00:14.0-usb-0:2:1.0' |
| 569 |
|
| 570 |
Arguments: |
| 571 |
- index (int, default=1): number of the relay to use |
| 572 |
- invert (bool, default=False): whether to invert the relay |
| 573 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 574 |
|
| 575 |
Used by: |
| 576 |
- `HIDRelayDriver`_ |
| 577 |
|
| 578 |
HttpDigitalOutput |
| 579 |
+++++++++++++++++ |
| 580 |
An :any:`HttpDigitalOutput` resource describes a generic digital output that |
| 581 |
can be controlled via HTTP. |
| 582 |
|
| 583 |
.. code-block:: yaml |
| 584 |
|
| 585 |
HttpDigitalOutput: |
| 586 |
url: 'http://host.example/some/endpoint' |
| 587 |
body_asserted: 'On' |
| 588 |
body_deasserted: 'Off' |
| 589 |
|
| 590 |
The example assumes a simple scenario where the same URL is used for PUT |
| 591 |
requests that set the output state and GET requests to get the current state. |
| 592 |
It also assumes that the returned state matches either "On" or "Off" exactly. |
| 593 |
|
| 594 |
The `HttpDigitalOutputDriver`_ also supports more advanced use cases where the |
| 595 |
current state is fetched from another URL and is interpreted using regular |
| 596 |
expressions. |
| 597 |
|
| 598 |
Arguments: |
| 599 |
- url (str): URL to use for setting a new state |
| 600 |
- body_asserted (str): request body to send to assert the output |
| 601 |
- body_deasserted (str): request body to send to de-assert the output |
| 602 |
- method (str, default="PUT"): HTTP method to set a new state |
| 603 |
|
| 604 |
- url_get (str): optional, URL to use instead of ``url`` for getting the state |
| 605 |
- body_get_asserted (str): optional, regular expression that matches an asserted response body |
| 606 |
- body_get_deasserted (str): optional, regular expression that matches a de-asserted response body |
| 607 |
|
| 608 |
Used by: |
| 609 |
- `HttpDigitalOutputDriver`_ |
| 610 |
|
| 611 |
Eth008DigitalOutput |
| 612 |
++++++++++++++++++++ |
| 613 |
An :any:`Eth008DigitalOutput` resource describes a digital output on a |
| 614 |
*Robot-Electronics eth008* relay board. |
| 615 |
|
| 616 |
.. code-block:: yaml |
| 617 |
|
| 618 |
Eth008DigitalOutput: |
| 619 |
host: '192.168.1.100' |
| 620 |
index: 1 |
| 621 |
invert: false |
| 622 |
|
| 623 |
The example describes relay ``1`` on the ETH008 device at ``192.168.1.100``. |
| 624 |
|
| 625 |
Arguments: |
| 626 |
- host (str): hostname or IP address of the ETH008 device |
| 627 |
- index (int): number of the relay to use (1-8) |
| 628 |
- invert (bool, default=False): whether to invert the output (active-low) |
| 629 |
|
| 630 |
Used by: |
| 631 |
- `Eth008DigitalOutputDriver`_ |
| 632 |
|
| 633 |
NetworkHIDRelay |
| 634 |
+++++++++++++++ |
| 635 |
A :any:`NetworkHIDRelay` describes an `HIDRelay`_ resource available on a |
| 636 |
remote computer. |
| 637 |
|
| 638 |
SysfsGPIO |
| 639 |
+++++++++ |
| 640 |
|
| 641 |
A :any:`SysfsGPIO` resource describes a GPIO line. |
| 642 |
|
| 643 |
.. code-block:: yaml |
| 644 |
|
| 645 |
SysfsGPIO: |
| 646 |
index: 12 |
| 647 |
|
| 648 |
Arguments: |
| 649 |
- index (int): index of the GPIO line |
| 650 |
|
| 651 |
Used by: |
| 652 |
- `GpioDigitalOutputDriver`_ |
| 653 |
|
| 654 |
NetworkSysfsGPIO |
| 655 |
++++++++++++++++ |
| 656 |
A :any:`NetworkSysfsGPIO` describes a `SysfsGPIO`_ resource available on a |
| 657 |
remote computer. |
| 658 |
|
| 659 |
MatchedSysfsGPIO |
| 660 |
++++++++++++++++ |
| 661 |
A :any:`MatchedSysfsGPIO` describes a GPIO line, like a `SysfsGPIO`_. |
| 662 |
The gpiochip is identified by matching udev properties. This allows |
| 663 |
identification through hot-plugging or rebooting for controllers like |
| 664 |
USB based gpiochips. |
| 665 |
|
| 666 |
.. code-block:: yaml |
| 667 |
|
| 668 |
MatchedSysfsGPIO: |
| 669 |
match: |
| 670 |
'@SUBSYSTEM': 'usb' |
| 671 |
'@ID_SERIAL_SHORT': 'D38EJ8LF' |
| 672 |
pin: 0 |
| 673 |
|
| 674 |
The example would search for a USB gpiochip with the key ``ID_SERIAL_SHORT`` |
| 675 |
and the value ``D38EJ8LF`` and use the pin 0 of this device. |
| 676 |
The ``ID_SERIAL_SHORT`` property is set by the usb_id builtin helper program. |
| 677 |
|
| 678 |
Arguments: |
| 679 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 680 |
- pin (int): gpio pin number within the matched gpiochip. |
| 681 |
|
| 682 |
Used by: |
| 683 |
- `GpioDigitalOutputDriver`_ |
| 684 |
|
| 685 |
NetworkService |
| 686 |
~~~~~~~~~~~~~~ |
| 687 |
A :any:`NetworkService` describes a remote SSH connection. |
| 688 |
|
| 689 |
.. code-block:: yaml |
| 690 |
|
| 691 |
NetworkService: |
| 692 |
address: 'example.computer' |
| 693 |
username: 'root' |
| 694 |
|
| 695 |
The example describes a remote SSH connection to the computer |
| 696 |
``example.computer`` with the username ``root``. |
| 697 |
Set the optional password password property to make SSH login with a password |
| 698 |
instead of the key file. |
| 699 |
|
| 700 |
When used with ``labgrid-exporter``, the address can contain a device scope |
| 701 |
suffix (such as ``%eth1``), which is especially useful with overlapping address |
| 702 |
ranges or link-local IPv6 addresses. |
| 703 |
In that case, the SSH connection will be proxied via the exporter, using |
| 704 |
``socat`` and the ``labgrid-bound-connect`` sudo helper. |
| 705 |
These and the sudo configuration needs to be prepared by the administrator. |
| 706 |
|
| 707 |
Arguments: |
| 708 |
- address (str): hostname of the remote system |
| 709 |
- username (str): username used by SSH |
| 710 |
- password (str, default=None): optional, password used by SSH |
| 711 |
- port (int, default=22): port used by SSH |
| 712 |
|
| 713 |
Used by: |
| 714 |
- `SSHDriver`_ |
| 715 |
|
| 716 |
USBMassStorage |
| 717 |
~~~~~~~~~~~~~~ |
| 718 |
A :any:`USBMassStorage` resource describes a USB memory stick or similar |
| 719 |
device. |
| 720 |
|
| 721 |
.. code-block:: yaml |
| 722 |
|
| 723 |
USBMassStorage: |
| 724 |
match: |
| 725 |
ID_PATH: 'pci-0000:06:00.0-usb-0:1.3.2:1.0-scsi-0:0:0:3' |
| 726 |
|
| 727 |
Writing images to disk requires installation of ``dd`` or optionally |
| 728 |
``bmaptool`` on the same system as the block device. |
| 729 |
|
| 730 |
For mounting the file system and writing into it, |
| 731 |
`PyGObject <https://pygobject.readthedocs.io/>`_ must be installed. |
| 732 |
For Debian, the necessary packages are ``python3-gi`` and ``gir1.2-udisks-2.0``. |
| 733 |
This is not required for writing images to disks. |
| 734 |
|
| 735 |
Arguments: |
| 736 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 737 |
|
| 738 |
Used by: |
| 739 |
- `USBStorageDriver`_ |
| 740 |
|
| 741 |
NetworkUSBMassStorage |
| 742 |
~~~~~~~~~~~~~~~~~~~~~ |
| 743 |
A :any:`NetworkUSBMassStorage` resource describes `USBMassStorage`_ resource |
| 744 |
available on a remote computer. |
| 745 |
|
| 746 |
SigrokDevice |
| 747 |
~~~~~~~~~~~~ |
| 748 |
A :any:`SigrokDevice` resource describes a *Sigrok* device. To select a |
| 749 |
specific device from all connected supported devices use the |
| 750 |
`SigrokUSBDevice`_. |
| 751 |
|
| 752 |
.. code-block:: yaml |
| 753 |
|
| 754 |
SigrokDevice: |
| 755 |
driver: 'fx2lafw' |
| 756 |
channels: 'D0=CLK,D1=DATA' |
| 757 |
|
| 758 |
Arguments: |
| 759 |
- driver (str): name of the sigrok driver to use |
| 760 |
- channels (str): optional, channel mapping as described in the |
| 761 |
``sigrok-cli`` man page |
| 762 |
- channel_group (str): optional, channel group as described in the |
| 763 |
``sigrok-cli`` man page |
| 764 |
|
| 765 |
Used by: |
| 766 |
- `SigrokDriver`_ |
| 767 |
|
| 768 |
IMXUSBLoader |
| 769 |
~~~~~~~~~~~~ |
| 770 |
An :any:`IMXUSBLoader` resource describes a USB device in the imx loader state. |
| 771 |
|
| 772 |
.. code-block:: yaml |
| 773 |
|
| 774 |
IMXUSBLoader: |
| 775 |
match: |
| 776 |
ID_PATH: 'pci-0000:06:00.0-usb-0:1.3.2:1.0' |
| 777 |
|
| 778 |
Arguments: |
| 779 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 780 |
|
| 781 |
Used by: |
| 782 |
- `IMXUSBDriver`_ |
| 783 |
- `UUUDriver`_ |
| 784 |
- `BDIMXUSBDriver`_ |
| 785 |
|
| 786 |
MXSUSBLoader |
| 787 |
~~~~~~~~~~~~ |
| 788 |
An :any:`MXSUSBLoader` resource describes a USB device in the *MXS loader |
| 789 |
state*. |
| 790 |
|
| 791 |
.. code-block:: yaml |
| 792 |
|
| 793 |
MXSUSBLoader: |
| 794 |
match: |
| 795 |
ID_PATH: 'pci-0000:06:00.0-usb-0:1.3.2:1.0' |
| 796 |
|
| 797 |
Arguments: |
| 798 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 799 |
|
| 800 |
Used by: |
| 801 |
- `MXSUSBDriver`_ |
| 802 |
- `IMXUSBDriver`_ |
| 803 |
- `UUUDriver`_ |
| 804 |
|
| 805 |
RKUSBLoader |
| 806 |
~~~~~~~~~~~ |
| 807 |
An :any:`RKUSBLoader` resource describes a USB device in the *Rockchip loader |
| 808 |
state*. |
| 809 |
|
| 810 |
.. code-block:: yaml |
| 811 |
|
| 812 |
RKUSBLoader: |
| 813 |
match: |
| 814 |
ID_PATH: 'pci-0000:06:00.0-usb-0:1.3.2:1.0' |
| 815 |
|
| 816 |
Arguments: |
| 817 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 818 |
|
| 819 |
Used by: |
| 820 |
- `RKUSBDriver`_ |
| 821 |
|
| 822 |
NetworkMXSUSBLoader |
| 823 |
~~~~~~~~~~~~~~~~~~~ |
| 824 |
A :any:`NetworkMXSUSBLoader` describes an `MXSUSBLoader`_ resource available on |
| 825 |
a remote computer. |
| 826 |
|
| 827 |
NetworkIMXUSBLoader |
| 828 |
~~~~~~~~~~~~~~~~~~~ |
| 829 |
A :any:`NetworkIMXUSBLoader` describes an `IMXUSBLoader`_ resource available on |
| 830 |
a remote computer. |
| 831 |
|
| 832 |
NetworkRKUSBLoader |
| 833 |
~~~~~~~~~~~~~~~~~~ |
| 834 |
A :any:`NetworkRKUSBLoader` describes an `RKUSBLoader`_ resource available on a |
| 835 |
remote computer. |
| 836 |
|
| 837 |
AndroidUSBFastboot |
| 838 |
~~~~~~~~~~~~~~~~~~ |
| 839 |
An :any:`AndroidUSBFastboot` resource describes a USB device in the *Fastboot |
| 840 |
state*. |
| 841 |
Previously, this resource was named AndroidFastboot and this name still |
| 842 |
supported for backwards compatibility. |
| 843 |
|
| 844 |
.. code-block:: yaml |
| 845 |
|
| 846 |
AndroidUSBFastboot: |
| 847 |
match: |
| 848 |
ID_PATH: 'pci-0000:06:00.0-usb-0:1.3.2:1.0' |
| 849 |
|
| 850 |
Arguments: |
| 851 |
- usb_vendor_id (str, default="1d6b"): USB vendor ID to be compared with the |
| 852 |
``ID_VENDOR_ID`` udev property |
| 853 |
- usb_product_id (str, default="0104"): USB product ID, to be compared with |
| 854 |
the ``ID_MODEL_ID`` udev property |
| 855 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 856 |
|
| 857 |
Used by: |
| 858 |
- `AndroidFastbootDriver`_ |
| 859 |
|
| 860 |
RemoteAndroidUSBFastboot |
| 861 |
~~~~~~~~~~~~~~~~~~~~~~~~ |
| 862 |
A :any:`RemoteAndroidUSBFastboot` describes a `AndroidUSBFastboot`_ resource |
| 863 |
available on a remote computer. |
| 864 |
|
| 865 |
AndroidNetFastboot |
| 866 |
~~~~~~~~~~~~~~~~~~ |
| 867 |
An :any:`AndroidNetFastboot` resource describes a network device in *Fastboot |
| 868 |
state*. |
| 869 |
|
| 870 |
.. code-block:: yaml |
| 871 |
|
| 872 |
AndroidNetFastboot: |
| 873 |
address: '192.168.23.42' |
| 874 |
|
| 875 |
Arguments: |
| 876 |
- address (str): ip address of the fastboot device |
| 877 |
- port (int, default=5554): udp/tcp fastboot port that is used in the |
| 878 |
device. (e.g. Barebox uses port 5554) |
| 879 |
- protocol (str, default="udp"): which protocol should be used when issuing |
| 880 |
fastboot commands. (Barebox supports currently only the udp protocol) |
| 881 |
|
| 882 |
Used by: |
| 883 |
- `AndroidFastbootDriver`_ |
| 884 |
|
| 885 |
RemoteAndroidNetFastboot |
| 886 |
~~~~~~~~~~~~~~~~~~~~~~~~ |
| 887 |
A :any:`RemoteAndroidNetFastboot` describes an `AndroidNetFastboot`_ resource |
| 888 |
available on a remote computer. |
| 889 |
|
| 890 |
DFUDevice |
| 891 |
~~~~~~~~~ |
| 892 |
A :any:`DFUDevice` resource describes a USB device in DFU (Device Firmware |
| 893 |
Upgrade) mode. |
| 894 |
|
| 895 |
.. code-block:: yaml |
| 896 |
|
| 897 |
DFUDevice: |
| 898 |
match: |
| 899 |
ID_PATH: 'pci-0000:06:00.0-usb-0:1.3.2:1.0' |
| 900 |
|
| 901 |
Arguments: |
| 902 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 903 |
|
| 904 |
Used by: |
| 905 |
- `DFUDriver`_ |
| 906 |
|
| 907 |
NetworkDFUDevice |
| 908 |
~~~~~~~~~~~~~~~~ |
| 909 |
A :any:`NetworkDFUDevice` describes a `DFUDevice`_ resource available on a |
| 910 |
remote computer. |
| 911 |
|
| 912 |
NetworkInterface |
| 913 |
~~~~~~~~~~~~~~~~ |
| 914 |
A :any:`NetworkInterface` resource describes a network adapter (such as |
| 915 |
Ethernet or WiFi) |
| 916 |
|
| 917 |
.. code-block:: yaml |
| 918 |
|
| 919 |
NetworkInterface: |
| 920 |
ifname: 'eth0' |
| 921 |
|
| 922 |
Arguments: |
| 923 |
- ifname (str): name of the interface |
| 924 |
|
| 925 |
Used by: |
| 926 |
- `NetworkInterfaceDriver`_ |
| 927 |
- `RawNetworkInterfaceDriver`_ |
| 928 |
|
| 929 |
USBNetworkInterface |
| 930 |
~~~~~~~~~~~~~~~~~~~ |
| 931 |
A :any:`USBNetworkInterface` resource describes a USB network adapter (such as |
| 932 |
Ethernet or WiFi) |
| 933 |
|
| 934 |
.. code-block:: yaml |
| 935 |
|
| 936 |
USBNetworkInterface: |
| 937 |
match: |
| 938 |
ID_PATH: 'pci-0000:06:00.0-usb-0:1.3.2:1.0' |
| 939 |
|
| 940 |
Arguments: |
| 941 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 942 |
|
| 943 |
Used by: |
| 944 |
- `NetworkInterfaceDriver`_ |
| 945 |
- `RawNetworkInterfaceDriver`_ |
| 946 |
|
| 947 |
RemoteNetworkInterface |
| 948 |
~~~~~~~~~~~~~~~~~~~~~~ |
| 949 |
A :any:`RemoteNetworkInterface` resource describes a `NetworkInterface`_ or |
| 950 |
`USBNetworkInterface`_ resource available on a remote computer. |
| 951 |
|
| 952 |
AlteraUSBBlaster |
| 953 |
~~~~~~~~~~~~~~~~ |
| 954 |
An :any:`AlteraUSBBlaster` resource describes an Altera USB blaster. |
| 955 |
|
| 956 |
.. code-block:: yaml |
| 957 |
|
| 958 |
AlteraUSBBlaster: |
| 959 |
match: |
| 960 |
ID_PATH: 'pci-0000:06:00.0-usb-0:1.3.2:1.0' |
| 961 |
|
| 962 |
Arguments: |
| 963 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 964 |
|
| 965 |
Used by: |
| 966 |
- `OpenOCDDriver`_ |
| 967 |
- `QuartusHPSDriver`_ |
| 968 |
|
| 969 |
NetworkAlteraUSBBlaster |
| 970 |
~~~~~~~~~~~~~~~~~~~~~~~ |
| 971 |
A :any:`NetworkAlteraUSBBlaster` describes an `AlteraUSBBlaster`_ resource |
| 972 |
available on a remote computer. |
| 973 |
|
| 974 |
USBDebugger |
| 975 |
~~~~~~~~~~~ |
| 976 |
A :any:`USBDebugger` resource describes a JTAG USB adapter (for example an |
| 977 |
*FTDI FT2232H*). |
| 978 |
|
| 979 |
.. code-block:: yaml |
| 980 |
|
| 981 |
USBDebugger: |
| 982 |
match: |
| 983 |
ID_PATH: 'pci-0000:00:10.0-usb-0:1.4' |
| 984 |
|
| 985 |
Arguments: |
| 986 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 987 |
|
| 988 |
Used by: |
| 989 |
- `OpenOCDDriver`_ |
| 990 |
|
| 991 |
NetworkUSBDebugger |
| 992 |
~~~~~~~~~~~~~~~~~~ |
| 993 |
A :any:`NetworkUSBDebugger` describes a `USBDebugger`_ resource available on a |
| 994 |
remote computer. |
| 995 |
|
| 996 |
SNMPEthernetPort |
| 997 |
~~~~~~~~~~~~~~~~ |
| 998 |
A :any:`SNMPEthernetPort` resource describes a port on an Ethernet switch, |
| 999 |
which is accessible via SNMP. |
| 1000 |
|
| 1001 |
.. code-block:: yaml |
| 1002 |
|
| 1003 |
SNMPEthernetPort: |
| 1004 |
switch: 'switch-012' |
| 1005 |
interface: '17' |
| 1006 |
|
| 1007 |
Arguments: |
| 1008 |
- switch (str): host name of the Ethernet switch |
| 1009 |
- interface (str): interface name |
| 1010 |
|
| 1011 |
Used by: |
| 1012 |
- None |
| 1013 |
|
| 1014 |
SigrokUSBDevice |
| 1015 |
~~~~~~~~~~~~~~~ |
| 1016 |
A :any:`SigrokUSBDevice` resource describes a *Sigrok* USB device. |
| 1017 |
|
| 1018 |
.. code-block:: yaml |
| 1019 |
|
| 1020 |
SigrokUSBDevice: |
| 1021 |
driver: 'fx2lafw' |
| 1022 |
channels: 'D0=CLK,D1=DATA' |
| 1023 |
match: |
| 1024 |
ID_PATH: 'pci-0000:06:00.0-usb-0:1.3.2:1.0' |
| 1025 |
|
| 1026 |
Arguments: |
| 1027 |
- driver (str): name of the sigrok driver to use |
| 1028 |
- channels (str): optional, channel mapping as described in the |
| 1029 |
``sigrok-cli`` man page |
| 1030 |
- channel_group (str): optional, channel group as described in the |
| 1031 |
``sigrok-cli`` man page |
| 1032 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 1033 |
|
| 1034 |
Used by: |
| 1035 |
- `SigrokDriver`_ |
| 1036 |
|
| 1037 |
NetworkSigrokUSBDevice |
| 1038 |
~~~~~~~~~~~~~~~~~~~~~~ |
| 1039 |
A :any:`NetworkSigrokUSBDevice` describes a `SigrokUSBDevice`_ resource |
| 1040 |
available on a remote computer. |
| 1041 |
|
| 1042 |
SigrokUSBSerialDevice |
| 1043 |
~~~~~~~~~~~~~~~~~~~~~ |
| 1044 |
A :any:`SigrokUSBSerialDevice` resource describes a *Sigrok* device which |
| 1045 |
communicates over a USB serial port instead of being a USB device itself (see |
| 1046 |
`SigrokUSBDevice`_ for that case). |
| 1047 |
|
| 1048 |
.. code-block:: yaml |
| 1049 |
|
| 1050 |
SigrokUSBSerialDevice: |
| 1051 |
driver: 'manson-hcs-3xxx' |
| 1052 |
match: |
| 1053 |
'@ID_SERIAL_SHORT': 'P-00-02389' |
| 1054 |
|
| 1055 |
Arguments: |
| 1056 |
- driver (str): name of the sigrok driver to use |
| 1057 |
- channels (str): optional, channel mapping as described in the |
| 1058 |
``sigrok-cli`` man page |
| 1059 |
- channel_group (str): optional, channel group as described in the |
| 1060 |
``sigrok-cli`` man page |
| 1061 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 1062 |
|
| 1063 |
Used by: |
| 1064 |
- `SigrokPowerDriver`_ |
| 1065 |
- `SigrokDmmDriver`_ |
| 1066 |
|
| 1067 |
NetworkSigrokUSBSerialDevice |
| 1068 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1069 |
A :any:`NetworkSigrokUSBSerialDevice` describes a `SigrokUSBSerialDevice`_ |
| 1070 |
resource available on a remote computer. |
| 1071 |
|
| 1072 |
USBSDMuxDevice |
| 1073 |
~~~~~~~~~~~~~~ |
| 1074 |
A :any:`USBSDMuxDevice` resource describes a Pengutronix |
| 1075 |
`USB-SD-Mux <https://www.pengutronix.de/de/2017-10-23-usb-sd-mux-automated-sd-card-juggler.html>`_ |
| 1076 |
device. |
| 1077 |
|
| 1078 |
.. code-block:: yaml |
| 1079 |
|
| 1080 |
USBSDMuxDevice: |
| 1081 |
match: |
| 1082 |
'@ID_PATH': 'pci-0000:00:14.0-usb-0:1.2' |
| 1083 |
|
| 1084 |
Arguments: |
| 1085 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 1086 |
|
| 1087 |
Used by: |
| 1088 |
- `USBSDMuxDriver`_ |
| 1089 |
- `USBStorageDriver`_ |
| 1090 |
|
| 1091 |
NetworkUSBSDMuxDevice |
| 1092 |
~~~~~~~~~~~~~~~~~~~~~ |
| 1093 |
A :any:`NetworkUSBSDMuxDevice` resource describes a `USBSDMuxDevice`_ resource |
| 1094 |
available on a remote computer. |
| 1095 |
|
| 1096 |
LXAUSBMux |
| 1097 |
~~~~~~~~~ |
| 1098 |
An :any:`LXAUSBMux` resource describes a *Linux Automation GmbH USB-Mux* device. |
| 1099 |
|
| 1100 |
.. code-block:: yaml |
| 1101 |
|
| 1102 |
LXAUSBMux: |
| 1103 |
match: |
| 1104 |
'@ID_PATH': 'pci-0000:00:14.0-usb-0:1.2' |
| 1105 |
|
| 1106 |
Arguments: |
| 1107 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 1108 |
|
| 1109 |
Used by: |
| 1110 |
- `LXAUSBMuxDriver`_ |
| 1111 |
|
| 1112 |
NetworkLXAUSBMux |
| 1113 |
~~~~~~~~~~~~~~~~ |
| 1114 |
A :any:`NetworkLXAUSBMux` resource describes an `LXAUSBMux`_ resource available |
| 1115 |
on a remote computer. |
| 1116 |
|
| 1117 |
USBSDWireDevice |
| 1118 |
~~~~~~~~~~~~~~~ |
| 1119 |
A :any:`USBSDWireDevice` resource describes a Tizen |
| 1120 |
`SD Wire device <https://web.archive.org/web/20240121081917/https://wiki.tizen.org/SDWire>`_. |
| 1121 |
|
| 1122 |
.. code-block:: yaml |
| 1123 |
|
| 1124 |
USBSDWireDevice: |
| 1125 |
match: |
| 1126 |
'@ID_PATH': 'pci-0000:00:14.0-usb-0:1.2' |
| 1127 |
|
| 1128 |
Arguments: |
| 1129 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 1130 |
|
| 1131 |
Used by: |
| 1132 |
- `USBSDWireDriver`_ |
| 1133 |
- `USBStorageDriver`_ |
| 1134 |
|
| 1135 |
NetworkUSBSDWireDevice |
| 1136 |
~~~~~~~~~~~~~~~~~~~~~~ |
| 1137 |
A :any:`NetworkUSBSDWireDevice` resource describes a `USBSDWireDevice`_ |
| 1138 |
resource available on a remote computer. |
| 1139 |
|
| 1140 |
USBSDWire3Device |
| 1141 |
~~~~~~~~~~~~~~~~ |
| 1142 |
A :any:`USBSDWire3Device` resource describes a Tizen |
| 1143 |
`SD Wire3 device <https://badgerd.nl/sdwire3/>`_. |
| 1144 |
|
| 1145 |
.. code-block:: yaml |
| 1146 |
|
| 1147 |
USBSDWire3Device: |
| 1148 |
match: |
| 1149 |
'@ID_PATH': 'pci-0000:00:14.0-usb-0:1.2' |
| 1150 |
|
| 1151 |
Arguments: |
| 1152 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 1153 |
|
| 1154 |
Used by: |
| 1155 |
- `USBSDWire3Driver`_ |
| 1156 |
- `USBStorageDriver`_ |
| 1157 |
|
| 1158 |
NetworkUSBSDWire3Device |
| 1159 |
~~~~~~~~~~~~~~~~~~~~~~~ |
| 1160 |
A :any:`NetworkUSBSDWire3Device` resource describes a `USBSDWire3Device`_ |
| 1161 |
resource available on a remote computer. |
| 1162 |
|
| 1163 |
USBVideo |
| 1164 |
~~~~~~~~ |
| 1165 |
A :any:`USBVideo` resource describes a USB video camera which is supported by a |
| 1166 |
Video4Linux2 (v4l2) kernel driver. |
| 1167 |
|
| 1168 |
.. code-block:: yaml |
| 1169 |
|
| 1170 |
USBVideo: |
| 1171 |
match: |
| 1172 |
'@ID_PATH': 'pci-0000:00:14.0-usb-0:1.2' |
| 1173 |
|
| 1174 |
Arguments: |
| 1175 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 1176 |
|
| 1177 |
Used by: |
| 1178 |
- `USBVideoDriver`_ |
| 1179 |
|
| 1180 |
NetworkUSBVideo |
| 1181 |
~~~~~~~~~~~~~~~ |
| 1182 |
A :any:`NetworkUSBVideo` resource describes a `USBVideo`_ resource available |
| 1183 |
on a remote computer. |
| 1184 |
|
| 1185 |
USBAudioInput |
| 1186 |
~~~~~~~~~~~~~ |
| 1187 |
A :any:`USBAudioInput` resource describes a USB audio input which is supported |
| 1188 |
by an ALSA kernel driver. |
| 1189 |
|
| 1190 |
.. code-block:: yaml |
| 1191 |
|
| 1192 |
USBAudioInput: |
| 1193 |
match: |
| 1194 |
ID_PATH: 'pci-0000:00:14.0-usb-0:3:1.0' |
| 1195 |
|
| 1196 |
Arguments: |
| 1197 |
- index (int, default=0): ALSA PCM device number (as in |
| 1198 |
``hw:CARD=<card>,DEV=<index>``) |
| 1199 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 1200 |
|
| 1201 |
Used by: |
| 1202 |
- `USBAudioInputDriver`_ |
| 1203 |
|
| 1204 |
NetworkUSBAudioInput |
| 1205 |
~~~~~~~~~~~~~~~~~~~~ |
| 1206 |
A :any:`NetworkUSBAudioInput` resource describes a `USBAudioInput`_ resource |
| 1207 |
available on a remote computer. |
| 1208 |
|
| 1209 |
USBTMC |
| 1210 |
~~~~~~ |
| 1211 |
A :any:`USBTMC` resource describes an oscilloscope connected via the *USB TMC |
| 1212 |
protocol*. |
| 1213 |
The low-level communication is handled by the "usbtmc" kernel driver. |
| 1214 |
|
| 1215 |
.. code-block:: yaml |
| 1216 |
|
| 1217 |
USBTMC: |
| 1218 |
match: |
| 1219 |
'@ID_PATH': 'pci-0000:00:14.0-usb-0:1.2' |
| 1220 |
|
| 1221 |
Arguments: |
| 1222 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 1223 |
|
| 1224 |
A udev rules file may be needed to allow access for non-root users: |
| 1225 |
|
| 1226 |
.. code-block:: none |
| 1227 |
|
| 1228 |
DRIVERS=="usbtmc", MODE="0660", GROUP="plugdev" |
| 1229 |
|
| 1230 |
Used by: |
| 1231 |
- `USBTMCDriver`_ |
| 1232 |
|
| 1233 |
NetworkUSBTMC |
| 1234 |
~~~~~~~~~~~~~ |
| 1235 |
A :any:`NetworkUSBTMC` resource describes a `USBTMC`_ resource available |
| 1236 |
on a remote computer. |
| 1237 |
|
| 1238 |
Flashrom |
| 1239 |
~~~~~~~~ |
| 1240 |
A :any:`Flashrom` resource is used to configure the parameters to a local |
| 1241 |
installed flashrom instance. |
| 1242 |
It is assumed that flashrom is installed on the host and the executable is |
| 1243 |
configured in: |
| 1244 |
|
| 1245 |
.. code-block:: yaml |
| 1246 |
|
| 1247 |
tools: |
| 1248 |
flashrom: '/usr/sbin/flashrom' |
| 1249 |
|
| 1250 |
Arguments: |
| 1251 |
- programmer (str): programmer device as described in ``-p, --programmer`` in |
| 1252 |
``man 8 flashrom`` |
| 1253 |
|
| 1254 |
The resource must configure which programmer to use and the parameters to the |
| 1255 |
programmer. |
| 1256 |
The programmer parameter is passed directly to the flashrom bin hence |
| 1257 |
``man 8 flashrom`` can be used for reference. |
| 1258 |
Below an example where the local spidev is used. |
| 1259 |
|
| 1260 |
.. code-block:: yaml |
| 1261 |
|
| 1262 |
Flashrom: |
| 1263 |
programmer: 'linux_spi:dev=/dev/spidev0.1,spispeed=30000' |
| 1264 |
|
| 1265 |
Used by: |
| 1266 |
- `FlashromDriver`_ |
| 1267 |
|
| 1268 |
NetworkFlashrom |
| 1269 |
~~~~~~~~~~~~~~~ |
| 1270 |
A :any:`NetworkFlashrom` describes a `Flashrom`_ resource available on a remote |
| 1271 |
computer. |
| 1272 |
|
| 1273 |
USBFlashableDevice |
| 1274 |
~~~~~~~~~~~~~~~~~~ |
| 1275 |
A :any:`USBFlashableDevice` represents an "opaque" USB device used by custom |
| 1276 |
flashing programs. |
| 1277 |
There is usually not anything useful that can be done with the interface other |
| 1278 |
than running a flashing program with `FlashScriptDriver`_. |
| 1279 |
|
| 1280 |
.. note:: |
| 1281 |
This resource is only intended to be used as a last resort when it is |
| 1282 |
impossible or impractical to use a different resource |
| 1283 |
|
| 1284 |
.. code-block:: yaml |
| 1285 |
|
| 1286 |
USBFlashableDevice: |
| 1287 |
match: |
| 1288 |
SUBSYSTEM: 'usb' |
| 1289 |
ID_SERIAL: '1234' |
| 1290 |
|
| 1291 |
Arguments: |
| 1292 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 1293 |
|
| 1294 |
Used by: |
| 1295 |
- `FlashScriptDriver`_ |
| 1296 |
|
| 1297 |
NetworkUSBFlashableDevice |
| 1298 |
~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1299 |
A :any:`NetworkUSBFlashableDevice` resource describes a `USBFlashableDevice`_ |
| 1300 |
resource available on a remote computer. |
| 1301 |
|
| 1302 |
DediprogFlasher |
| 1303 |
~~~~~~~~~~~~~~~ |
| 1304 |
A :any:`DediprogFlasher` resource is used to configure the parameters to a |
| 1305 |
locally installed dpmcd instance. |
| 1306 |
It is assumed that dpcmd is installed on the host and the executable can be |
| 1307 |
configured via: |
| 1308 |
|
| 1309 |
.. code-block:: yaml |
| 1310 |
|
| 1311 |
tools: |
| 1312 |
dpcmd: '/usr/sbin/dpcmd' |
| 1313 |
|
| 1314 |
Arguments: |
| 1315 |
- vcc (str): ``3.5V``, ``2.5V`` or ``1.8V``. |
| 1316 |
|
| 1317 |
For instance, to flash using 3.5 V VCC: |
| 1318 |
|
| 1319 |
.. code-block:: yaml |
| 1320 |
|
| 1321 |
DediprogFlasher: |
| 1322 |
vcc: '3.5V' |
| 1323 |
|
| 1324 |
Used by: |
| 1325 |
- `DediprogFlashDriver`_ |
| 1326 |
|
| 1327 |
NetworkDediprogFlasher |
| 1328 |
~~~~~~~~~~~~~~~~~~~~~~ |
| 1329 |
A :any:`NetworkDediprogFlasher` describes a `DediprogFlasher`_ resource |
| 1330 |
available on a remote computer. |
| 1331 |
|
| 1332 |
XenaManager |
| 1333 |
~~~~~~~~~~~ |
| 1334 |
A :any:`XenaManager` resource describes a *Xena Manager* instance which is the |
| 1335 |
instance the `XenaDriver`_ must connect to in order to configure a Xena |
| 1336 |
chassis. |
| 1337 |
|
| 1338 |
.. code-block:: yaml |
| 1339 |
|
| 1340 |
XenaManager: |
| 1341 |
hostname: 'example.computer' |
| 1342 |
|
| 1343 |
Arguments: |
| 1344 |
- hostname (str): hostname or IP of the management address of the Xena tester |
| 1345 |
|
| 1346 |
Used by: |
| 1347 |
- `XenaDriver`_ |
| 1348 |
|
| 1349 |
PyVISADevice |
| 1350 |
~~~~~~~~~~~~ |
| 1351 |
A :any:`PyVISADevice` resource describes a test stimuli device controlled by |
| 1352 |
PyVISA. |
| 1353 |
Such device could be a signal generator. |
| 1354 |
|
| 1355 |
.. code-block:: yaml |
| 1356 |
|
| 1357 |
PyVISADevice: |
| 1358 |
type: 'TCPIP' |
| 1359 |
url: '192.168.110.11' |
| 1360 |
|
| 1361 |
Arguments: |
| 1362 |
- type (str): device resource type following the PyVISA resource syntax, e.g. |
| 1363 |
ASRL, TCPIP... |
| 1364 |
- url (str): device identifier on selected resource, e.g. <ip> for TCPIP |
| 1365 |
resource |
| 1366 |
- backend (str): optional, Visa library backend, e.g. '@sim' for pyvisa-sim backend |
| 1367 |
|
| 1368 |
Used by: |
| 1369 |
- `PyVISADriver`_ |
| 1370 |
|
| 1371 |
HTTPVideoStream |
| 1372 |
~~~~~~~~~~~~~~~ |
| 1373 |
An :any:`HTTPVideoStream` resource describes an IP video stream over HTTP or HTTPS. |
| 1374 |
|
| 1375 |
.. code-block:: yaml |
| 1376 |
|
| 1377 |
HTTPVideoStream: |
| 1378 |
url: 'http://192.168.110.11/0.ts' |
| 1379 |
|
| 1380 |
Arguments: |
| 1381 |
- url (str): URI of the IP video stream |
| 1382 |
|
| 1383 |
Used by: |
| 1384 |
- `HTTPVideoDriver`_ |
| 1385 |
|
| 1386 |
USBHub |
| 1387 |
~~~~~~ |
| 1388 |
|
| 1389 |
A :any:`USBHub` resource describes an USB hub. |
| 1390 |
There is no corresponding driver, as this resource is only useful to monitor |
| 1391 |
whether the expected USB hubs are detected by an exporter. |
| 1392 |
To control individual ports, use `USBPowerPort`_. |
| 1393 |
|
| 1394 |
.. code-block:: yaml |
| 1395 |
|
| 1396 |
USBHub: |
| 1397 |
match: |
| 1398 |
ID_PATH: 'pci-0000:02:00.0-usb-0:4:1.0' |
| 1399 |
|
| 1400 |
|
| 1401 |
Arguments: |
| 1402 |
- match (dict): key and value pairs for a udev match, see `udev Matching`_ |
| 1403 |
|
| 1404 |
Used by: |
| 1405 |
- none |
| 1406 |
|
| 1407 |
Providers |
| 1408 |
~~~~~~~~~ |
| 1409 |
Providers describe directories that are accessible by the target over a |
| 1410 |
specific protocol. |
| 1411 |
This is useful for software installation in the bootloader (via TFTP) or |
| 1412 |
downloading update artifacts under Linux (via HTTP). |
| 1413 |
|
| 1414 |
They are used with the :any:`ManagedFile` helper, which ensures that the file |
| 1415 |
is available on the server. For HTTP and TFTP, a symlink from the internal |
| 1416 |
directory to the uploaded file is created. |
| 1417 |
The path for the target is generated by replacing the internal prefix with the |
| 1418 |
external prefix. |
| 1419 |
For NFS, it is assumed that ``/var/cache/labgrid`` is exported. |
| 1420 |
The information required for mounting and accessing staged files are returned, |
| 1421 |
see below. |
| 1422 |
|
| 1423 |
For now, the TFTP/NFS/HTTP server needs to be configured before using it from |
| 1424 |
labgrid. |
| 1425 |
|
| 1426 |
Because labgrid uses absolute paths as targets for symlinks for exposing files |
| 1427 |
on the TFTP server and because the target of those symlinks is in |
| 1428 |
``/var/cache/labgrid/``, the TFTP server needs to follow symlinks whose target |
| 1429 |
path is both absolute and in ``/var/cache/labgrid``. Note that depending on the |
| 1430 |
configuration of the TFTP server, ``/var/cache/labgrid`` may not be the root |
| 1431 |
directory of your TFTP server. |
| 1432 |
|
| 1433 |
`atftpd <https://sourceforge.net/projects/atftp/>`_ is known to work whereas |
| 1434 |
`tftpd-hpa <https://git.kernel.org/pub/scm/network/tftp/tftp-hpa.git/>`_ doesn't |
| 1435 |
seem to be working well with such symlinks. |
| 1436 |
|
| 1437 |
TFTPProvider |
| 1438 |
++++++++++++ |
| 1439 |
A :any:`TFTPProvider` resource describes a TFTP server. |
| 1440 |
|
| 1441 |
.. code-block:: yaml |
| 1442 |
|
| 1443 |
TFTPProvider: |
| 1444 |
internal: '/srv/tftp/board-23/' |
| 1445 |
external: 'board-23/' |
| 1446 |
|
| 1447 |
Arguments: |
| 1448 |
- internal (str): path prefix to the local directory accessible by the target |
| 1449 |
- external (str): corresponding path prefix for use by the target |
| 1450 |
|
| 1451 |
Used by: |
| 1452 |
- `TFTPProviderDriver`_ |
| 1453 |
|
| 1454 |
HTTPProvider |
| 1455 |
++++++++++++ |
| 1456 |
An :any:`HTTPProvider` resource describes an HTTP server. |
| 1457 |
|
| 1458 |
.. code-block:: yaml |
| 1459 |
|
| 1460 |
HTTPProvider: |
| 1461 |
internal: '/srv/www/board-23/' |
| 1462 |
external: 'http://192.168.1.1/board-23/' |
| 1463 |
|
| 1464 |
Arguments: |
| 1465 |
- internal (str): path prefix to the local directory accessible by the target |
| 1466 |
- external (str): corresponding path prefix for use by the target |
| 1467 |
|
| 1468 |
Used by: |
| 1469 |
- `HTTPProviderDriver`_ |
| 1470 |
|
| 1471 |
NFSProvider |
| 1472 |
+++++++++++ |
| 1473 |
An :any:`NFSProvider` resource describes an NFS server. |
| 1474 |
|
| 1475 |
.. code-block:: yaml |
| 1476 |
|
| 1477 |
NFSProvider: {} |
| 1478 |
|
| 1479 |
Arguments: |
| 1480 |
- None |
| 1481 |
|
| 1482 |
Used by: |
| 1483 |
- `NFSProviderDriver`_ |
| 1484 |
|
| 1485 |
RemoteTFTPProvider |
| 1486 |
++++++++++++++++++ |
| 1487 |
A :any:`RemoteTFTPProvider` describes a `TFTPProvider`_ resource available on |
| 1488 |
a remote computer. |
| 1489 |
|
| 1490 |
.. code-block:: yaml |
| 1491 |
|
| 1492 |
RemoteTFTPProvider |
| 1493 |
host: 'tftphost' |
| 1494 |
internal: '/srv/tftp/board-23/' |
| 1495 |
external: 'board-23/' |
| 1496 |
|
| 1497 |
Arguments: |
| 1498 |
- host (str): hostname of the remote host |
| 1499 |
- internal (str): path prefix to the TFTP root directory on ``host`` |
| 1500 |
- external (str): corresponding path prefix for use by the target |
| 1501 |
|
| 1502 |
Used by: |
| 1503 |
- `TFTPProviderDriver`_ |
| 1504 |
|
| 1505 |
RemoteHTTPProvider |
| 1506 |
++++++++++++++++++ |
| 1507 |
A :any:`RemoteHTTPProvider` describes an `HTTPProvider`_ resource available on |
| 1508 |
a remote computer. |
| 1509 |
|
| 1510 |
.. code-block:: yaml |
| 1511 |
|
| 1512 |
RemoteHTTPProvider: |
| 1513 |
host: 'httphost' |
| 1514 |
internal: '/srv/www/board-23/' |
| 1515 |
external: 'http://192.168.1.1/board-23/' |
| 1516 |
|
| 1517 |
Arguments: |
| 1518 |
- host (str): hostname of the remote host |
| 1519 |
- internal (str): path prefix to the HTTP root directory on ``host`` |
| 1520 |
- external (str): corresponding path prefix for use by the target |
| 1521 |
|
| 1522 |
Used by: |
| 1523 |
- `HTTPProviderDriver`_ |
| 1524 |
|
| 1525 |
RemoteNFSProvider |
| 1526 |
+++++++++++++++++ |
| 1527 |
A :any:`RemoteNFSProvider` describes an `NFSProvider`_ resource available on a |
| 1528 |
remote computer. |
| 1529 |
|
| 1530 |
.. code-block:: yaml |
| 1531 |
|
| 1532 |
RemoteNFSProvider: |
| 1533 |
host: 'nfshost' |
| 1534 |
|
| 1535 |
Arguments: |
| 1536 |
- host (str): hostname of the remote host |
| 1537 |
|
| 1538 |
Used by: |
| 1539 |
- `NFSProviderDriver`_ |
| 1540 |
|
| 1541 |
LAA Resources |
| 1542 |
~~~~~~~~~~~~~ |
| 1543 |
Resources for devices connected via a `Linaro Automation Appliance (LAA) |
| 1544 |
<https://hub.linaro.com/library/laa/laa>`_. |
| 1545 |
Requires the ``laam`` package, install with ``pip install labgrid[laa]``. |
| 1546 |
For a working example test suite, see `labgrid-laa-examples |
| 1547 |
<https://gitlab.com/Linaro/lava/appliance/labgrid-laa-examples>`_. |
| 1548 |
|
| 1549 |
LAASerialPort |
| 1550 |
+++++++++++++ |
| 1551 |
A :any:`LAASerialPort` describes a serial port on the LAA. |
| 1552 |
|
| 1553 |
.. code-block:: yaml |
| 1554 |
|
| 1555 |
LAASerialPort: |
| 1556 |
laa_identity: 'laa-00175' |
| 1557 |
serial_name: 'ttymxc3' |
| 1558 |
|
| 1559 |
Arguments: |
| 1560 |
- laa_identity (str): LAA identity for connection |
| 1561 |
- serial_name (str): name of the serial port on the LAA |
| 1562 |
|
| 1563 |
Used by: |
| 1564 |
- `LAASerialDriver`_ |
| 1565 |
|
| 1566 |
LAAPowerPort |
| 1567 |
++++++++++++ |
| 1568 |
A :any:`LAAPowerPort` describes the power control for a device on the LAA. |
| 1569 |
Power on and off are sequences of (vbus, state) tuples that are executed |
| 1570 |
in order. |
| 1571 |
|
| 1572 |
.. code-block:: yaml |
| 1573 |
|
| 1574 |
LAAPowerPort: |
| 1575 |
laa_identity: 'laa-00175' |
| 1576 |
power_on: |
| 1577 |
- ['3v3', 'on'] |
| 1578 |
- ['5v', 'on'] |
| 1579 |
power_off: |
| 1580 |
- ['3v3', 'off'] |
| 1581 |
- ['5v', 'off'] |
| 1582 |
power_cycle: |
| 1583 |
- ['3v3', 'off'] |
| 1584 |
- ['5v', 'reset'] |
| 1585 |
- ['3v3', 'on'] |
| 1586 |
|
| 1587 |
Arguments: |
| 1588 |
- laa_identity (str): LAA identity for connection |
| 1589 |
- power_on (list): sequence of [vbus, state] pairs for power on |
| 1590 |
- power_off (list): sequence of [vbus, state] pairs for power off |
| 1591 |
- power_cycle (list, optional): sequence for power cycle, if not set |
| 1592 |
the driver does off + delay + on |
| 1593 |
|
| 1594 |
Used by: |
| 1595 |
- `LAAPowerDriver`_ |
| 1596 |
|
| 1597 |
LAAUSBGadgetMassStorage |
| 1598 |
++++++++++++++++++++++++ |
| 1599 |
A :any:`LAAUSBGadgetMassStorage` describes a USB gadget mass storage device |
| 1600 |
on the LAA. This can be used to simulate a USB stick being plugged in or out. |
| 1601 |
|
| 1602 |
.. code-block:: yaml |
| 1603 |
|
| 1604 |
LAAUSBGadgetMassStorage: |
| 1605 |
laa_identity: 'laa-00175' |
| 1606 |
image: 'boot.img' |
| 1607 |
|
| 1608 |
Arguments: |
| 1609 |
- laa_identity (str): LAA identity for connection |
| 1610 |
- image (str): mass storage image filename |
| 1611 |
|
| 1612 |
Used by: |
| 1613 |
- `LAAUSBGadgetMassStorageDriver`_ |
| 1614 |
|
| 1615 |
LAAUSBPort |
| 1616 |
++++++++++ |
| 1617 |
A :any:`LAAUSBPort` describes USB ports on the LAA that can be toggled. |
| 1618 |
|
| 1619 |
.. code-block:: yaml |
| 1620 |
|
| 1621 |
LAAUSBPort: |
| 1622 |
laa_identity: 'laa-00175' |
| 1623 |
usb_ports: [1, 2] |
| 1624 |
|
| 1625 |
Arguments: |
| 1626 |
- laa_identity (str): LAA identity for connection |
| 1627 |
- usb_ports (list): list of USB port numbers to control |
| 1628 |
|
| 1629 |
Used by: |
| 1630 |
- `LAAUSBDriver`_ |
| 1631 |
|
| 1632 |
LAAButtonPort |
| 1633 |
+++++++++++++ |
| 1634 |
A :any:`LAAButtonPort` describes virtual buttons on the LAA. |
| 1635 |
|
| 1636 |
.. code-block:: yaml |
| 1637 |
|
| 1638 |
LAAButtonPort: |
| 1639 |
laa_identity: 'laa-00175' |
| 1640 |
buttons: ['power', 'reset'] |
| 1641 |
|
| 1642 |
Arguments: |
| 1643 |
- laa_identity (str): LAA identity for connection |
| 1644 |
- buttons (list): list of button names available |
| 1645 |
|
| 1646 |
Used by: |
| 1647 |
- `LAAButtonDriver`_ |
| 1648 |
|
| 1649 |
LAALed |
| 1650 |
++++++ |
| 1651 |
A :any:`LAALed` describes an LED on the LAA. |
| 1652 |
|
| 1653 |
.. code-block:: yaml |
| 1654 |
|
| 1655 |
LAALed: |
| 1656 |
laa_identity: 'laa-00175' |
| 1657 |
|
| 1658 |
Arguments: |
| 1659 |
- laa_identity (str): LAA identity for connection |
| 1660 |
|
| 1661 |
Used by: |
| 1662 |
- `LAALedDriver`_ |
| 1663 |
|
| 1664 |
LAATempSensor |
| 1665 |
+++++++++++++ |
| 1666 |
A :any:`LAATempSensor` describes a temperature sensor on the LAA. |
| 1667 |
|
| 1668 |
.. code-block:: yaml |
| 1669 |
|
| 1670 |
LAATempSensor: |
| 1671 |
laa_identity: 'laa-00175' |
| 1672 |
|
| 1673 |
Arguments: |
| 1674 |
- laa_identity (str): LAA identity for connection |
| 1675 |
|
| 1676 |
Used by: |
| 1677 |
- `LAATempDriver`_ |
| 1678 |
|
| 1679 |
LAAWattMeter |
| 1680 |
++++++++++++ |
| 1681 |
A :any:`LAAWattMeter` describes a power meter on the LAA. |
| 1682 |
|
| 1683 |
.. code-block:: yaml |
| 1684 |
|
| 1685 |
LAAWattMeter: |
| 1686 |
laa_identity: 'laa-00175' |
| 1687 |
|
| 1688 |
Arguments: |
| 1689 |
- laa_identity (str): LAA identity for connection |
| 1690 |
|
| 1691 |
Used by: |
| 1692 |
- `LAAWattDriver`_ |
| 1693 |
|
| 1694 |
LAAProvider |
| 1695 |
+++++++++++ |
| 1696 |
A :any:`LAAProvider` describes file storage on the LAA. Files uploaded |
| 1697 |
here are served via TFTP to the device under test. |
| 1698 |
|
| 1699 |
.. code-block:: yaml |
| 1700 |
|
| 1701 |
LAAProvider: |
| 1702 |
laa_identity: 'laa-00175' |
| 1703 |
|
| 1704 |
Arguments: |
| 1705 |
- laa_identity (str): LAA identity for connection |
| 1706 |
|
| 1707 |
Used by: |
| 1708 |
- `LAAProviderDriver`_ |
| 1709 |
|
| 1710 |
RemotePlace |
| 1711 |
~~~~~~~~~~~ |
| 1712 |
A :any:`RemotePlace` describes a set of resources attached to a labgrid remote |
| 1713 |
place. |
| 1714 |
|
| 1715 |
.. code-block:: yaml |
| 1716 |
|
| 1717 |
RemotePlace: |
| 1718 |
name: 'example-place' |
| 1719 |
|
| 1720 |
The example describes the remote place ``example-place``. It will connect to the |
| 1721 |
labgrid remote coordinator, wait until the resources become available and expose |
| 1722 |
them to the internal environment. |
| 1723 |
|
| 1724 |
Arguments: |
| 1725 |
- name (str): name or pattern of the remote place |
| 1726 |
|
| 1727 |
Used by: |
| 1728 |
- potentially all drivers |
| 1729 |
|
| 1730 |
DockerDaemon |
| 1731 |
~~~~~~~~~~~~ |
| 1732 |
A :any:`DockerDaemon` describes where to contact a *docker daemon* process. |
| 1733 |
DockerDaemon also participates in managing `NetworkService`_ instances |
| 1734 |
created through interaction with that daemon. |
| 1735 |
|
| 1736 |
.. code-block:: yaml |
| 1737 |
|
| 1738 |
DockerDaemon: |
| 1739 |
docker_daemon_url: 'unix://var/run/docker.sock' |
| 1740 |
|
| 1741 |
The example describes a docker daemon accessible via the |
| 1742 |
``/var/run/docker.sock`` unix socket. When used by a `DockerDriver`_, the |
| 1743 |
`DockerDriver`_ will first create a docker container which the |
| 1744 |
DockerDaemon resource will subsequently use to create one/more |
| 1745 |
`NetworkService`_ instances - as specified by `DockerDriver`_ configuration. |
| 1746 |
Each `NetworkService`_ instance corresponds to a network service running inside |
| 1747 |
the container. |
| 1748 |
|
| 1749 |
Moreover, DockerDaemon will remove any hanging containers if |
| 1750 |
DockerDaemon is used several times in a row - as is the case when |
| 1751 |
executing test suites. Normally `DockerDriver`_ - when deactivated - |
| 1752 |
cleans up the created docker container; programming errors, keyboard |
| 1753 |
interrupts or unix kill signals may lead to hanging containers, however; |
| 1754 |
therefore auto-cleanup is important. |
| 1755 |
|
| 1756 |
Arguments: |
| 1757 |
- docker_daemon_url (str): url of the daemon to use for this target |
| 1758 |
|
| 1759 |
Used by: |
| 1760 |
- `DockerDriver`_ |
| 1761 |
|
| 1762 |
.. _udev-matching: |
| 1763 |
|
| 1764 |
udev Matching |
| 1765 |
~~~~~~~~~~~~~ |
| 1766 |
labgrid allows the exporter (or the client-side environment) to match resources |
| 1767 |
via udev rules. |
| 1768 |
Any udev property key and value can be used, path matching USB devices is |
| 1769 |
allowed as well. |
| 1770 |
The udev resources become available as soon as they are plugged into the |
| 1771 |
computer running the exporter. |
| 1772 |
|
| 1773 |
The initial matching and monitoring for udev events is handled by the |
| 1774 |
:any:`UdevManager` class. |
| 1775 |
This manager is automatically created when a resource derived from |
| 1776 |
:any:`USBResource` (such as :any:`USBSerialPort`, :any:`IMXUSBLoader` or |
| 1777 |
:any:`AndroidUSBFastboot`) is instantiated. |
| 1778 |
|
| 1779 |
To identify the kernel device which corresponds to a configured :any:`USBResource`, |
| 1780 |
each existing (and subsequently added) kernel device is matched against the |
| 1781 |
configured resources. |
| 1782 |
This is based on a list of *match entries* which must all be tested |
| 1783 |
successfully against the potential kernel device. |
| 1784 |
Match entries starting with an ``@`` are checked against the device's parents |
| 1785 |
instead of itself; here one matching parent causes the check to be successful. |
| 1786 |
|
| 1787 |
A given :any:`USBResource` class has builtin match entries that are checked first, |
| 1788 |
for example that the ``SUBSYSTEM`` is ``tty`` as in the case of the |
| 1789 |
:any:`USBSerialPort`. |
| 1790 |
Only if these succeed, match entries provided by the user for the resource |
| 1791 |
instance are considered. |
| 1792 |
|
| 1793 |
In addition to the properties reported by ``udevadm monitor --udev |
| 1794 |
--property``, elements of the ``ATTR(S){}`` dictionary (as shown by ``udevadm |
| 1795 |
info <device> -a``) are useable as match keys. |
| 1796 |
Finally ``sys_name`` allows matching against the name of the directory in |
| 1797 |
sysfs. |
| 1798 |
All match entries must succeed for the device to be accepted. |
| 1799 |
|
| 1800 |
Note that all udev property values are strings and are therefore case sensitive. |
| 1801 |
Hex values such as ``ID_MODEL_ID`` must match the exact case reported by udev |
| 1802 |
(e.g., ``"04d8"`` will not match ``"04D8"``). |
| 1803 |
|
| 1804 |
labgrid provides a small utility called ``labgrid-suggest`` which will |
| 1805 |
output the proper YAML formatted snippets for you. |
| 1806 |
These snippets can be added under the resource key in an environment |
| 1807 |
configuration or under their own entries in an exporter configuration file. |
| 1808 |
|
| 1809 |
As the USB bus number can change depending on the kernel driver initialization |
| 1810 |
order, it is better to use the ``ID_PATH`` instead of ``sys_name`` for USB |
| 1811 |
devices. |
| 1812 |
|
| 1813 |
In the default udev configuration, ``ID_PATH`` is not available for all USB |
| 1814 |
devices, but that can be changed by creating a udev rules file: |
| 1815 |
|
| 1816 |
.. code-block:: none |
| 1817 |
|
| 1818 |
SUBSYSTEMS=="usb", IMPORT{builtin}="path_id" |
| 1819 |
|
| 1820 |
The following examples show how to use the udev matches for some common |
| 1821 |
use-cases. |
| 1822 |
|
| 1823 |
Matching a USB Serial Converter on a Hub Port |
| 1824 |
+++++++++++++++++++++++++++++++++++++++++++++ |
| 1825 |
This will match any USB serial converter connected below the hub port 1.2.5.5 |
| 1826 |
on bus 1. |
| 1827 |
The ``ID_PATH`` value corresponds to the hierarchy of buses and ports as shown |
| 1828 |
with ``udevadm info /dev/ttyUSB0``. |
| 1829 |
|
| 1830 |
.. code-block:: yaml |
| 1831 |
|
| 1832 |
USBSerialPort: |
| 1833 |
match: |
| 1834 |
'@ID_PATH': 'pci-0000:05:00.0-usb-0:1.2.5.5' |
| 1835 |
|
| 1836 |
Note the ``@`` in the ``@ID_PATH`` match, which applies this match to the |
| 1837 |
device's parents instead of directly to itself. |
| 1838 |
This is necessary for the `USBSerialPort`_ because we actually want to find the |
| 1839 |
``ttyUSB?`` device below the USB serial converter device. |
| 1840 |
|
| 1841 |
Matching an Android USB Fastboot Device |
| 1842 |
+++++++++++++++++++++++++++++++++++++++ |
| 1843 |
In this case, we want to match the USB device on that port directly, so we |
| 1844 |
don't use a parent match. |
| 1845 |
|
| 1846 |
.. code-block:: yaml |
| 1847 |
|
| 1848 |
AndroidUSBFastboot: |
| 1849 |
match: |
| 1850 |
ID_PATH: 'pci-0000:05:00.0-usb-0:1.2.3' |
| 1851 |
|
| 1852 |
Matching a Specific UART in a Dual-Port Adapter |
| 1853 |
+++++++++++++++++++++++++++++++++++++++++++++++ |
| 1854 |
On this board, the serial console is connected to the second port of an |
| 1855 |
on-board dual-port USB-UART. |
| 1856 |
The board itself is connected to the bus 3 and port path ``10.2.2.2``. |
| 1857 |
The correct value can be shown by running ``udevadm info /dev/ttyUSB9`` in our |
| 1858 |
case: |
| 1859 |
|
| 1860 |
.. code-block:: bash |
| 1861 |
:emphasize-lines: 21 |
| 1862 |
|
| 1863 |
$ udevadm info /dev/ttyUSB9 |
| 1864 |
P: /devices/pci0000:00/0000:00:14.0/usb3/3-10/3-10.2/3-10.2.2/3-10.2.2.2/3-10.2.2.2:1.1/ttyUSB9/tty/ttyUSB9 |
| 1865 |
N: ttyUSB9 |
| 1866 |
S: serial/by-id/usb-FTDI_Dual_RS232-HS-if01-port0 |
| 1867 |
S: serial/by-path/pci-0000:00:14.0-usb-0:10.2.2.2:1.1-port0 |
| 1868 |
E: DEVLINKS=/dev/serial/by-id/usb-FTDI_Dual_RS232-HS-if01-port0 /dev/serial/by-path/pci-0000:00:14.0-usb-0:10.2.2.2:1.1-port0 |
| 1869 |
E: DEVNAME=/dev/ttyUSB9 |
| 1870 |
E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb3/3-10/3-10.2/3-10.2.2/3-10.2.2.2/3-10.2.2.2:1.1/ttyUSB9/tty/ttyUSB9 |
| 1871 |
E: ID_BUS=usb |
| 1872 |
E: ID_MODEL=Dual_RS232-HS |
| 1873 |
E: ID_MODEL_ENC=Dual\x20RS232-HS |
| 1874 |
E: ID_MODEL_FROM_DATABASE=FT2232C Dual USB-UART/FIFO IC |
| 1875 |
E: ID_MODEL_ID=6010 |
| 1876 |
E: ID_PATH=pci-0000:00:14.0-usb-0:10.2.2.2:1.1 |
| 1877 |
E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_10_2_2_2_1_1 |
| 1878 |
E: ID_REVISION=0700 |
| 1879 |
E: ID_SERIAL=FTDI_Dual_RS232-HS |
| 1880 |
E: ID_TYPE=generic |
| 1881 |
E: ID_USB_DRIVER=ftdi_sio |
| 1882 |
E: ID_USB_INTERFACES=:ffffff: |
| 1883 |
E: ID_USB_INTERFACE_NUM=01 |
| 1884 |
E: ID_VENDOR=FTDI |
| 1885 |
E: ID_VENDOR_ENC=FTDI |
| 1886 |
E: ID_VENDOR_FROM_DATABASE=Future Technology Devices International, Ltd |
| 1887 |
E: ID_VENDOR_ID=0403 |
| 1888 |
E: MAJOR=188 |
| 1889 |
E: MINOR=9 |
| 1890 |
E: SUBSYSTEM=tty |
| 1891 |
E: TAGS=:systemd: |
| 1892 |
E: USEC_INITIALIZED=9129609697 |
| 1893 |
|
| 1894 |
We use the ``ID_USB_INTERFACE_NUM`` to distinguish between the two ports: |
| 1895 |
|
| 1896 |
.. code-block:: yaml |
| 1897 |
|
| 1898 |
USBSerialPort: |
| 1899 |
match: |
| 1900 |
'@ID_PATH': 'pci-0000:05:00.0-usb-2:10.2.2.2' |
| 1901 |
ID_USB_INTERFACE_NUM: '01' |
| 1902 |
|
| 1903 |
Matching a USB UART by Serial Number |
| 1904 |
++++++++++++++++++++++++++++++++++++ |
| 1905 |
Most of the USB serial converters in our lab have been programmed with unique |
| 1906 |
serial numbers. |
| 1907 |
This makes it easy to always match the same one even if the USB topology |
| 1908 |
changes or a board has been moved between host systems. |
| 1909 |
|
| 1910 |
.. code-block:: yaml |
| 1911 |
|
| 1912 |
USBSerialPort: |
| 1913 |
match: |
| 1914 |
ID_SERIAL_SHORT: 'P-00-03564' |
| 1915 |
|
| 1916 |
To check if your device has a serial number, you can use ``udevadm info``: |
| 1917 |
|
| 1918 |
.. code-block:: bash |
| 1919 |
|
| 1920 |
$ udevadm info /dev/ttyUSB5 | grep SERIAL_SHORT |
| 1921 |
E: ID_SERIAL_SHORT=P-00-03564 |
| 1922 |
|
| 1923 |
In the background, the additional properties are provided by the builtin ``usb_id`` |
| 1924 |
udev helper:: |
| 1925 |
|
| 1926 |
$ udevadm test-builtin usb_id /sys/class/tty/ttyUSB0 |
| 1927 |
Load module index |
| 1928 |
Parsed configuration file /lib/systemd/network/99-default.link |
| 1929 |
Parsed configuration file /lib/systemd/network/73-usb-net-by-mac.link |
| 1930 |
Created link configuration context. |
| 1931 |
ID_VENDOR=Silicon_Labs |
| 1932 |
ID_VENDOR_ENC=Silicon\x20Labs |
| 1933 |
ID_VENDOR_ID=10c4 |
| 1934 |
ID_MODEL=CP2102_USB_to_UART_Bridge_Controller |
| 1935 |
ID_MODEL_ENC=CP2102\x20USB\x20to\x20UART\x20Bridge\x20Controller |
| 1936 |
ID_MODEL_ID=ea60 |
| 1937 |
ID_REVISION=0100 |
| 1938 |
ID_SERIAL=Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_P-00-03564 |
| 1939 |
ID_SERIAL_SHORT=P-00-03564 |
| 1940 |
ID_TYPE=generic |
| 1941 |
ID_BUS=usb |
| 1942 |
ID_USB_INTERFACES=:ff0000: |
| 1943 |
ID_USB_INTERFACE_NUM=00 |
| 1944 |
ID_USB_DRIVER=cp210x |
| 1945 |
Unload module index |
| 1946 |
Unloaded link configuration context. |
| 1947 |
|
| 1948 |
Drivers |
| 1949 |
------- |
| 1950 |
|
| 1951 |
SerialDriver |
| 1952 |
~~~~~~~~~~~~ |
| 1953 |
A :any:`SerialDriver` connects to a serial port. It requires one of the serial |
| 1954 |
port resources. |
| 1955 |
|
| 1956 |
Binds to: |
| 1957 |
port: |
| 1958 |
- `NetworkSerialPort`_ |
| 1959 |
- `RawSerialPort`_ |
| 1960 |
- `USBSerialPort`_ |
| 1961 |
|
| 1962 |
.. code-block:: yaml |
| 1963 |
|
| 1964 |
SerialDriver: |
| 1965 |
txdelay: 0.05 |
| 1966 |
txchunk: 1 |
| 1967 |
|
| 1968 |
Implements: |
| 1969 |
- :any:`ConsoleProtocol` |
| 1970 |
- :any:`ResetProtocol` |
| 1971 |
|
| 1972 |
Arguments: |
| 1973 |
- txdelay (float, default=0.0): time in seconds to wait before sending a chunk |
| 1974 |
- txchunk (int, default=1): number of bytes the `txdelay` should apply to |
| 1975 |
- timeout (float, default=3.0): time in seconds to wait for a network serial port before |
| 1976 |
an error occurs |
| 1977 |
|
| 1978 |
ModbusRTUDriver |
| 1979 |
~~~~~~~~~~~~~~~ |
| 1980 |
A :any:`ModbusRTUDriver` connects to a ModbusRTU resource. This driver only |
| 1981 |
supports local usage and will not work with an exporter. |
| 1982 |
|
| 1983 |
The driver is implemented using the |
| 1984 |
`minimalmodbus <https://minimalmodbus.readthedocs.io/en/stable/>`_ Python |
| 1985 |
library. |
| 1986 |
The implementation only supports that labgrid will be the master on the Modbus |
| 1987 |
network. |
| 1988 |
|
| 1989 |
.. code-block:: yaml |
| 1990 |
|
| 1991 |
ModbusRTUDriver: {} |
| 1992 |
|
| 1993 |
Binds to: |
| 1994 |
resource: |
| 1995 |
- `ModbusRTU`_ |
| 1996 |
|
| 1997 |
Implements: |
| 1998 |
- None (yet) |
| 1999 |
|
| 2000 |
Arguments: |
| 2001 |
- None |
| 2002 |
|
| 2003 |
ShellDriver |
| 2004 |
~~~~~~~~~~~ |
| 2005 |
A :any:`ShellDriver` binds on top of a :any:`ConsoleProtocol` and is designed |
| 2006 |
to interact with a login prompt and a Linux shell. |
| 2007 |
|
| 2008 |
Binds to: |
| 2009 |
console: |
| 2010 |
- :any:`ConsoleProtocol` |
| 2011 |
|
| 2012 |
Implements: |
| 2013 |
- :any:`CommandProtocol` |
| 2014 |
- :any:`FileTransferProtocol` |
| 2015 |
|
| 2016 |
.. code-block:: yaml |
| 2017 |
|
| 2018 |
ShellDriver: |
| 2019 |
prompt: 'root@[\w-]+:[^ ]+ ' |
| 2020 |
login_prompt: ' login: ' |
| 2021 |
username: 'root' |
| 2022 |
|
| 2023 |
Arguments: |
| 2024 |
- prompt (regex): shell prompt to match after logging in |
| 2025 |
- login_prompt (regex): match for the login prompt |
| 2026 |
- username (str): username to use during login |
| 2027 |
- password (str): optional, password to use during login. |
| 2028 |
Can be an empty string. |
| 2029 |
- keyfile (str): optional, keyfile to upload after login, making the |
| 2030 |
`SSHDriver`_ usable |
| 2031 |
- login_timeout (int, default=60): timeout for login prompt detection in |
| 2032 |
seconds |
| 2033 |
- await_login_timeout (int, default=2): time in seconds of silence that needs |
| 2034 |
to pass before sending a newline to device. |
| 2035 |
- console_ready (regex): optional, pattern used by the kernel to inform |
| 2036 |
the user that a console can be activated by pressing enter. |
| 2037 |
- post_login_settle_time (int, default=0): seconds of silence after logging in |
| 2038 |
before check for a prompt. Useful when the console is interleaved with boot |
| 2039 |
output which may interrupt prompt detection. |
| 2040 |
|
| 2041 |
.. note:: |
| 2042 |
`bash >= 5.1 <https://www.gnu.org/software/bash/manual/bash.html#index-enable_002dbracketed_002dpaste>`_ |
| 2043 |
enables bracketed-paste mode by default, |
| 2044 |
allowing the terminal emulator to tell a program whether input was typed or |
| 2045 |
pasted. |
| 2046 |
To achieve this, ``\e[?2004h`` is inserted when user input is expected, |
| 2047 |
enabling paste detection. |
| 2048 |
|
| 2049 |
Add ``\x1b\[\?2004h`` at the beginning of the prompt argument to allow the |
| 2050 |
ShellDriver to still match the prompt in this case. |
| 2051 |
|
| 2052 |
.. _conf-sshdriver: |
| 2053 |
|
| 2054 |
SSHDriver |
| 2055 |
~~~~~~~~~ |
| 2056 |
An :any:`SSHDriver` requires a `NetworkService`_ resource and allows the |
| 2057 |
execution of commands and file upload via network. |
| 2058 |
It uses SSH's ``ServerAliveInterval`` option to detect failed connections. |
| 2059 |
|
| 2060 |
If a shared SSH connection to the target is already open, it will reuse it when |
| 2061 |
running commands. |
| 2062 |
In that case, ``ServerAliveInterval`` should be set outside of labgrid, as it |
| 2063 |
cannot be enabled for an existing connection. |
| 2064 |
|
| 2065 |
Binds to: |
| 2066 |
networkservice: |
| 2067 |
- `NetworkService`_ |
| 2068 |
|
| 2069 |
Implements: |
| 2070 |
- :any:`CommandProtocol` |
| 2071 |
- :any:`FileTransferProtocol` |
| 2072 |
|
| 2073 |
.. code-block:: yaml |
| 2074 |
|
| 2075 |
SSHDriver: |
| 2076 |
keyfile: 'example.key' |
| 2077 |
|
| 2078 |
Arguments: |
| 2079 |
- keyfile (str): optional, filename of private key to login into the remote system |
| 2080 |
(has precedence over `NetworkService`_'s password) |
| 2081 |
- stderr_merge (bool, default=False): set to True to make ``run()`` return stderr merged with |
| 2082 |
stdout, and an empty list as second element. |
| 2083 |
- connection_timeout (float, default=30.0): timeout when trying to establish connection to |
| 2084 |
target. |
| 2085 |
- explicit_sftp_mode (bool, default=False): if set to True, ``put()``, ``get()``, and ``scp()`` |
| 2086 |
will explicitly use the SFTP protocol for file transfers instead of scp's default protocol |
| 2087 |
- explicit_scp_mode (bool, default=False): if set to True, ``put()``, ``get()``, and ``scp()`` |
| 2088 |
will explicitly use the SCP protocol for file transfers instead of scp's default protocol |
| 2089 |
- username (str, default=username from `NetworkService`_): username used by SSH |
| 2090 |
- password (str, default=password from `NetworkService`_): password used by SSH |
| 2091 |
|
| 2092 |
UBootDriver |
| 2093 |
~~~~~~~~~~~ |
| 2094 |
A :any:`UBootDriver` interfaces with a U-Boot bootloader via a |
| 2095 |
:any:`ConsoleProtocol`. |
| 2096 |
|
| 2097 |
Binds to: |
| 2098 |
console: |
| 2099 |
- :any:`ConsoleProtocol` |
| 2100 |
|
| 2101 |
Implements: |
| 2102 |
- :any:`CommandProtocol` |
| 2103 |
- :any:`LinuxBootProtocol` |
| 2104 |
|
| 2105 |
.. code-block:: yaml |
| 2106 |
|
| 2107 |
UBootDriver: |
| 2108 |
prompt: 'Uboot> ' |
| 2109 |
boot_commands: |
| 2110 |
net: 'run netboot' |
| 2111 |
spi: 'run spiboot' |
| 2112 |
|
| 2113 |
Arguments: |
| 2114 |
- prompt (regex, default=""): U-Boot prompt to match |
| 2115 |
- autoboot (regex, default="stop autoboot"): autoboot message to match |
| 2116 |
- password (str): optional, U-Boot unlock password |
| 2117 |
- interrupt (str, default="\\n"): string to interrupt autoboot (use ``\\x03`` for CTRL-C) |
| 2118 |
- init_commands (tuple): optional, tuple of commands to execute after matching the |
| 2119 |
prompt |
| 2120 |
- password_prompt (str, default="enter Password: "): regex to match the U-Boot password prompt |
| 2121 |
- bootstring (str): optional, regex to match on Linux Kernel boot |
| 2122 |
- boot_command (str, default="run bootcmd"): boot command for booting target |
| 2123 |
- boot_commands (dict, default={}): boot commands by name for LinuxBootProtocol boot command |
| 2124 |
- login_timeout (int, default=30): timeout for login prompt detection in seconds |
| 2125 |
- boot_timeout (int, default=30): timeout for initial Linux Kernel version detection |
| 2126 |
- strip_timestamp (bool, default=False): strip timestamps prepended to console when present |
| 2127 |
|
| 2128 |
SmallUBootDriver |
| 2129 |
~~~~~~~~~~~~~~~~ |
| 2130 |
A :any:`SmallUBootDriver` interfaces with stripped-down *U-Boot* variants that |
| 2131 |
are sometimes used in cheap consumer electronics. |
| 2132 |
|
| 2133 |
SmallUBootDriver is meant as a driver for U-Boot with only little functionality |
| 2134 |
compared to a standard U-Boot. |
| 2135 |
Especially is copes with the following limitations: |
| 2136 |
|
| 2137 |
- The U-Boot does not have a real password-prompt but can be activated by |
| 2138 |
entering a "secret" after a message was displayed. |
| 2139 |
- The command line does not have a built-in echo command. |
| 2140 |
Thus this driver uses "Unknown Command" messages as marker before and after |
| 2141 |
the output of a command. |
| 2142 |
- Since there is no echo we cannot return the exit code of the command. |
| 2143 |
Commands will always return 0 unless the command was not found. |
| 2144 |
|
| 2145 |
This driver needs the following features activated in U-Boot to work: |
| 2146 |
|
| 2147 |
- The U-Boot must not have a real password prompt. Instead it must be keyword |
| 2148 |
activated. |
| 2149 |
For example it should be activated by a dialog like the following: |
| 2150 |
|
| 2151 |
- U-Boot: "Autobooting in 1s..." |
| 2152 |
- labgrid: "secret" |
| 2153 |
- U-Boot: <switching to console> |
| 2154 |
|
| 2155 |
- The U-Boot must be able to parse multiple commands in a single line separated |
| 2156 |
by ";". |
| 2157 |
- The U-Boot must support the "bootm" command to boot from a memory location. |
| 2158 |
|
| 2159 |
Binds to: |
| 2160 |
console: |
| 2161 |
- :any:`ConsoleProtocol` (see `SerialDriver`_) |
| 2162 |
|
| 2163 |
Implements: |
| 2164 |
- :any:`CommandProtocol` |
| 2165 |
- :any:`LinuxBootProtocol` |
| 2166 |
|
| 2167 |
.. code-block:: yaml |
| 2168 |
|
| 2169 |
SmallUBootDriver: |
| 2170 |
prompt: 'ap143-2\.0> ' |
| 2171 |
boot_expression: 'Autobooting in 1 seconds' |
| 2172 |
boot_secret: 'tpl' |
| 2173 |
|
| 2174 |
Arguments: |
| 2175 |
- boot_expression (str, default="U-Boot 20\\d+"): regex to match the U-Boot start string |
| 2176 |
- boot_secret (str, default="a"): secret used to unlock prompt |
| 2177 |
- boot_secret_nolf (bool, default=False): send boot_secret without new line |
| 2178 |
- login_timeout (int, default=60): timeout for password/login prompt detection |
| 2179 |
- for other arguments, see `UBootDriver`_ |
| 2180 |
|
| 2181 |
BareboxDriver |
| 2182 |
~~~~~~~~~~~~~ |
| 2183 |
A :any:`BareboxDriver` interfaces with a *barebox* bootloader via a |
| 2184 |
:any:`ConsoleProtocol`. |
| 2185 |
|
| 2186 |
Binds to: |
| 2187 |
console: |
| 2188 |
- :any:`ConsoleProtocol` |
| 2189 |
|
| 2190 |
Implements: |
| 2191 |
- :any:`CommandProtocol` |
| 2192 |
- :any:`LinuxBootProtocol` |
| 2193 |
|
| 2194 |
.. code-block:: yaml |
| 2195 |
|
| 2196 |
BareboxDriver: |
| 2197 |
prompt: 'barebox@[^:]+:[^ ]+ ' |
| 2198 |
|
| 2199 |
Arguments: |
| 2200 |
- prompt (regex, default=""): barebox prompt to match |
| 2201 |
- autoboot (regex, default="stop autoboot"): autoboot message to match |
| 2202 |
- interrupt (str, default="\\n"): string to interrupt autoboot (use "\\x03" for CTRL-c), |
| 2203 |
`CTRL-d <https://git.pengutronix.de/cgit/barebox/commit/?id=ae482477b60e1e308327658a899358746ff2f5b>`_ |
| 2204 |
("\\x04") is recommended to ensure barebox behaves as closely as possible to uninterrupted |
| 2205 |
boots (for barebox >=v2025.03.0). |
| 2206 |
- bootstring (regex, default="Linux version \\d"): regex that indicating that the Linux Kernel is |
| 2207 |
booting |
| 2208 |
- boot_command (str, default="boot -v"): optional, boot command to boot target |
| 2209 |
- password (str): optional, password to use for access to the shell |
| 2210 |
- login_timeout (int, default=60): timeout for access to the shell |
| 2211 |
|
| 2212 |
ExternalConsoleDriver |
| 2213 |
~~~~~~~~~~~~~~~~~~~~~ |
| 2214 |
An :any:`ExternalConsoleDriver` implements the :any:`ConsoleProtocol` on top of |
| 2215 |
a command executed on the local computer. |
| 2216 |
|
| 2217 |
Binds to: |
| 2218 |
- None |
| 2219 |
|
| 2220 |
Implements: |
| 2221 |
- :any:`ConsoleProtocol` |
| 2222 |
|
| 2223 |
.. code-block:: yaml |
| 2224 |
|
| 2225 |
ExternalConsoleDriver: |
| 2226 |
cmd: 'microcom /dev/ttyUSB2' |
| 2227 |
txdelay: 0.05 |
| 2228 |
txchunk: 1 |
| 2229 |
|
| 2230 |
Arguments: |
| 2231 |
- cmd (str): command to execute and then bind to. |
| 2232 |
- txdelay (float, default=0.0): time in seconds to wait before sending a chunk |
| 2233 |
- txchunk (int, default=1): number of bytes the `txdelay` should apply to |
| 2234 |
|
| 2235 |
AndroidFastbootDriver |
| 2236 |
~~~~~~~~~~~~~~~~~~~~~ |
| 2237 |
An :any:`AndroidFastbootDriver` allows the upload of images to a device in the |
| 2238 |
USB or network *Fastboot state*. |
| 2239 |
|
| 2240 |
Binds to: |
| 2241 |
fastboot: |
| 2242 |
- `AndroidUSBFastboot`_ |
| 2243 |
- `RemoteAndroidUSBFastboot`_ |
| 2244 |
- `AndroidNetFastboot`_ |
| 2245 |
- `RemoteAndroidNetFastboot`_ |
| 2246 |
|
| 2247 |
Implements: |
| 2248 |
- None (yet) |
| 2249 |
|
| 2250 |
.. code-block:: yaml |
| 2251 |
|
| 2252 |
AndroidFastbootDriver: |
| 2253 |
boot_image: 'mylocal.image' |
| 2254 |
sparse_size: '100M' |
| 2255 |
|
| 2256 |
Arguments: |
| 2257 |
- boot_image (str): optional, image key referring to the image to boot |
| 2258 |
- flash_images (dict): optional, partition to image key mapping referring to |
| 2259 |
images to flash to the device |
| 2260 |
- sparse_size (str): optional, sparse files greater than given size (see |
| 2261 |
fastboot manpage -S option for allowed size suffixes). The default is the |
| 2262 |
same as the fastboot default, which is computed after querying the target's |
| 2263 |
``max-download-size`` variable. |
| 2264 |
|
| 2265 |
DFUDriver |
| 2266 |
~~~~~~~~~ |
| 2267 |
A :any:`DFUDriver` allows the download of images to a device in DFU (Device |
| 2268 |
Firmware Upgrade) mode. |
| 2269 |
|
| 2270 |
Binds to: |
| 2271 |
dfu: |
| 2272 |
- `DFUDevice`_ |
| 2273 |
- `NetworkDFUDevice`_ |
| 2274 |
|
| 2275 |
Implements: |
| 2276 |
- None (yet) |
| 2277 |
|
| 2278 |
.. code-block:: yaml |
| 2279 |
|
| 2280 |
DFUDriver: {} |
| 2281 |
|
| 2282 |
Arguments: |
| 2283 |
- None |
| 2284 |
|
| 2285 |
OpenOCDDriver |
| 2286 |
~~~~~~~~~~~~~ |
| 2287 |
An :any:`OpenOCDDriver` controls *OpenOCD* to bootstrap a target with a |
| 2288 |
bootloader. |
| 2289 |
|
| 2290 |
Note that OpenOCD supports specifying USB paths since |
| 2291 |
`a1b308ab <https://sourceforge.net/p/openocd/code/ci/a1b308ab/>`_ which was released with v0.11. |
| 2292 |
The OpenOCDDriver passes the resource's USB path. |
| 2293 |
Depending on which OpenOCD version is installed it is either used correctly or |
| 2294 |
a warning is displayed and the first resource seen is used, which might be the |
| 2295 |
wrong USB device. |
| 2296 |
Consider updating your OpenOCD version when using multiple USB Blasters. |
| 2297 |
|
| 2298 |
Binds to: |
| 2299 |
interface: |
| 2300 |
- `AlteraUSBBlaster`_ |
| 2301 |
- `NetworkAlteraUSBBlaster`_ |
| 2302 |
- `USBDebugger`_ |
| 2303 |
- `NetworkUSBDebugger`_ |
| 2304 |
|
| 2305 |
Implements: |
| 2306 |
- :any:`BootstrapProtocol` |
| 2307 |
|
| 2308 |
.. code-block:: yaml |
| 2309 |
|
| 2310 |
OpenOCDDriver: |
| 2311 |
config: 'local-settings.cfg' |
| 2312 |
image: 'bitstream' |
| 2313 |
interface_config: 'ftdi/lambdaconcept_ecpix-5.cfg' |
| 2314 |
board_config: 'lambdaconcept_ecpix-5.cfg' |
| 2315 |
load_commands: |
| 2316 |
- 'init' |
| 2317 |
- 'svf -quiet {filename}' |
| 2318 |
- 'exit' |
| 2319 |
|
| 2320 |
Arguments: |
| 2321 |
- config (str/list): optional, OpenOCD configuration file(s) |
| 2322 |
- search (str): optional, include search path for scripts |
| 2323 |
- image (str): optional, name of the image to bootstrap onto the device |
| 2324 |
- interface_config (str): optional, interface config in the ``openocd/scripts/interface/`` directory |
| 2325 |
- board_config (str): optional, board config in the ``openocd/scripts/board/`` directory |
| 2326 |
- load_commands (list of str): optional, load commands to use instead of ``init``, ``bootstrap {filename}``, ``shutdown`` |
| 2327 |
|
| 2328 |
QuartusHPSDriver |
| 2329 |
~~~~~~~~~~~~~~~~ |
| 2330 |
A :any:`QuartusHPSDriver` controls the "Quartus Prime Programmer and Tools" to |
| 2331 |
flash a target's QSPI. |
| 2332 |
|
| 2333 |
Binds to: |
| 2334 |
interface: |
| 2335 |
- `AlteraUSBBlaster`_ |
| 2336 |
- `NetworkAlteraUSBBlaster`_ |
| 2337 |
|
| 2338 |
Implements: |
| 2339 |
- None |
| 2340 |
|
| 2341 |
Arguments: |
| 2342 |
- image (str): optional, filename of image to write into QSPI flash |
| 2343 |
|
| 2344 |
The driver can be used in test cases by calling its ``flash()`` method. An |
| 2345 |
example strategy is included in labgrid. |
| 2346 |
|
| 2347 |
ManualPowerDriver |
| 2348 |
~~~~~~~~~~~~~~~~~ |
| 2349 |
A :any:`ManualPowerDriver` requires the user to control the target power |
| 2350 |
states. |
| 2351 |
This is required if a strategy is used with the target, but no automatic power |
| 2352 |
control is available. |
| 2353 |
|
| 2354 |
The driver's name will be displayed during interaction. |
| 2355 |
|
| 2356 |
.. note:: |
| 2357 |
When using the ManualPowerDriver with pytest, use ``-s``/``--capture=no`` to |
| 2358 |
prevent stdout capturing. |
| 2359 |
|
| 2360 |
Binds to: |
| 2361 |
- None |
| 2362 |
|
| 2363 |
Implements: |
| 2364 |
- :any:`PowerProtocol` |
| 2365 |
- :any:`ResetProtocol` |
| 2366 |
|
| 2367 |
.. code-block:: yaml |
| 2368 |
|
| 2369 |
ManualPowerDriver: |
| 2370 |
name: 'example-board' |
| 2371 |
|
| 2372 |
Arguments: |
| 2373 |
- None |
| 2374 |
|
| 2375 |
ExternalPowerDriver |
| 2376 |
~~~~~~~~~~~~~~~~~~~ |
| 2377 |
An :any:`ExternalPowerDriver` is used to control a target power state via an |
| 2378 |
external command. |
| 2379 |
|
| 2380 |
Binds to: |
| 2381 |
- None |
| 2382 |
|
| 2383 |
Implements: |
| 2384 |
- :any:`PowerProtocol` |
| 2385 |
- :any:`ResetProtocol` |
| 2386 |
|
| 2387 |
.. code-block:: yaml |
| 2388 |
|
| 2389 |
ExternalPowerDriver: |
| 2390 |
cmd_on: 'example_command on' |
| 2391 |
cmd_off: 'example_command off' |
| 2392 |
cmd_cycle: 'example_command cycle' |
| 2393 |
|
| 2394 |
Arguments: |
| 2395 |
- cmd_on (str): command to turn power to the board on |
| 2396 |
- cmd_off (str): command to turn power to the board off |
| 2397 |
- cmd_cycle (str): optional command to switch the board off and on |
| 2398 |
- delay (float, default=2.0): delay in seconds between off and on, if cmd_cycle is not set |
| 2399 |
|
| 2400 |
NetworkPowerDriver |
| 2401 |
~~~~~~~~~~~~~~~~~~ |
| 2402 |
A :any:`NetworkPowerDriver` controls a `NetworkPowerPort`_, allowing control of |
| 2403 |
the target power state without user interaction. |
| 2404 |
|
| 2405 |
Binds to: |
| 2406 |
port: |
| 2407 |
- `NetworkPowerPort`_ |
| 2408 |
|
| 2409 |
Implements: |
| 2410 |
- :any:`PowerProtocol` |
| 2411 |
- :any:`ResetProtocol` |
| 2412 |
|
| 2413 |
.. code-block:: yaml |
| 2414 |
|
| 2415 |
NetworkPowerDriver: |
| 2416 |
delay: 5.0 |
| 2417 |
|
| 2418 |
Arguments: |
| 2419 |
- delay (float, default=2.0): delay in seconds between off and on |
| 2420 |
|
| 2421 |
PDUDaemonDriver |
| 2422 |
~~~~~~~~~~~~~~~ |
| 2423 |
A :any:`PDUDaemonDriver` controls a `PDUDaemonPort`_, allowing control of the |
| 2424 |
target power state without user interaction. |
| 2425 |
|
| 2426 |
.. note:: |
| 2427 |
PDUDaemon processes commands in the background, so the actual state change |
| 2428 |
may happen several seconds after calls to PDUDaemonDriver return. |
| 2429 |
|
| 2430 |
Binds to: |
| 2431 |
port: |
| 2432 |
- `PDUDaemonPort`_ |
| 2433 |
|
| 2434 |
Implements: |
| 2435 |
- :any:`PowerProtocol` |
| 2436 |
- :any:`ResetProtocol` |
| 2437 |
|
| 2438 |
.. code-block:: yaml |
| 2439 |
|
| 2440 |
PDUDaemonDriver: |
| 2441 |
delay: 5.0 |
| 2442 |
|
| 2443 |
Arguments: |
| 2444 |
- delay (float, default=5.0): delay in seconds between off and on |
| 2445 |
|
| 2446 |
YKUSHPowerDriver |
| 2447 |
~~~~~~~~~~~~~~~~ |
| 2448 |
A :any:`YKUSHPowerDriver` controls a `YKUSHPowerPort`_, allowing control of the |
| 2449 |
target power state without user interaction. |
| 2450 |
|
| 2451 |
Binds to: |
| 2452 |
port: |
| 2453 |
- `YKUSHPowerPort`_ |
| 2454 |
- `NetworkYKUSHPowerPort`_ |
| 2455 |
|
| 2456 |
Implements: |
| 2457 |
- :any:`PowerProtocol` |
| 2458 |
- :any:`ResetProtocol` |
| 2459 |
|
| 2460 |
.. code-block:: yaml |
| 2461 |
|
| 2462 |
YKUSHPowerDriver: |
| 2463 |
delay: 5.0 |
| 2464 |
|
| 2465 |
Arguments: |
| 2466 |
- delay (float, default=2.0): delay in seconds between off and on |
| 2467 |
|
| 2468 |
DigitalOutputPowerDriver |
| 2469 |
~~~~~~~~~~~~~~~~~~~~~~~~ |
| 2470 |
A :any:`DigitalOutputPowerDriver` can be used to control the power of a device |
| 2471 |
using a DigitalOutputDriver. |
| 2472 |
|
| 2473 |
Using this driver you probably want an external relay to switch the |
| 2474 |
power of your DUT. |
| 2475 |
|
| 2476 |
Binds to: |
| 2477 |
output: |
| 2478 |
- :any:`DigitalOutputProtocol` |
| 2479 |
|
| 2480 |
Implements: |
| 2481 |
- :any:`PowerProtocol` |
| 2482 |
- :any:`ResetProtocol` |
| 2483 |
|
| 2484 |
.. code-block:: yaml |
| 2485 |
|
| 2486 |
DigitalOutputPowerDriver: |
| 2487 |
delay: 2.0 |
| 2488 |
|
| 2489 |
Arguments: |
| 2490 |
- delay (float, default=1.0): delay in seconds between off and on |
| 2491 |
|
| 2492 |
USBPowerDriver |
| 2493 |
~~~~~~~~~~~~~~ |
| 2494 |
A :any:`USBPowerDriver` controls a `USBPowerPort`_, allowing control of the |
| 2495 |
target power state without user interaction. |
| 2496 |
|
| 2497 |
Binds to: |
| 2498 |
hub: |
| 2499 |
- `USBPowerPort`_ |
| 2500 |
- `NetworkUSBPowerPort`_ |
| 2501 |
|
| 2502 |
Implements: |
| 2503 |
- :any:`PowerProtocol` |
| 2504 |
- :any:`ResetProtocol` |
| 2505 |
|
| 2506 |
.. code-block:: yaml |
| 2507 |
|
| 2508 |
USBPowerDriver: |
| 2509 |
delay: 5.0 |
| 2510 |
|
| 2511 |
Arguments: |
| 2512 |
- delay (float, default=2.0): delay in seconds between off and on |
| 2513 |
|
| 2514 |
SiSPMPowerDriver |
| 2515 |
~~~~~~~~~~~~~~~~ |
| 2516 |
A :any:`SiSPMPowerDriver` controls a `SiSPMPowerPort`_, allowing control of the |
| 2517 |
target power state without user interaction. |
| 2518 |
|
| 2519 |
Binds to: |
| 2520 |
port: |
| 2521 |
- `SiSPMPowerPort`_ |
| 2522 |
- `NetworkSiSPMPowerPort`_ |
| 2523 |
|
| 2524 |
Implements: |
| 2525 |
- :any:`PowerProtocol` |
| 2526 |
- :any:`ResetProtocol` |
| 2527 |
|
| 2528 |
.. code-block:: yaml |
| 2529 |
|
| 2530 |
SiSPMPowerDriver: |
| 2531 |
delay: 5.0 |
| 2532 |
|
| 2533 |
Arguments: |
| 2534 |
- delay (float, default=2.0): delay in seconds between off and on |
| 2535 |
|
| 2536 |
TasmotaPowerDriver |
| 2537 |
~~~~~~~~~~~~~~~~~~ |
| 2538 |
A :any:`TasmotaPowerDriver` controls a `TasmotaPowerPort`_, allowing the outlet |
| 2539 |
to be switched on and off. |
| 2540 |
|
| 2541 |
Binds to: |
| 2542 |
power: |
| 2543 |
- `TasmotaPowerPort`_ |
| 2544 |
|
| 2545 |
Implements: |
| 2546 |
- :any:`PowerProtocol` |
| 2547 |
|
| 2548 |
.. code-block:: yaml |
| 2549 |
|
| 2550 |
TasmotaPowerDriver: |
| 2551 |
delay: 5.0 |
| 2552 |
|
| 2553 |
Arguments: |
| 2554 |
- delay (float, default=2.0): delay in seconds between off and on |
| 2555 |
|
| 2556 |
GpioDigitalOutputDriver |
| 2557 |
~~~~~~~~~~~~~~~~~~~~~~~ |
| 2558 |
The :any:`GpioDigitalOutputDriver` writes a digital signal to a GPIO line. |
| 2559 |
|
| 2560 |
This driver configures GPIO lines via |
| 2561 |
`the sysfs kernel interface <https://www.kernel.org/doc/html/latest/gpio/sysfs.html>`__. |
| 2562 |
While the driver automatically exports the GPIO, it does not configure it in |
| 2563 |
any other way than as an output. |
| 2564 |
|
| 2565 |
Binds to: |
| 2566 |
gpio: |
| 2567 |
- `SysfsGPIO`_ |
| 2568 |
- `MatchedSysfsGPIO`_ |
| 2569 |
- `NetworkSysfsGPIO`_ |
| 2570 |
|
| 2571 |
Implements: |
| 2572 |
- :any:`DigitalOutputProtocol` |
| 2573 |
|
| 2574 |
.. code-block:: yaml |
| 2575 |
|
| 2576 |
GpioDigitalOutputDriver: {} |
| 2577 |
|
| 2578 |
Arguments: |
| 2579 |
- None |
| 2580 |
|
| 2581 |
SerialPortDigitalOutputDriver |
| 2582 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 2583 |
The :any:`SerialPortDigitalOutputDriver` makes it possible to use a UART |
| 2584 |
as a 1-Bit general-purpose digital output. |
| 2585 |
|
| 2586 |
This driver acts on top of a SerialDriver and uses the its pyserial port to |
| 2587 |
control the flow control lines. |
| 2588 |
|
| 2589 |
Binds to: |
| 2590 |
serial: |
| 2591 |
- `SerialDriver`_ |
| 2592 |
|
| 2593 |
Implements: |
| 2594 |
- :any:`DigitalOutputProtocol` |
| 2595 |
|
| 2596 |
.. code-block:: yaml |
| 2597 |
|
| 2598 |
SerialPortDigitalOutputDriver: |
| 2599 |
signal: 'dtr' |
| 2600 |
invert: false |
| 2601 |
bindings: |
| 2602 |
serial: 'nameOfSerial' |
| 2603 |
|
| 2604 |
Arguments: |
| 2605 |
- signal (str): control signal to use: "dtr" or "rts" |
| 2606 |
- invert (bool): whether to invert the signal |
| 2607 |
- bindings (dict): optional, a named resource of the type SerialDriver to |
| 2608 |
bind against. This is only needed if you have multiple |
| 2609 |
SerialDriver in your environment (what is likely to be the case |
| 2610 |
if you are using this driver). |
| 2611 |
|
| 2612 |
FileDigitalOutputDriver |
| 2613 |
~~~~~~~~~~~~~~~~~~~~~~~ |
| 2614 |
The :any:`FileDigitalOutputDriver` uses a file |
| 2615 |
to write arbitrary string representations of booleans |
| 2616 |
to a file and read from it. |
| 2617 |
|
| 2618 |
The file is checked to exist at configuration time. |
| 2619 |
|
| 2620 |
If the file's content does not match any of the representations |
| 2621 |
reading defaults to False. |
| 2622 |
|
| 2623 |
A prime example for using this driver is Linux's sysfs. |
| 2624 |
|
| 2625 |
Binds to: |
| 2626 |
- None |
| 2627 |
|
| 2628 |
Implements: |
| 2629 |
- :any:`DigitalOutputProtocol` |
| 2630 |
|
| 2631 |
.. code-block:: yaml |
| 2632 |
|
| 2633 |
FileDigitalOutputDriver: |
| 2634 |
filepath: '/sys/class/leds/myled/brightness' |
| 2635 |
|
| 2636 |
Arguments: |
| 2637 |
- filepath (str): file that is used for reads and writes. |
| 2638 |
- false_repr (str, default="0\\n"): representation for False |
| 2639 |
- true_repr (str, default="1\\n"): representation for True |
| 2640 |
|
| 2641 |
DigitalOutputResetDriver |
| 2642 |
~~~~~~~~~~~~~~~~~~~~~~~~ |
| 2643 |
A :any:`DigitalOutputResetDriver` uses a DigitalOutput to reset the target. |
| 2644 |
|
| 2645 |
Binds to: |
| 2646 |
output: |
| 2647 |
- :any:`DigitalOutputProtocol` |
| 2648 |
|
| 2649 |
Implements: |
| 2650 |
- :any:`ResetProtocol` |
| 2651 |
|
| 2652 |
.. code-block:: yaml |
| 2653 |
|
| 2654 |
DigitalOutputResetDriver: |
| 2655 |
delay: 2.0 |
| 2656 |
|
| 2657 |
Arguments: |
| 2658 |
- delay (float, default=1.0): delay in seconds between setting the output 0 and 1. |
| 2659 |
|
| 2660 |
ModbusCoilDriver |
| 2661 |
~~~~~~~~~~~~~~~~ |
| 2662 |
A :any:`ModbusCoilDriver` controls a `ModbusTCPCoil`_ resource. |
| 2663 |
It can set and get the current state of the resource. |
| 2664 |
|
| 2665 |
Binds to: |
| 2666 |
coil: |
| 2667 |
- `ModbusTCPCoil`_ |
| 2668 |
|
| 2669 |
Implements: |
| 2670 |
- :any:`DigitalOutputProtocol` |
| 2671 |
|
| 2672 |
.. code-block:: yaml |
| 2673 |
|
| 2674 |
ModbusCoilDriver: {} |
| 2675 |
|
| 2676 |
Arguments: |
| 2677 |
- None |
| 2678 |
|
| 2679 |
WaveShareModbusCoilDriver |
| 2680 |
~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 2681 |
A :any:`WaveShareModbusCoilDriver` controls a `WaveshareModbusTCPCoil`_ resource. |
| 2682 |
It can set and get the current state of the resource. |
| 2683 |
|
| 2684 |
Binds to: |
| 2685 |
coil: |
| 2686 |
- `WaveshareModbusTCPCoil`_ |
| 2687 |
|
| 2688 |
Implements: |
| 2689 |
- :any:`DigitalOutputProtocol` |
| 2690 |
|
| 2691 |
.. code-block:: yaml |
| 2692 |
|
| 2693 |
WaveShareModbusCoilDriver: {} |
| 2694 |
|
| 2695 |
Arguments: |
| 2696 |
- None |
| 2697 |
|
| 2698 |
HIDRelayDriver |
| 2699 |
~~~~~~~~~~~~~~ |
| 2700 |
An :any:`HIDRelayDriver` controls an `HIDRelay`_ or `NetworkHIDRelay`_ resource. |
| 2701 |
It can set and get the current state of the resource. |
| 2702 |
|
| 2703 |
Binds to: |
| 2704 |
relay: |
| 2705 |
- `HIDRelay`_ |
| 2706 |
- `NetworkHIDRelay`_ |
| 2707 |
|
| 2708 |
Implements: |
| 2709 |
- :any:`DigitalOutputProtocol` |
| 2710 |
|
| 2711 |
.. code-block:: yaml |
| 2712 |
|
| 2713 |
HIDRelayDriver: {} |
| 2714 |
|
| 2715 |
Arguments: |
| 2716 |
- None |
| 2717 |
|
| 2718 |
ManualSwitchDriver |
| 2719 |
~~~~~~~~~~~~~~~~~~ |
| 2720 |
A :any:`ManualSwitchDriver` requires the user to control a switch or jumper on |
| 2721 |
the target. |
| 2722 |
This can be used if a driver binds to a :any:`DigitalOutputProtocol`, but no |
| 2723 |
automatic control is available. |
| 2724 |
|
| 2725 |
.. note:: |
| 2726 |
When using the ManualSwitchDriver with pytest, use ``-s``/``--capture=no`` to |
| 2727 |
prevent stdout capturing. |
| 2728 |
|
| 2729 |
Binds to: |
| 2730 |
- None |
| 2731 |
|
| 2732 |
Implements: |
| 2733 |
- :any:`DigitalOutputProtocol` |
| 2734 |
|
| 2735 |
.. code-block:: yaml |
| 2736 |
|
| 2737 |
ManualSwitchDriver: |
| 2738 |
description: 'Jumper 5' |
| 2739 |
|
| 2740 |
Arguments: |
| 2741 |
- description (str): optional, description of the switch or jumper on the target |
| 2742 |
|
| 2743 |
DeditecRelaisDriver |
| 2744 |
~~~~~~~~~~~~~~~~~~~ |
| 2745 |
A :any:`DeditecRelaisDriver` controls a *Deditec* relay resource. |
| 2746 |
It can set and get the current state of the resource. |
| 2747 |
|
| 2748 |
Binds to: |
| 2749 |
relais: |
| 2750 |
- `DeditecRelais8`_ |
| 2751 |
- `NetworkDeditecRelais8`_ |
| 2752 |
|
| 2753 |
Implements: |
| 2754 |
- :any:`DigitalOutputProtocol` |
| 2755 |
|
| 2756 |
.. code-block:: yaml |
| 2757 |
|
| 2758 |
DeditecRelaisDriver: {} |
| 2759 |
|
| 2760 |
Arguments: |
| 2761 |
- None |
| 2762 |
|
| 2763 |
MXSUSBDriver |
| 2764 |
~~~~~~~~~~~~ |
| 2765 |
An :any:`MXSUSBDriver` is used to upload an image into a device in the *MXS USB |
| 2766 |
loader state*. |
| 2767 |
This is useful to bootstrap a bootloader onto a device. |
| 2768 |
|
| 2769 |
Binds to: |
| 2770 |
loader: |
| 2771 |
- `MXSUSBLoader`_ |
| 2772 |
- `NetworkMXSUSBLoader`_ |
| 2773 |
|
| 2774 |
Implements: |
| 2775 |
- :any:`BootstrapProtocol` |
| 2776 |
|
| 2777 |
.. code-block:: yaml |
| 2778 |
|
| 2779 |
targets: |
| 2780 |
main: |
| 2781 |
drivers: |
| 2782 |
MXSUSBDriver: |
| 2783 |
image: 'mybootloaderkey' |
| 2784 |
|
| 2785 |
images: |
| 2786 |
mybootloaderkey: 'path/to/mybootloader.img' |
| 2787 |
|
| 2788 |
Arguments: |
| 2789 |
- image (str): optional, key in :ref:`images <labgrid-device-config-images>` containing the path |
| 2790 |
of an image to bootstrap onto the target |
| 2791 |
|
| 2792 |
IMXUSBDriver |
| 2793 |
~~~~~~~~~~~~ |
| 2794 |
An :any:`IMXUSBDriver` is used to upload an image into a device in the *i.MX |
| 2795 |
USB loader state*. |
| 2796 |
This is useful to bootstrap a bootloader onto a device. |
| 2797 |
This driver uses the ``imx-usb-loader`` tool from barebox. |
| 2798 |
If your device has the ``SDP_READ_DISABLE`` fuse burnt, then reading back data |
| 2799 |
over USB is not possible anymore, which means, that the verification of the |
| 2800 |
image is not possible anymore. Set ``verify`` to False in this case. |
| 2801 |
|
| 2802 |
Binds to: |
| 2803 |
loader: |
| 2804 |
- `IMXUSBLoader`_ |
| 2805 |
- `NetworkIMXUSBLoader`_ |
| 2806 |
- `MXSUSBLoader`_ |
| 2807 |
- `NetworkMXSUSBLoader`_ |
| 2808 |
|
| 2809 |
Implements: |
| 2810 |
- :any:`BootstrapProtocol` |
| 2811 |
|
| 2812 |
.. code-block:: yaml |
| 2813 |
|
| 2814 |
targets: |
| 2815 |
main: |
| 2816 |
drivers: |
| 2817 |
IMXUSBDriver: |
| 2818 |
image: 'mybootloaderkey' |
| 2819 |
verify: True |
| 2820 |
|
| 2821 |
images: |
| 2822 |
mybootloaderkey: 'path/to/mybootloader.img' |
| 2823 |
|
| 2824 |
Arguments: |
| 2825 |
- image (str): optional, key in :ref:`images <labgrid-device-config-images>` containing the path |
| 2826 |
of an image to bootstrap onto the target |
| 2827 |
- verify (bool, default=True): optional, wether to verify the written image or not |
| 2828 |
|
| 2829 |
BDIMXUSBDriver |
| 2830 |
~~~~~~~~~~~~~~ |
| 2831 |
The :any:`BDIMXUSBDriver` is used to upload bootloader images into an *i.MX |
| 2832 |
device* in the *USB SDP mode*. |
| 2833 |
This driver uses the ``imx_usb`` tool by Boundary Devices. |
| 2834 |
Compared to the ``imx-usb-loader``, it supports two-stage upload of U-Boot |
| 2835 |
images. |
| 2836 |
The images paths need to be specified from code instead of in the YAML |
| 2837 |
environment, as the correct image depends on the system state. |
| 2838 |
|
| 2839 |
Binds to: |
| 2840 |
loader: |
| 2841 |
- `IMXUSBLoader`_ |
| 2842 |
- `NetworkIMXUSBLoader`_ |
| 2843 |
|
| 2844 |
Implements: |
| 2845 |
- :any:`BootstrapProtocol` |
| 2846 |
|
| 2847 |
.. code-block:: yaml |
| 2848 |
|
| 2849 |
targets: |
| 2850 |
main: |
| 2851 |
drivers: |
| 2852 |
BDIMXUSBDriver: {} |
| 2853 |
|
| 2854 |
Arguments: |
| 2855 |
- None |
| 2856 |
|
| 2857 |
RKUSBDriver |
| 2858 |
~~~~~~~~~~~ |
| 2859 |
An :any:`RKUSBDriver` is used to upload an image into a device in the *Rockchip |
| 2860 |
USB loader state*. |
| 2861 |
This is useful to bootstrap a bootloader onto a device. |
| 2862 |
|
| 2863 |
Binds to: |
| 2864 |
loader: |
| 2865 |
- `RKUSBLoader`_ |
| 2866 |
- `NetworkRKUSBLoader`_ |
| 2867 |
|
| 2868 |
Implements: |
| 2869 |
- :any:`BootstrapProtocol` |
| 2870 |
|
| 2871 |
.. code-block:: yaml |
| 2872 |
|
| 2873 |
targets: |
| 2874 |
main: |
| 2875 |
drivers: |
| 2876 |
RKUSBDriver: |
| 2877 |
image: 'mybootloaderkey' |
| 2878 |
usb_loader: 'myloaderkey' |
| 2879 |
|
| 2880 |
images: |
| 2881 |
mybootloaderkey: 'path/to/mybootloader.img' |
| 2882 |
myloaderkey: 'path/to/myloader.bin' |
| 2883 |
|
| 2884 |
Arguments: |
| 2885 |
- image (str): optional, key in :ref:`images <labgrid-device-config-images>` containing the path |
| 2886 |
of an image to bootstrap onto the target |
| 2887 |
- usb_loader (str): optional, key in :ref:`images <labgrid-device-config-images>` containing the path |
| 2888 |
of a first-stage bootloader image to write |
| 2889 |
|
| 2890 |
UUUDriver |
| 2891 |
~~~~~~~~~ |
| 2892 |
A :any:`UUUDriver` is used to upload an image into a device in the *NXP USB |
| 2893 |
loader state*. |
| 2894 |
This is useful to bootstrap a bootloader onto a device. |
| 2895 |
|
| 2896 |
Binds to: |
| 2897 |
loader: |
| 2898 |
- `MXSUSBLoader`_ |
| 2899 |
- `NetworkMXSUSBLoader`_ |
| 2900 |
- `IMXUSBLoader`_ |
| 2901 |
- `NetworkIMXUSBLoader`_ |
| 2902 |
|
| 2903 |
Implements: |
| 2904 |
- :any:`BootstrapProtocol` |
| 2905 |
|
| 2906 |
.. code-block:: yaml |
| 2907 |
|
| 2908 |
targets: |
| 2909 |
main: |
| 2910 |
drivers: |
| 2911 |
UUUDriver: |
| 2912 |
image: 'mybootloaderkey' |
| 2913 |
script: 'spl' |
| 2914 |
|
| 2915 |
images: |
| 2916 |
mybootloaderkey: 'path/to/mybootloader.img' |
| 2917 |
|
| 2918 |
Arguments: |
| 2919 |
- image (str): optional, key in :ref:`images <labgrid-device-config-images>` containing the path |
| 2920 |
of an image to bootstrap onto the target |
| 2921 |
- script (str): optional, run built-in script with ``uuu -b``, called with image as arg0 |
| 2922 |
|
| 2923 |
USBStorageDriver |
| 2924 |
~~~~~~~~~~~~~~~~ |
| 2925 |
A :any:`USBStorageDriver` allows access to a USB stick or similar local or |
| 2926 |
remote device. |
| 2927 |
|
| 2928 |
Binds to: |
| 2929 |
storage: |
| 2930 |
- `USBMassStorage`_ |
| 2931 |
- `NetworkUSBMassStorage`_ |
| 2932 |
- `USBSDMuxDevice`_ |
| 2933 |
- `NetworkUSBSDMuxDevice`_ |
| 2934 |
- `USBSDWireDevice`_ |
| 2935 |
- `NetworkUSBSDWireDevice`_ |
| 2936 |
|
| 2937 |
Implements: |
| 2938 |
- None (yet) |
| 2939 |
|
| 2940 |
.. code-block:: yaml |
| 2941 |
|
| 2942 |
USBStorageDriver: |
| 2943 |
image: 'flashimage' |
| 2944 |
|
| 2945 |
.. code-block:: yaml |
| 2946 |
|
| 2947 |
images: |
| 2948 |
flashimage: '../images/myusb.image' |
| 2949 |
|
| 2950 |
Arguments: |
| 2951 |
- image (str): optional, key in :ref:`images <labgrid-device-config-images>` containing the path |
| 2952 |
of an image to write to the target |
| 2953 |
|
| 2954 |
OneWirePIODriver |
| 2955 |
~~~~~~~~~~~~~~~~ |
| 2956 |
A :any:`OneWirePIODriver` controls a `OneWirePIO`_ resource. |
| 2957 |
It can set and get the current state of the resource. |
| 2958 |
|
| 2959 |
Binds to: |
| 2960 |
port: |
| 2961 |
- `OneWirePIO`_ |
| 2962 |
|
| 2963 |
Implements: |
| 2964 |
- :any:`DigitalOutputProtocol` |
| 2965 |
|
| 2966 |
.. code-block:: yaml |
| 2967 |
|
| 2968 |
OneWirePIODriver: {} |
| 2969 |
|
| 2970 |
Arguments: |
| 2971 |
- None |
| 2972 |
|
| 2973 |
TFTPProviderDriver |
| 2974 |
~~~~~~~~~~~~~~~~~~ |
| 2975 |
The :any:`TFTPProviderDriver` controls its corresponding TFTP resource, either |
| 2976 |
locally or remotely. |
| 2977 |
|
| 2978 |
Binds to: |
| 2979 |
provider: |
| 2980 |
- `TFTPProvider`_ |
| 2981 |
- `RemoteTFTPProvider`_ |
| 2982 |
|
| 2983 |
Implements: |
| 2984 |
- None (yet) |
| 2985 |
|
| 2986 |
.. code-block:: yaml |
| 2987 |
|
| 2988 |
TFTPProviderDriver: {} |
| 2989 |
|
| 2990 |
Arguments: |
| 2991 |
- None |
| 2992 |
|
| 2993 |
The driver can be used in test cases by calling its ``stage()`` method, which |
| 2994 |
returns the path to be used by the target. |
| 2995 |
|
| 2996 |
HTTPProviderDriver |
| 2997 |
~~~~~~~~~~~~~~~~~~ |
| 2998 |
The :any:`HTTPProviderDriver` controls its corresponding HTTP resource, either |
| 2999 |
locally or remotely. |
| 3000 |
|
| 3001 |
Binds to: |
| 3002 |
provider: |
| 3003 |
- `HTTPProvider`_ |
| 3004 |
- `RemoteHTTPProvider`_ |
| 3005 |
|
| 3006 |
Implements: |
| 3007 |
- None (yet) |
| 3008 |
|
| 3009 |
.. code-block:: yaml |
| 3010 |
|
| 3011 |
HTTPProviderDriver: {} |
| 3012 |
|
| 3013 |
Arguments: |
| 3014 |
- None |
| 3015 |
|
| 3016 |
The driver can be used in test cases by calling its ``stage()`` method, which |
| 3017 |
returns the path to be used by the target. |
| 3018 |
|
| 3019 |
NFSProviderDriver |
| 3020 |
~~~~~~~~~~~~~~~~~ |
| 3021 |
An :any:`NFSProviderDriver` controls an `NFSProvider`_ resource. |
| 3022 |
|
| 3023 |
Binds to: |
| 3024 |
provider: |
| 3025 |
- `NFSProvider`_ |
| 3026 |
- `RemoteNFSProvider`_ |
| 3027 |
|
| 3028 |
Implements: |
| 3029 |
- None (yet) |
| 3030 |
|
| 3031 |
.. code-block:: yaml |
| 3032 |
|
| 3033 |
NFSProviderDriver: {} |
| 3034 |
|
| 3035 |
Arguments: |
| 3036 |
- None |
| 3037 |
|
| 3038 |
The driver can be used in test cases by calling its ``stage()`` method, which |
| 3039 |
returns an NFSFile object with ``host``, ``export`` and ``relative_file_path`` |
| 3040 |
attributes. |
| 3041 |
|
| 3042 |
QEMUDriver |
| 3043 |
~~~~~~~~~~ |
| 3044 |
The :any:`QEMUDriver` allows the usage of a QEMU instance as a target. |
| 3045 |
It requires several arguments, listed below. |
| 3046 |
The kernel, flash, rootfs and dtb arguments refer to images and paths declared |
| 3047 |
in the environment configuration. |
| 3048 |
|
| 3049 |
Binds to: |
| 3050 |
- None |
| 3051 |
|
| 3052 |
.. code-block:: yaml |
| 3053 |
|
| 3054 |
QEMUDriver: |
| 3055 |
qemu_bin: 'qemu_arm' |
| 3056 |
machine: 'vexpress-a9' |
| 3057 |
cpu: 'cortex-a9' |
| 3058 |
memory: '512M' |
| 3059 |
boot_args: 'root=/dev/root console=ttyAMA0,115200' |
| 3060 |
extra_args: '' |
| 3061 |
kernel: 'kernel' |
| 3062 |
rootfs: 'rootfs' |
| 3063 |
dtb: 'dtb' |
| 3064 |
nic: 'user' |
| 3065 |
|
| 3066 |
.. code-block:: yaml |
| 3067 |
|
| 3068 |
tools: |
| 3069 |
qemu_arm: '/bin/qemu-system-arm' |
| 3070 |
paths: |
| 3071 |
rootfs: '../images/root' |
| 3072 |
images: |
| 3073 |
dtb: '../images/mydtb.dtb' |
| 3074 |
kernel: '../images/vmlinuz' |
| 3075 |
|
| 3076 |
Implements: |
| 3077 |
- :any:`ConsoleProtocol` |
| 3078 |
- :any:`PowerProtocol` |
| 3079 |
|
| 3080 |
Arguments: |
| 3081 |
- qemu_bin (str): reference to the tools key for the QEMU binary |
| 3082 |
- machine (str): QEMU machine type |
| 3083 |
- cpu (str): QEMU cpu type |
| 3084 |
- memory (str): QEMU memory size (ends with M or G) |
| 3085 |
- extra_args (str): optional, extra QEMU arguments, they are passed directly to the QEMU binary |
| 3086 |
- boot_args (str): optional, additional kernel boot argument |
| 3087 |
- kernel (str): optional, reference to the images key for the kernel |
| 3088 |
- disk (str): optional, reference to the images key for the disk image |
| 3089 |
- disk_opts (str): optional, additional QEMU disk options |
| 3090 |
- flash (str): optional, reference to the images key for the flash image |
| 3091 |
- rootfs (str): optional, reference to the paths key for use as the virtio-9p filesystem |
| 3092 |
- dtb (str): optional, reference to the image key for the device tree |
| 3093 |
- bios (str): optional, reference to the image key for the bios image |
| 3094 |
- display (str, default="none"): display output to enable; must be one of: |
| 3095 |
|
| 3096 |
- none: Do not create a display device |
| 3097 |
- fb-headless: Create a headless framebuffer device |
| 3098 |
- egl-headless: Create a headless GPU-backed graphics card. Requires host support |
| 3099 |
- qemu-default: Don't override QEMU default settings |
| 3100 |
|
| 3101 |
- nic (str): optional, configuration string to pass to QEMU to create a network interface |
| 3102 |
|
| 3103 |
The QEMUDriver also requires the specification of: |
| 3104 |
|
| 3105 |
- a tool key, this contains the path to the QEMU binary |
| 3106 |
- an image key, the path to the kernel image and optionally the dtb key to |
| 3107 |
specify the build device tree |
| 3108 |
- a path key, this is the path to the rootfs |
| 3109 |
|
| 3110 |
SigrokDriver |
| 3111 |
~~~~~~~~~~~~ |
| 3112 |
The :any:`SigrokDriver` uses a `SigrokDevice`_ resource to record samples and provides |
| 3113 |
them during test runs. |
| 3114 |
|
| 3115 |
Binds to: |
| 3116 |
sigrok: |
| 3117 |
- `SigrokUSBDevice`_ |
| 3118 |
- `NetworkSigrokUSBDevice`_ |
| 3119 |
- `SigrokDevice`_ |
| 3120 |
|
| 3121 |
Implements: |
| 3122 |
- None yet |
| 3123 |
|
| 3124 |
Arguments: |
| 3125 |
- None |
| 3126 |
|
| 3127 |
The driver can be used in test cases by calling its ``capture()``, ``stop()`` |
| 3128 |
and ``analyze()`` methods. |
| 3129 |
|
| 3130 |
SigrokPowerDriver |
| 3131 |
~~~~~~~~~~~~~~~~~ |
| 3132 |
The :any:`SigrokPowerDriver` uses a `SigrokUSBSerialDevice`_ resource to |
| 3133 |
control a programmable power supply. |
| 3134 |
|
| 3135 |
Binds to: |
| 3136 |
sigrok: |
| 3137 |
- `SigrokUSBSerialDevice`_ |
| 3138 |
- `NetworkSigrokUSBSerialDevice`_ |
| 3139 |
|
| 3140 |
Implements: |
| 3141 |
- :any:`PowerProtocol` |
| 3142 |
- :any:`ResetProtocol` |
| 3143 |
|
| 3144 |
.. code-block:: yaml |
| 3145 |
|
| 3146 |
SigrokPowerDriver: |
| 3147 |
delay: 3.0 |
| 3148 |
|
| 3149 |
Arguments: |
| 3150 |
- delay (float, default=3.0): delay in seconds between off and on |
| 3151 |
- max_voltage (float): optional, maximum allowed voltage for protection against |
| 3152 |
accidental damage (in volts) |
| 3153 |
- max_current (float): optional, maximum allowed current for protection against |
| 3154 |
accidental damage (in ampere) |
| 3155 |
|
| 3156 |
SigrokDmmDriver |
| 3157 |
~~~~~~~~~~~~~~~ |
| 3158 |
The :any:`SigrokDmmDriver` uses a `SigrokDevice`_ resource to record samples |
| 3159 |
from a *digital multimeter* (DMM) and provides them during test runs. |
| 3160 |
|
| 3161 |
It is known to work with *Unit-T UT61B* and *UT61C* devices but should also |
| 3162 |
work with other DMMs supported by *Sigrok*. |
| 3163 |
|
| 3164 |
Binds to: |
| 3165 |
sigrok: |
| 3166 |
- `SigrokUSBDevice`_ |
| 3167 |
- `NetworkSigrokUSBDevice`_ |
| 3168 |
- `SigrokUSBSerialDevice`_ |
| 3169 |
- `NetworkSigrokUSBSerialDevice`_ |
| 3170 |
|
| 3171 |
Implements: |
| 3172 |
- None yet |
| 3173 |
|
| 3174 |
Arguments: |
| 3175 |
- None |
| 3176 |
|
| 3177 |
Sampling can be started calling ``capture(samples, timeout=None)``. |
| 3178 |
It sets up sampling and returns immediately. |
| 3179 |
The default timeout has been chosen to work with *Unit-T UT61B*. |
| 3180 |
Other devices may require a different timeout setting. |
| 3181 |
|
| 3182 |
Samples can be obtained using ``stop()``. |
| 3183 |
``stop()`` will block until either *sigrok* terminates or *timeout* is reached. |
| 3184 |
This method returns a ``(unit, samples)`` tuple: |
| 3185 |
``unit`` is the physical unit reported by the DMM; |
| 3186 |
samples is an iterable of samples. |
| 3187 |
|
| 3188 |
This driver relies on buffering of the subprocess call. |
| 3189 |
Reading a few samples will very likely work - but obtaining a lot of samples may stall. |
| 3190 |
|
| 3191 |
USBSDMuxDriver |
| 3192 |
~~~~~~~~~~~~~~ |
| 3193 |
The :any:`USBSDMuxDriver` uses a `USBSDMuxDevice`_ resource to control a |
| 3194 |
USB-SD-Mux device via `usbsdmux <https://github.com/pengutronix/usbsdmux>`_ |
| 3195 |
tool. |
| 3196 |
|
| 3197 |
Binds to: |
| 3198 |
mux: |
| 3199 |
- `USBSDMuxDevice`_ |
| 3200 |
- `NetworkUSBSDMuxDevice`_ |
| 3201 |
|
| 3202 |
Implements: |
| 3203 |
- None yet |
| 3204 |
|
| 3205 |
Arguments: |
| 3206 |
- None |
| 3207 |
|
| 3208 |
The driver can be used in test cases by calling its ``set_mode()`` method with |
| 3209 |
argument being "dut", "host", "off", or "client". |
| 3210 |
|
| 3211 |
LXAUSBMuxDriver |
| 3212 |
~~~~~~~~~~~~~~~ |
| 3213 |
The :any:`LXAUSBMuxDriver` uses an `LXAUSBMux`_ resource to control a USB-Mux |
| 3214 |
device via the `usbmuxctl <https://github.com/linux-automation/usbmuxctl>`_ |
| 3215 |
tool. |
| 3216 |
|
| 3217 |
Binds to: |
| 3218 |
mux: |
| 3219 |
- `LXAUSBMux`_ |
| 3220 |
- `NetworkLXAUSBMux`_ |
| 3221 |
|
| 3222 |
Implements: |
| 3223 |
- None yet |
| 3224 |
|
| 3225 |
Arguments: |
| 3226 |
- None |
| 3227 |
|
| 3228 |
The driver can be used in test cases by calling its ``set_links()`` method with |
| 3229 |
a list containing one or more of "dut-device", "host-dut" and "host-device". |
| 3230 |
Not all combinations can be configured at the same time. |
| 3231 |
|
| 3232 |
USBSDWireDriver |
| 3233 |
~~~~~~~~~~~~~~~ |
| 3234 |
The :any:`USBSDWireDriver` uses a `USBSDWireDevice`_ resource to control a |
| 3235 |
USB-SD-Wire device via `sd-mux-ctrl <https://web.archive.org/web/20220812002642/https://wiki.tizen.org/SD_MUX#Software>`_ |
| 3236 |
tool. |
| 3237 |
|
| 3238 |
Binds to: |
| 3239 |
mux: |
| 3240 |
- `USBSDWireDevice`_ |
| 3241 |
- `NetworkUSBSDWireDevice`_ |
| 3242 |
|
| 3243 |
Implements: |
| 3244 |
- None yet |
| 3245 |
|
| 3246 |
Arguments: |
| 3247 |
- None |
| 3248 |
|
| 3249 |
The driver can be used in test cases by calling its ``set_mode()`` method with |
| 3250 |
argument being "dut", "host", "off", or "client". |
| 3251 |
|
| 3252 |
USBSDWire3Driver |
| 3253 |
~~~~~~~~~~~~~~~~ |
| 3254 |
The :any:`USBSDWire3Driver` uses a `USBSDWire3Device`_ resource to control a |
| 3255 |
USB-SD-Wire3 device via `sdwire <https://github.com/Badger-Embedded/sdwire-cli>`_ |
| 3256 |
tool. |
| 3257 |
|
| 3258 |
Binds to: |
| 3259 |
mux: |
| 3260 |
- `USBSDWire3Device`_ |
| 3261 |
- `NetworkUSBSDWire3Device`_ |
| 3262 |
|
| 3263 |
Implements: |
| 3264 |
- None yet |
| 3265 |
|
| 3266 |
Arguments: |
| 3267 |
- None |
| 3268 |
|
| 3269 |
USBVideoDriver |
| 3270 |
~~~~~~~~~~~~~~ |
| 3271 |
The :any:`USBVideoDriver` is used to show a video stream from a remote USB |
| 3272 |
video camera in a local window. |
| 3273 |
It uses the GStreamer command line utility ``gst-launch`` on both sides to |
| 3274 |
stream the video via an SSH connection to the exporter. |
| 3275 |
|
| 3276 |
Binds to: |
| 3277 |
video: |
| 3278 |
- `USBVideo`_ |
| 3279 |
- `NetworkUSBVideo`_ |
| 3280 |
|
| 3281 |
Implements: |
| 3282 |
- :any:`VideoProtocol` |
| 3283 |
|
| 3284 |
Arguments: |
| 3285 |
- None |
| 3286 |
|
| 3287 |
Although the driver can be used from Python code by calling the ``stream()`` |
| 3288 |
method, it is currently mainly useful for the ``video`` subcommand of |
| 3289 |
``labgrid-client``. |
| 3290 |
It supports the *Logitech HD Pro Webcam C920* with the USB ID ``046d:082d`` and a |
| 3291 |
few others. |
| 3292 |
More cameras can be added to ``get_qualities()`` and ``get_pipeline()`` in |
| 3293 |
``labgrid/driver/usbvideodriver.py``. |
| 3294 |
Appropriate configuration parameters can be determined by using the GStreamer |
| 3295 |
``gst-device-monitor-1.0`` command line utility. |
| 3296 |
|
| 3297 |
USBAudioInputDriver |
| 3298 |
~~~~~~~~~~~~~~~~~~~ |
| 3299 |
The :any:`USBAudioInputDriver` is used to receive an audio stream from a local |
| 3300 |
or remote USB audio input. |
| 3301 |
It uses the GStreamer command line utility ``gst-launch`` on the sender side to |
| 3302 |
stream the audio to the client. |
| 3303 |
For remote resources, this is done via an SSH connection to the exporter. |
| 3304 |
On the receiver, it either uses ``gst-launch`` for simple playback or |
| 3305 |
`gst-python <https://gitlab.freedesktop.org/gstreamer/gst-python>`_ for more |
| 3306 |
complex cases (such as measuring the current volume level). |
| 3307 |
|
| 3308 |
Binds to: |
| 3309 |
res: |
| 3310 |
- `USBAudioInput`_ |
| 3311 |
- `NetworkUSBAudioInput`_ |
| 3312 |
|
| 3313 |
Implements: |
| 3314 |
- None yet |
| 3315 |
|
| 3316 |
Arguments: |
| 3317 |
- None |
| 3318 |
|
| 3319 |
USBTMCDriver |
| 3320 |
~~~~~~~~~~~~ |
| 3321 |
The :any:`USBTMCDriver` is used to control an oscilloscope via the *USB TMC |
| 3322 |
protocol*. |
| 3323 |
|
| 3324 |
Binds to: |
| 3325 |
tmc: |
| 3326 |
- `USBTMC`_ |
| 3327 |
- `NetworkUSBTMC`_ |
| 3328 |
|
| 3329 |
Implements: |
| 3330 |
- None yet |
| 3331 |
|
| 3332 |
Arguments: |
| 3333 |
- None |
| 3334 |
|
| 3335 |
Currently, it can be used by the ``labgrid-client`` ``tmc`` subcommands to show |
| 3336 |
(and save) a screenshot, to show per channel measurements and to execute raw |
| 3337 |
TMC commands. |
| 3338 |
It only supports the *Keysight DSO-X 2000* series (with the USB ID ``0957:1798``), |
| 3339 |
but more devices can be added by extending ``on_activate()`` in |
| 3340 |
``labgrid/driver/usbtmcdriver.py`` and writing a corresponding backend in |
| 3341 |
``labgrid/driver/usbtmc/``. |
| 3342 |
|
| 3343 |
FlashromDriver |
| 3344 |
~~~~~~~~~~~~~~ |
| 3345 |
The :any:`FlashromDriver` is used to flash a ROM, using the flashrom utility. |
| 3346 |
|
| 3347 |
.. code-block:: yaml |
| 3348 |
|
| 3349 |
FlashromDriver: |
| 3350 |
image: 'foo' |
| 3351 |
|
| 3352 |
.. code-block:: yaml |
| 3353 |
|
| 3354 |
images: |
| 3355 |
foo: '../images/image_to_load.raw' |
| 3356 |
|
| 3357 |
Binds to: |
| 3358 |
flashrom_resource: |
| 3359 |
- `Flashrom`_ |
| 3360 |
- `NetworkFlashrom`_ |
| 3361 |
|
| 3362 |
Implements: |
| 3363 |
- :any:`BootstrapProtocol` |
| 3364 |
|
| 3365 |
Arguments: |
| 3366 |
- image (str): optional, key in :ref:`images <labgrid-device-config-images>` containing the path |
| 3367 |
of an image to bootstrap onto the target |
| 3368 |
|
| 3369 |
The FlashromDriver allows using the linux util "flashrom" to write directly to a ROM e.g. a NOR SPI |
| 3370 |
flash. The assumption is that the device flashing the DUT e.g. an exporter is wired to the Flash |
| 3371 |
to be flashed. The driver implements the bootstrap protocol. |
| 3372 |
The driver uses tool configuration section and the key: flashrom to determine the path of the |
| 3373 |
installed flashrom utility. |
| 3374 |
|
| 3375 |
FlashScriptDriver |
| 3376 |
~~~~~~~~~~~~~~~~~ |
| 3377 |
The :any:`FlashScriptDriver` is used to run a custom script or program to flash |
| 3378 |
a device. |
| 3379 |
|
| 3380 |
.. note:: |
| 3381 |
This driver is only intended to be used as a last resort when it is |
| 3382 |
impossible or impractical to use a different driver. |
| 3383 |
|
| 3384 |
.. code-block:: yaml |
| 3385 |
|
| 3386 |
FlashScriptDriver: |
| 3387 |
script: 'foo' |
| 3388 |
args: |
| 3389 |
- '{device.devnode}' |
| 3390 |
|
| 3391 |
.. code-block:: yaml |
| 3392 |
|
| 3393 |
images: |
| 3394 |
foo: '../images/flash_device.sh' |
| 3395 |
|
| 3396 |
Binds to: |
| 3397 |
device: |
| 3398 |
- `USBFlashableDevice`_ |
| 3399 |
- `NetworkUSBFlashableDevice`_ |
| 3400 |
|
| 3401 |
Implements: |
| 3402 |
- None (yet) |
| 3403 |
|
| 3404 |
Arguments: |
| 3405 |
- script (str): optional, key in :ref:`images <labgrid-device-config-images>` |
| 3406 |
containing the script to execute for writing of the flashable device |
| 3407 |
- args (list of str): optional, list of arguments for flash script execution |
| 3408 |
|
| 3409 |
The FlashScriptDriver allows running arbitrary programs to flash a device. |
| 3410 |
Some SoC or devices may require custom, one-off, or proprietary programs to |
| 3411 |
flash. |
| 3412 |
A target image can be bundled with these programs using a tool like `makeself |
| 3413 |
<https://makeself.io/>`_, |
| 3414 |
which can then be executed by labgrid to flash the device using this driver. |
| 3415 |
|
| 3416 |
Additional arguments may be passed with the ``args`` parameter. |
| 3417 |
These arguments will be expanded as `Python format strings |
| 3418 |
<https://docs.python.org/3/library/string.html#format-string-syntax>`_ with the |
| 3419 |
following keys: |
| 3420 |
|
| 3421 |
HTTPVideoDriver |
| 3422 |
~~~~~~~~~~~~~~~ |
| 3423 |
The :any:`HTTPVideoDriver` is used to show a video stream over HTTP or HTTPS |
| 3424 |
from a remote IP video source in a local window. |
| 3425 |
|
| 3426 |
Binds to: |
| 3427 |
video: |
| 3428 |
- `HTTPVideoStream`_ |
| 3429 |
|
| 3430 |
Implements: |
| 3431 |
- :any:`VideoProtocol` |
| 3432 |
|
| 3433 |
Arguments: |
| 3434 |
- None |
| 3435 |
|
| 3436 |
Although the driver can be used from Python code by calling the ``stream()`` |
| 3437 |
method, it is currently mainly useful for the ``video`` subcommand of |
| 3438 |
``labgrid-client``. |
| 3439 |
|
| 3440 |
========== ========================================================= |
| 3441 |
Key Description |
| 3442 |
========== ========================================================= |
| 3443 |
``device`` The :any:`Resource` bound to the driver |
| 3444 |
``file`` The :any:`ManagedFile` used to track the flashable script |
| 3445 |
========== ========================================================= |
| 3446 |
|
| 3447 |
Properties of these keys can be selected using the Python format string syntax, |
| 3448 |
e.g. ``{device.devnode}`` to select the device node path of a |
| 3449 |
:any:`USBFlashableDevice`. |
| 3450 |
|
| 3451 |
DediprogFlashDriver |
| 3452 |
~~~~~~~~~~~~~~~~~~~ |
| 3453 |
The :any:`DediprogFlashDriver` is used to flash an SPI device using DediprogFlasher dpcmd. |
| 3454 |
|
| 3455 |
.. code-block:: yaml |
| 3456 |
|
| 3457 |
DediprogFlashDriver: |
| 3458 |
image: 'foo' |
| 3459 |
|
| 3460 |
.. code-block:: yaml |
| 3461 |
|
| 3462 |
images: |
| 3463 |
foo: '../images/image_to_load.raw' |
| 3464 |
|
| 3465 |
Binds to: |
| 3466 |
flasher: |
| 3467 |
- `DediprogFlasher`_ |
| 3468 |
- `NetworkDediprogFlasher`_ |
| 3469 |
|
| 3470 |
Implements: |
| 3471 |
- None (yet) |
| 3472 |
|
| 3473 |
Arguments: |
| 3474 |
- image (str): optional, key in :ref:`images <labgrid-device-config-images>` containing the path |
| 3475 |
of an image to flash onto the target |
| 3476 |
|
| 3477 |
The DediprogFlashDriver allows using DediprogFlasher dpcmd to flash or erase SPI |
| 3478 |
devices. It is assumed that the device flashing is an exporter wired, via a |
| 3479 |
*Dediprog SF100 SPI NOR Flash Programmer* for instance, to the device being |
| 3480 |
flashed. |
| 3481 |
|
| 3482 |
XenaDriver |
| 3483 |
~~~~~~~~~~ |
| 3484 |
The :any:`XenaDriver` allows to use Xena networking test equipment. |
| 3485 |
Using the ``xenavalkyrie`` library a full API to control the tester is available. |
| 3486 |
|
| 3487 |
Binds to: |
| 3488 |
xena_manager: |
| 3489 |
- `XenaManager`_ |
| 3490 |
|
| 3491 |
The driver is supposed to work with all Xena products from the "Valkyrie Layer 2-3 Test platform" |
| 3492 |
Currently tested on a *XenaCompact* chassis equipped with a *1 GE test module*. |
| 3493 |
|
| 3494 |
DockerDriver |
| 3495 |
~~~~~~~~~~~~ |
| 3496 |
A :any:`DockerDriver` binds to a `DockerDaemon`_ and is used to create and |
| 3497 |
control one docker container. |
| 3498 |
|
| 3499 |
| The driver uses the docker python module to interact with the docker daemon. |
| 3500 |
| For more information on the parameters see: |
| 3501 |
| https://docker-py.readthedocs.io/en/stable/containers.html#container-objects |
| 3502 |
|
| 3503 |
Binds to: |
| 3504 |
docker_daemon: |
| 3505 |
- `DockerDaemon`_ |
| 3506 |
|
| 3507 |
Implements: |
| 3508 |
- :any:`PowerProtocol` |
| 3509 |
|
| 3510 |
.. code-block:: yaml |
| 3511 |
|
| 3512 |
DockerDriver: |
| 3513 |
image_uri: 'rastasheep/ubuntu-sshd:16.04' |
| 3514 |
pull: 'always' |
| 3515 |
container_name: 'ubuntu-lg-example' |
| 3516 |
host_config: {'network_mode': 'bridge'} |
| 3517 |
network_services: [{'port': 22, 'username': 'root', 'password': 'root'}] |
| 3518 |
|
| 3519 |
Arguments: |
| 3520 |
- image_uri (str): identifier of the docker image to use (may have a tag suffix) |
| 3521 |
- pull (str): pull policy, supports "always", "missing", "never". Default is |
| 3522 |
"always" |
| 3523 |
|
| 3524 |
- always: Always pull the image and throw an error if the pull fails. |
| 3525 |
- missing: Pull the image only when the image is not in the local |
| 3526 |
containers storage. Throw an error if no image is found and the pull |
| 3527 |
fails. |
| 3528 |
- never: Never pull the image but use the one from the local containers |
| 3529 |
storage. Throw a ``docker.errors.ImageNotFound`` if no image is found. |
| 3530 |
|
| 3531 |
- command (str): optional, command to run in the container (depends on image) |
| 3532 |
- volumes (list): optional, list to configure volumes mounted inside the container |
| 3533 |
- container_name (str): name of the container |
| 3534 |
- environment (list): optional, list of environment variables |
| 3535 |
- host_config (dict): dictionary of host configurations |
| 3536 |
- network_services (list): dictionaries that describe individual `NetworkService`_ |
| 3537 |
instances that come alive when the container is created. The "address" argument |
| 3538 |
which `NetworkService`_ also requires will be derived automatically upon container |
| 3539 |
creation. |
| 3540 |
|
| 3541 |
LXAIOBusPIODriver |
| 3542 |
~~~~~~~~~~~~~~~~~ |
| 3543 |
An :any:`LXAIOBusPIODriver` binds to a single `LXAIOBusPIO`_ to toggle and read |
| 3544 |
the PIO states. |
| 3545 |
|
| 3546 |
Binds to: |
| 3547 |
pio: |
| 3548 |
- `LXAIOBusPIO`_ |
| 3549 |
- `NetworkLXAIOBusPIO`_ |
| 3550 |
|
| 3551 |
.. code-block:: yaml |
| 3552 |
|
| 3553 |
LXAIOBusPIODriver: {} |
| 3554 |
|
| 3555 |
Implements: |
| 3556 |
- :any:`DigitalOutputProtocol` |
| 3557 |
|
| 3558 |
Arguments: |
| 3559 |
- None |
| 3560 |
|
| 3561 |
HttpDigitalOutputDriver |
| 3562 |
~~~~~~~~~~~~~~~~~~~~~~~ |
| 3563 |
A :any:`HttpDigitalOutputDriver` binds to an `HttpDigitalOutput`_ to set and |
| 3564 |
get a digital output state via HTTP. |
| 3565 |
|
| 3566 |
Binds to: |
| 3567 |
http: |
| 3568 |
- `HttpDigitalOutput`_ |
| 3569 |
|
| 3570 |
.. code-block:: yaml |
| 3571 |
|
| 3572 |
HttpDigitalOutputDriver: {} |
| 3573 |
|
| 3574 |
Implements: |
| 3575 |
- :any:`DigitalOutputProtocol` |
| 3576 |
|
| 3577 |
Arguments: |
| 3578 |
- None |
| 3579 |
|
| 3580 |
Eth008DigitalOutputDriver |
| 3581 |
~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 3582 |
A :any:`Eth008DigitalOutputDriver` binds to an `Eth008DigitalOutput`_ to set |
| 3583 |
and get a digital output state on a Robot-Electronics eth008 relay board. |
| 3584 |
|
| 3585 |
Binds to: |
| 3586 |
output: |
| 3587 |
- `Eth008DigitalOutput`_ |
| 3588 |
|
| 3589 |
.. code-block:: yaml |
| 3590 |
|
| 3591 |
Eth008DigitalOutputDriver: {} |
| 3592 |
|
| 3593 |
Implements: |
| 3594 |
- :any:`DigitalOutputProtocol` |
| 3595 |
|
| 3596 |
Arguments: |
| 3597 |
- None |
| 3598 |
|
| 3599 |
PyVISADriver |
| 3600 |
~~~~~~~~~~~~ |
| 3601 |
The :any:`PyVISADriver` uses a `PyVISADevice`_ resource to control test |
| 3602 |
equipment manageable by PyVISA. |
| 3603 |
|
| 3604 |
Binds to: |
| 3605 |
pyvisa_resource: |
| 3606 |
- `PyVISADevice`_ |
| 3607 |
|
| 3608 |
Implements: |
| 3609 |
- None yet |
| 3610 |
|
| 3611 |
Arguments: |
| 3612 |
- None |
| 3613 |
|
| 3614 |
NetworkInterfaceDriver |
| 3615 |
~~~~~~~~~~~~~~~~~~~~~~ |
| 3616 |
The :any:`NetworkInterfaceDriver` allows controlling a network interface (such |
| 3617 |
as Ethernet or WiFi) on the exporter using NetworkManager. |
| 3618 |
|
| 3619 |
The configuration is based on dictionaries with contents similar to NM's |
| 3620 |
connection files in INI-format. |
| 3621 |
Currently basic wired and wireless configuration options have been tested. |
| 3622 |
|
| 3623 |
To use it, `PyGObject <https://pygobject.readthedocs.io/>`_ must be installed |
| 3624 |
(on the same system as the network interface). |
| 3625 |
For Debian, the necessary packages are ``python3-gi`` and ``gir1.2-nm-1.0``. |
| 3626 |
|
| 3627 |
It supports: |
| 3628 |
|
| 3629 |
- static and DHCP address configuration |
| 3630 |
- WiFi client or AP |
| 3631 |
- connection sharing (DHCP server with NAT) |
| 3632 |
- listing DHCP leases (if the client has sufficient permissions) |
| 3633 |
|
| 3634 |
Binds to: |
| 3635 |
iface: |
| 3636 |
- `NetworkInterface`_ |
| 3637 |
- `RemoteNetworkInterface`_ |
| 3638 |
- `USBNetworkInterface`_ |
| 3639 |
|
| 3640 |
Implements: |
| 3641 |
- None yet |
| 3642 |
|
| 3643 |
Arguments: |
| 3644 |
- None |
| 3645 |
|
| 3646 |
RawNetworkInterfaceDriver |
| 3647 |
~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 3648 |
The :any:`RawNetworkInterfaceDriver` allows "raw" control of a network |
| 3649 |
interface (such as Ethernet or WiFi). |
| 3650 |
|
| 3651 |
The labgrid-raw-interface helper (``helpers/labgrid-raw-interface``) needs to |
| 3652 |
be installed in the PATH and usable via sudo without password. |
| 3653 |
A configuration file ``/etc/labgrid/helpers.yaml`` must be installed on hosts |
| 3654 |
exporting network interfaces for the RawNetworkInterfaceDriver, e.g.: |
| 3655 |
|
| 3656 |
.. code-block:: yaml |
| 3657 |
|
| 3658 |
raw-interface: |
| 3659 |
denied-interfaces: |
| 3660 |
- 'eth1' |
| 3661 |
|
| 3662 |
It supports: |
| 3663 |
|
| 3664 |
- recording traffic |
| 3665 |
- replaying traffic |
| 3666 |
- basic statistic collection |
| 3667 |
|
| 3668 |
For now, the RawNetworkInterfaceDriver leaves pre-configuration of the exported |
| 3669 |
network interface to the user, including: |
| 3670 |
|
| 3671 |
- disabling DHCP |
| 3672 |
- disabling IPv6 Duplicate Address Detection (DAD) by SLAAC (Stateless |
| 3673 |
Address Autoconfiguration) and Neighbor Discovery |
| 3674 |
- disabling Generic Receive Offload (GRO) |
| 3675 |
|
| 3676 |
This might change in the future. If you do not want the driver to automatically |
| 3677 |
manage the interface (e.g. you are managing it externally), set |
| 3678 |
``manage_interface`` to ``False``. |
| 3679 |
|
| 3680 |
Binds to: |
| 3681 |
iface: |
| 3682 |
- `NetworkInterface`_ |
| 3683 |
- `RemoteNetworkInterface`_ |
| 3684 |
- `USBNetworkInterface`_ |
| 3685 |
|
| 3686 |
Implements: |
| 3687 |
- None yet |
| 3688 |
|
| 3689 |
Arguments: |
| 3690 |
- manage_interface (bool, default=True): if ``True`` this driver will |
| 3691 |
setup/teardown the interface on activate/deactivate. Set this to ``False`` |
| 3692 |
if you are managing the interface externally. |
| 3693 |
|
| 3694 |
LAA Drivers |
| 3695 |
~~~~~~~~~~~ |
| 3696 |
Drivers for devices connected via a `Linaro Automation Appliance (LAA) |
| 3697 |
<https://hub.linaro.com/library/laa/laa>`_. |
| 3698 |
Requires the ``laam`` package, install with ``pip install labgrid[laa]``. |
| 3699 |
|
| 3700 |
LAASerialDriver |
| 3701 |
+++++++++++++++ |
| 3702 |
The :any:`LAASerialDriver` connects to a serial port on the LAA via |
| 3703 |
a WebSocket bridge provided by laam. |
| 3704 |
|
| 3705 |
Binds to: |
| 3706 |
port: |
| 3707 |
- `LAASerialPort`_ |
| 3708 |
|
| 3709 |
Implements: |
| 3710 |
- :any:`ConsoleProtocol` |
| 3711 |
|
| 3712 |
.. code-block:: yaml |
| 3713 |
|
| 3714 |
LAASerialDriver: |
| 3715 |
txdelay: 0.0 |
| 3716 |
timeout: 3.0 |
| 3717 |
|
| 3718 |
Arguments: |
| 3719 |
- txdelay (float, default=0.0): time in seconds to wait after each write |
| 3720 |
- timeout (float, default=3.0): default read timeout in seconds |
| 3721 |
|
| 3722 |
LAAPowerDriver |
| 3723 |
++++++++++++++ |
| 3724 |
The :any:`LAAPowerDriver` controls power to the device via the LAA. |
| 3725 |
It executes the power on/off sequences from the resource. |
| 3726 |
|
| 3727 |
Binds to: |
| 3728 |
port: |
| 3729 |
- `LAAPowerPort`_ |
| 3730 |
|
| 3731 |
Implements: |
| 3732 |
- :any:`PowerProtocol` |
| 3733 |
|
| 3734 |
.. code-block:: yaml |
| 3735 |
|
| 3736 |
LAAPowerDriver: |
| 3737 |
delay: 2.0 |
| 3738 |
|
| 3739 |
Arguments: |
| 3740 |
- delay (float, default=2.0): time in seconds between off and on during |
| 3741 |
power cycle (only used when no power_cycle sequence is set) |
| 3742 |
|
| 3743 |
LAAUSBGadgetMassStorageDriver |
| 3744 |
++++++++++++++++++++++++++++++ |
| 3745 |
The :any:`LAAUSBGadgetMassStorageDriver` controls a USB gadget mass storage |
| 3746 |
device on the LAA. It can simulate a USB stick being plugged in or out. |
| 3747 |
|
| 3748 |
Binds to: |
| 3749 |
port: |
| 3750 |
- `LAAUSBGadgetMassStorage`_ |
| 3751 |
|
| 3752 |
.. code-block:: yaml |
| 3753 |
|
| 3754 |
LAAUSBGadgetMassStorageDriver: {} |
| 3755 |
|
| 3756 |
Arguments: |
| 3757 |
- None |
| 3758 |
|
| 3759 |
LAAUSBDriver |
| 3760 |
++++++++++++ |
| 3761 |
The :any:`LAAUSBDriver` toggles USB ports on the LAA. |
| 3762 |
|
| 3763 |
Binds to: |
| 3764 |
port: |
| 3765 |
- `LAAUSBPort`_ |
| 3766 |
|
| 3767 |
.. code-block:: yaml |
| 3768 |
|
| 3769 |
LAAUSBDriver: {} |
| 3770 |
|
| 3771 |
Arguments: |
| 3772 |
- None |
| 3773 |
|
| 3774 |
LAAButtonDriver |
| 3775 |
+++++++++++++++ |
| 3776 |
The :any:`LAAButtonDriver` controls virtual buttons on the LAA. |
| 3777 |
|
| 3778 |
Binds to: |
| 3779 |
port: |
| 3780 |
- `LAAButtonPort`_ |
| 3781 |
|
| 3782 |
.. code-block:: yaml |
| 3783 |
|
| 3784 |
LAAButtonDriver: {} |
| 3785 |
|
| 3786 |
Arguments: |
| 3787 |
- None |
| 3788 |
|
| 3789 |
The driver provides ``press(button)`` and ``release(button)`` methods. |
| 3790 |
The button name must match one of the names in the resource. |
| 3791 |
|
| 3792 |
LAALedDriver |
| 3793 |
+++++++++++++ |
| 3794 |
The :any:`LAALedDriver` controls an LED on the LAA. |
| 3795 |
|
| 3796 |
Binds to: |
| 3797 |
port: |
| 3798 |
- `LAALed`_ |
| 3799 |
|
| 3800 |
.. code-block:: yaml |
| 3801 |
|
| 3802 |
LAALedDriver: {} |
| 3803 |
|
| 3804 |
Arguments: |
| 3805 |
- None |
| 3806 |
|
| 3807 |
LAATempDriver |
| 3808 |
+++++++++++++ |
| 3809 |
The :any:`LAATempDriver` reads a temperature sensor on the LAA. |
| 3810 |
|
| 3811 |
Binds to: |
| 3812 |
port: |
| 3813 |
- `LAATempSensor`_ |
| 3814 |
|
| 3815 |
.. code-block:: yaml |
| 3816 |
|
| 3817 |
LAATempDriver: {} |
| 3818 |
|
| 3819 |
Arguments: |
| 3820 |
- None |
| 3821 |
|
| 3822 |
The driver provides a ``get_temp(probe)`` method that returns a dict |
| 3823 |
with the temperature reading. |
| 3824 |
|
| 3825 |
LAAWattDriver |
| 3826 |
+++++++++++++ |
| 3827 |
The :any:`LAAWattDriver` reads a power meter on the LAA. |
| 3828 |
|
| 3829 |
Binds to: |
| 3830 |
port: |
| 3831 |
- `LAAWattMeter`_ |
| 3832 |
|
| 3833 |
.. code-block:: yaml |
| 3834 |
|
| 3835 |
LAAWattDriver: {} |
| 3836 |
|
| 3837 |
Arguments: |
| 3838 |
- None |
| 3839 |
|
| 3840 |
The driver provides a ``get_watts(vbus)`` method that returns a dict |
| 3841 |
with the power reading. |
| 3842 |
|
| 3843 |
LAAProviderDriver |
| 3844 |
+++++++++++++++++ |
| 3845 |
The :any:`LAAProviderDriver` manages files on the LAA file storage |
| 3846 |
where they are served via TFTP. The ``stage()`` method accepts a local |
| 3847 |
file path or a URL. The ``list()`` method returns the files on the LAA |
| 3848 |
and ``remove(name)`` deletes a file. |
| 3849 |
|
| 3850 |
Binds to: |
| 3851 |
provider: |
| 3852 |
- `LAAProvider`_ |
| 3853 |
|
| 3854 |
.. code-block:: yaml |
| 3855 |
|
| 3856 |
LAAProviderDriver: {} |
| 3857 |
|
| 3858 |
Arguments: |
| 3859 |
- None |
| 3860 |
|
| 3861 |
The ``stage()`` method returns the filename as stored on the LAA. |
| 3862 |
The ``list()`` method returns a list of filenames. The ``remove(name)`` |
| 3863 |
method removes a file by name. |
| 3864 |
|
| 3865 |
.. _conf-strategies: |
| 3866 |
|
| 3867 |
Strategies |
| 3868 |
---------- |
| 3869 |
Strategies are used to ensure that the device is in a certain state during a test. |
| 3870 |
Such a state could be the bootloader or a booted Linux kernel with shell. |
| 3871 |
|
| 3872 |
.. _conf-bareboxstrategy: |
| 3873 |
|
| 3874 |
BareboxStrategy |
| 3875 |
~~~~~~~~~~~~~~~ |
| 3876 |
A :any:`BareboxStrategy` has four states: |
| 3877 |
|
| 3878 |
- unknown |
| 3879 |
- off |
| 3880 |
- barebox |
| 3881 |
- shell |
| 3882 |
|
| 3883 |
Here is an example environment config: |
| 3884 |
|
| 3885 |
.. code-block:: yaml |
| 3886 |
:name: barebox-env.yaml |
| 3887 |
|
| 3888 |
targets: |
| 3889 |
main: |
| 3890 |
resources: |
| 3891 |
RawSerialPort: |
| 3892 |
port: '/dev/ttyUSB0' |
| 3893 |
drivers: |
| 3894 |
ManualPowerDriver: {} |
| 3895 |
SerialDriver: {} |
| 3896 |
BareboxDriver: {} |
| 3897 |
ShellDriver: |
| 3898 |
prompt: 'root@[\w-]+:[^ ]+ ' |
| 3899 |
login_prompt: ' login: ' |
| 3900 |
username: 'root' |
| 3901 |
BareboxStrategy: {} |
| 3902 |
|
| 3903 |
In order to use the BareboxStrategy via labgrid as a library and transition to |
| 3904 |
the "shell" state: |
| 3905 |
|
| 3906 |
.. testsetup:: barebox-strategy |
| 3907 |
|
| 3908 |
from labgrid.strategy import BareboxStrategy |
| 3909 |
|
| 3910 |
BareboxStrategy.transition = Mock(return_value=None) |
| 3911 |
|
| 3912 |
.. doctest:: barebox-strategy |
| 3913 |
|
| 3914 |
>>> from labgrid import Environment |
| 3915 |
>>> e = Environment("barebox-env.yaml") |
| 3916 |
>>> t = e.get_target("main") |
| 3917 |
>>> s = t.get_driver("BareboxStrategy") |
| 3918 |
>>> s.transition("shell") |
| 3919 |
|
| 3920 |
This command would transition from the bootloader into a Linux shell and |
| 3921 |
activate the `ShellDriver`_. |
| 3922 |
|
| 3923 |
ShellStrategy |
| 3924 |
~~~~~~~~~~~~~ |
| 3925 |
A :any:`ShellStrategy` has three states: |
| 3926 |
|
| 3927 |
- unknown |
| 3928 |
- off |
| 3929 |
- shell |
| 3930 |
|
| 3931 |
Here is an example environment config: |
| 3932 |
|
| 3933 |
.. code-block:: yaml |
| 3934 |
:name: shell-env.yaml |
| 3935 |
|
| 3936 |
targets: |
| 3937 |
main: |
| 3938 |
resources: |
| 3939 |
RawSerialPort: |
| 3940 |
port: '/dev/ttyUSB0' |
| 3941 |
drivers: |
| 3942 |
ManualPowerDriver: {} |
| 3943 |
SerialDriver: {} |
| 3944 |
ShellDriver: |
| 3945 |
prompt: 'root@[\w-]+:[^ ]+ ' |
| 3946 |
login_prompt: ' login: ' |
| 3947 |
username: 'root' |
| 3948 |
ShellStrategy: {} |
| 3949 |
|
| 3950 |
In order to use the ShellStrategy via labgrid as a library and transition to |
| 3951 |
the "shell" state: |
| 3952 |
|
| 3953 |
.. testsetup:: shell-strategy |
| 3954 |
|
| 3955 |
from labgrid.strategy import ShellStrategy |
| 3956 |
|
| 3957 |
ShellStrategy.transition = Mock(return_value=None) |
| 3958 |
|
| 3959 |
.. doctest:: shell-strategy |
| 3960 |
|
| 3961 |
>>> from labgrid import Environment |
| 3962 |
>>> e = Environment("shell-env.yaml") |
| 3963 |
>>> t = e.get_target("main") |
| 3964 |
>>> s = t.get_driver("ShellStrategy") |
| 3965 |
|
| 3966 |
This command would transition directly into a Linux shell and |
| 3967 |
activate the `ShellDriver`_. |
| 3968 |
|
| 3969 |
UBootStrategy |
| 3970 |
~~~~~~~~~~~~~ |
| 3971 |
A :any:`UBootStrategy` has four states: |
| 3972 |
|
| 3973 |
- unknown |
| 3974 |
- off |
| 3975 |
- uboot |
| 3976 |
- shell |
| 3977 |
|
| 3978 |
Here is an example environment config: |
| 3979 |
|
| 3980 |
.. code-block:: yaml |
| 3981 |
:name: uboot-env.yaml |
| 3982 |
|
| 3983 |
targets: |
| 3984 |
main: |
| 3985 |
resources: |
| 3986 |
RawSerialPort: |
| 3987 |
port: '/dev/ttyUSB0' |
| 3988 |
drivers: |
| 3989 |
ManualPowerDriver: {} |
| 3990 |
SerialDriver: {} |
| 3991 |
UBootDriver: {} |
| 3992 |
ShellDriver: |
| 3993 |
prompt: 'root@[\w-]+:[^ ]+ ' |
| 3994 |
login_prompt: ' login: ' |
| 3995 |
username: 'root' |
| 3996 |
UBootStrategy: {} |
| 3997 |
|
| 3998 |
In order to use the UBootStrategy via labgrid as a library and transition to |
| 3999 |
the "shell" state: |
| 4000 |
|
| 4001 |
.. testsetup:: uboot-strategy |
| 4002 |
|
| 4003 |
from labgrid.strategy import UBootStrategy |
| 4004 |
|
| 4005 |
UBootStrategy.transition = Mock(return_value=None) |
| 4006 |
|
| 4007 |
.. doctest:: uboot-strategy |
| 4008 |
|
| 4009 |
>>> from labgrid import Environment |
| 4010 |
>>> e = Environment("uboot-env.yaml") |
| 4011 |
>>> t = e.get_target("main") |
| 4012 |
>>> s = t.get_driver("UBootStrategy") |
| 4013 |
>>> s.transition("shell") |
| 4014 |
|
| 4015 |
This command would transition from the bootloader into a Linux shell and |
| 4016 |
activate the `ShellDriver`_. |
| 4017 |
|
| 4018 |
DockerStrategy |
| 4019 |
~~~~~~~~~~~~~~ |
| 4020 |
A :any:`DockerStrategy` has three states: |
| 4021 |
|
| 4022 |
- unknown |
| 4023 |
- gone |
| 4024 |
- accessible |
| 4025 |
|
| 4026 |
Here is an example environment config: |
| 4027 |
|
| 4028 |
.. code-block:: yaml |
| 4029 |
:name: docker-env.yaml |
| 4030 |
|
| 4031 |
targets: |
| 4032 |
main: |
| 4033 |
resources: |
| 4034 |
DockerDaemon: |
| 4035 |
docker_daemon_url: 'unix://var/run/docker.sock' |
| 4036 |
drivers: |
| 4037 |
DockerDriver: |
| 4038 |
image_uri: 'rastasheep/ubuntu-sshd:16.04' |
| 4039 |
container_name: 'ubuntu-lg-example' |
| 4040 |
host_config: {'network_mode': 'bridge'} |
| 4041 |
network_services: [{'port': 22, 'username': 'root', 'password': 'root'}] |
| 4042 |
DockerStrategy: {} |
| 4043 |
|
| 4044 |
In order to use the DockerStrategy via labgrid as a library and transition to |
| 4045 |
the "accessible" state: |
| 4046 |
|
| 4047 |
.. testsetup:: docker-strategy |
| 4048 |
|
| 4049 |
from labgrid.strategy import DockerStrategy |
| 4050 |
|
| 4051 |
patch("docker.DockerClient").start() |
| 4052 |
DockerStrategy.transition = Mock(return_value=None) |
| 4053 |
|
| 4054 |
.. doctest:: docker-strategy |
| 4055 |
|
| 4056 |
>>> from labgrid import Environment |
| 4057 |
>>> e = Environment("docker-env.yaml") |
| 4058 |
>>> t = e.get_target("main") |
| 4059 |
>>> s = t.get_driver("DockerStrategy") |
| 4060 |
>>> s.transition("accessible") |
| 4061 |
|
| 4062 |
These commands would activate the docker driver which creates and starts |
| 4063 |
a docker container. This will subsequently make `NetworkService`_ instance(s) |
| 4064 |
available which can be used for e.g. SSH access. |
| 4065 |
|
| 4066 |
Reporters |
| 4067 |
--------- |
| 4068 |
|
| 4069 |
StepReporter |
| 4070 |
~~~~~~~~~~~~ |
| 4071 |
.. warning:: |
| 4072 |
The StepReporter is deprecated, use the `StepLogger`_ instead. |
| 4073 |
|
| 4074 |
The :any:`StepReporter` outputs individual labgrid steps to ``STDOUT``. |
| 4075 |
|
| 4076 |
.. doctest:: |
| 4077 |
|
| 4078 |
>>> from labgrid import StepReporter |
| 4079 |
>>> StepReporter.start() |
| 4080 |
|
| 4081 |
The Reporter can be stopped with a call to the stop function: |
| 4082 |
|
| 4083 |
.. doctest:: |
| 4084 |
|
| 4085 |
>>> from labgrid import StepReporter |
| 4086 |
>>> StepReporter.stop() |
| 4087 |
|
| 4088 |
Stopping the StepReporter if it has not been started will raise an |
| 4089 |
AssertionError, as will starting an already started StepReporter. |
| 4090 |
|
| 4091 |
ConsoleLoggingReporter |
| 4092 |
~~~~~~~~~~~~~~~~~~~~~~ |
| 4093 |
The :any:`ConsoleLoggingReporter` outputs read calls from the console transports into |
| 4094 |
files. It takes the path as a parameter. |
| 4095 |
|
| 4096 |
.. doctest:: |
| 4097 |
|
| 4098 |
>>> from labgrid import ConsoleLoggingReporter |
| 4099 |
>>> ConsoleLoggingReporter.start(".") |
| 4100 |
|
| 4101 |
The Reporter can be stopped with a call to the stop function: |
| 4102 |
|
| 4103 |
.. doctest:: |
| 4104 |
|
| 4105 |
>>> from labgrid import ConsoleLoggingReporter |
| 4106 |
>>> ConsoleLoggingReporter.stop() |
| 4107 |
|
| 4108 |
Stopping the ConsoleLoggingReporter if it has not been started will raise an |
| 4109 |
AssertionError, as will starting an already started StepReporter. |
| 4110 |
|
| 4111 |
Loggers |
| 4112 |
------- |
| 4113 |
|
| 4114 |
StepLogger |
| 4115 |
~~~~~~~~~~ |
| 4116 |
The :any:`StepLogger` logs individual labgrid steps. |
| 4117 |
|
| 4118 |
Logging can be set up via ``labgrid.logging.basicConfig()``. |
| 4119 |
|
| 4120 |
.. doctest:: |
| 4121 |
|
| 4122 |
>>> import logging |
| 4123 |
>>> from labgrid.logging import basicConfig, StepLogger |
| 4124 |
>>> basicConfig(level=logging.INFO) |
| 4125 |
>>> StepLogger.start() |
| 4126 |
|
| 4127 |
The logger can be stopped with a call to the stop function: |
| 4128 |
|
| 4129 |
.. doctest:: |
| 4130 |
|
| 4131 |
>>> from labgrid.logging import StepLogger |
| 4132 |
>>> StepLogger.stop() |
| 4133 |
|
| 4134 |
Stopping the StepLogger if it has not been started will raise an |
| 4135 |
AssertionError, as will starting an already started StepLogger. |
| 4136 |
|
| 4137 |
.. _environment-configuration: |
| 4138 |
|
| 4139 |
Environment Configuration |
| 4140 |
------------------------- |
| 4141 |
The environment configuration for a test environment consists of a YAML file |
| 4142 |
which contains targets, drivers and resources. |
| 4143 |
|
| 4144 |
.. note:: |
| 4145 |
|
| 4146 |
The order is important here: |
| 4147 |
Objects are instantiated in the order they appear in the YAML file, |
| 4148 |
so if drivers depend on other drivers or resources which are only instantiated later, |
| 4149 |
loading the environment will fail. |
| 4150 |
|
| 4151 |
The skeleton for an environment consists of: |
| 4152 |
|
| 4153 |
.. code-block:: yaml |
| 4154 |
|
| 4155 |
targets: |
| 4156 |
<target-1>: |
| 4157 |
resources: |
| 4158 |
<resource-1>: |
| 4159 |
<resource-1 parameters> |
| 4160 |
<resource-2>: |
| 4161 |
<resource-2 parameters> |
| 4162 |
drivers: |
| 4163 |
<driver-1>: |
| 4164 |
<driver-1 parameters> |
| 4165 |
<driver-2>: {} # no parameters for driver-2 |
| 4166 |
features: |
| 4167 |
- <target-feature-1> |
| 4168 |
<target-2>: |
| 4169 |
resources: |
| 4170 |
<resources> |
| 4171 |
drivers: |
| 4172 |
<drivers> |
| 4173 |
options: |
| 4174 |
<target-option-1-name>: <value for target-option-1> |
| 4175 |
<more target-options> |
| 4176 |
<more targets> |
| 4177 |
options: |
| 4178 |
<option-1 name>: <value for option-1> |
| 4179 |
<more options> |
| 4180 |
features: |
| 4181 |
- <global-feature-1> |
| 4182 |
paths: |
| 4183 |
<path-1 name>: <absolute or relative path for path-1> |
| 4184 |
<more paths> |
| 4185 |
images: |
| 4186 |
<image-1 name>: <absolute or relative path for image-1> |
| 4187 |
<more images> |
| 4188 |
tools: |
| 4189 |
<tool-1 name>: <absolute or relative path for tool-1> |
| 4190 |
<more tools> |
| 4191 |
imports: |
| 4192 |
- <import.py> |
| 4193 |
- <python module> |
| 4194 |
|
| 4195 |
If you have a single target in your environment, name it "main", as the |
| 4196 |
``get_target`` function defaults to "main". |
| 4197 |
|
| 4198 |
All the resources and drivers in this chapter have a YAML example snippet which |
| 4199 |
can simply be added (at the correct indentation level, one level deeper) to the |
| 4200 |
environment configuration. |
| 4201 |
|
| 4202 |
See the :ref:`labgrid-device-config` man page for documentation on the |
| 4203 |
top-level ``options``, ``images``, ``tools``, and ``imports`` keys in the |
| 4204 |
environment configuration. |
| 4205 |
|
| 4206 |
.. _environment-configuration-feature-flags: |
| 4207 |
|
| 4208 |
Feature Flags |
| 4209 |
~~~~~~~~~~~~~ |
| 4210 |
Similar targets or multi target environments may differ from each other in |
| 4211 |
certain small aspects, e.g. one device has a camera or screen connected, but |
| 4212 |
another one has not. |
| 4213 |
In labgrid's environment configs, such variations are described as feature flags. |
| 4214 |
|
| 4215 |
Here's an example environment configuration for a target-scoped feature |
| 4216 |
``camera``: |
| 4217 |
|
| 4218 |
.. code-block:: yaml |
| 4219 |
:name: feature-flag-env.yaml |
| 4220 |
|
| 4221 |
targets: |
| 4222 |
main: |
| 4223 |
features: |
| 4224 |
- camera |
| 4225 |
resources: {} |
| 4226 |
drivers: {} |
| 4227 |
|
| 4228 |
Features can not only be set per target, but also globally: |
| 4229 |
|
| 4230 |
.. code-block:: yaml |
| 4231 |
:name: feature-flag-global-env.yaml |
| 4232 |
|
| 4233 |
features: |
| 4234 |
- camera |
| 4235 |
targets: |
| 4236 |
main: |
| 4237 |
features: |
| 4238 |
- console |
| 4239 |
resources: {} |
| 4240 |
drivers: {} |
| 4241 |
|
| 4242 |
See :ref:`usage_pytestplugin_mark_lg_feature` for how to make use of feature |
| 4243 |
flags in tests. |
| 4244 |
|
| 4245 |
Multiple Drivers of the Same Type |
| 4246 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 4247 |
If you want to use multiple drivers of the same type, the resources and drivers |
| 4248 |
need to be lists, e.g: |
| 4249 |
|
| 4250 |
.. code-block:: yaml |
| 4251 |
|
| 4252 |
resources: |
| 4253 |
RawSerialPort: |
| 4254 |
port: '/dev/ttyS1' |
| 4255 |
drivers: |
| 4256 |
SerialDriver: {} |
| 4257 |
|
| 4258 |
becomes: |
| 4259 |
|
| 4260 |
.. code-block:: yaml |
| 4261 |
|
| 4262 |
resources: |
| 4263 |
- RawSerialPort: |
| 4264 |
port: '/dev/ttyS1' |
| 4265 |
- RawSerialPort: |
| 4266 |
port: '/dev/ttyS2' |
| 4267 |
drivers: |
| 4268 |
- SerialDriver: {} |
| 4269 |
- SerialDriver: {} |
| 4270 |
|
| 4271 |
This configuration doesn't specify which `RawSerialPort`_ to use for each |
| 4272 |
`SerialDriver`_, so it will cause an exception when instantiating the |
| 4273 |
:any:`Target`. |
| 4274 |
To bind the correct driver to the correct resource, explicit ``name`` and |
| 4275 |
``bindings`` properties are used: |
| 4276 |
|
| 4277 |
.. code-block:: yaml |
| 4278 |
|
| 4279 |
resources: |
| 4280 |
- RawSerialPort: |
| 4281 |
name: 'foo' |
| 4282 |
port: '/dev/ttyS1' |
| 4283 |
- RawSerialPort: |
| 4284 |
name: 'bar' |
| 4285 |
port: '/dev/ttyS2' |
| 4286 |
drivers: |
| 4287 |
- SerialDriver: |
| 4288 |
name: 'foo_driver' |
| 4289 |
bindings: |
| 4290 |
port: 'foo' |
| 4291 |
- SerialDriver: |
| 4292 |
name: 'bar_driver' |
| 4293 |
bindings: |
| 4294 |
port: 'bar' |
| 4295 |
|
| 4296 |
The property name for the binding (e.g. ``port`` in the example above) is |
| 4297 |
documented for each individual driver in this chapter. |
| 4298 |
|
| 4299 |
Templating the Environment Configuration |
| 4300 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 4301 |
The YAML configuration file also supports templating for some substitutions, |
| 4302 |
these are: |
| 4303 |
|
| 4304 |
- ``LG_*`` variables, are replaced with their respective ``LG_*`` environment |
| 4305 |
variable |
| 4306 |
- ``BASE`` is substituted with the base directory of the YAML file. |
| 4307 |
|
| 4308 |
As an example: |
| 4309 |
|
| 4310 |
.. code-block:: yaml |
| 4311 |
|
| 4312 |
targets: |
| 4313 |
main: |
| 4314 |
resources: |
| 4315 |
RemotePlace: |
| 4316 |
name: !template '$LG_PLACE' |
| 4317 |
tools: |
| 4318 |
qemu_bin: !template '$BASE/bin/qemu-bin' |
| 4319 |
|
| 4320 |
would resolve the ``qemu_bin`` path relative to the ``BASE`` dir of the YAML |
| 4321 |
file and try to use the `RemotePlace`_ with the name set in the ``LG_PLACE`` |
| 4322 |
environment variable. |
| 4323 |
|
| 4324 |
.. _exporter-configuration: |
| 4325 |
|
| 4326 |
Exporter Configuration |
| 4327 |
---------------------- |
| 4328 |
The exporter is configured by using a YAML file (with a syntax similar to the |
| 4329 |
environment configs used for pytest) or by instantiating the :any:`Environment` |
| 4330 |
object. |
| 4331 |
To configure the exporter, you need to define one or more *resource groups*, |
| 4332 |
each containing one or more *resources*. |
| 4333 |
The syntax for exported resource names is ``<exporter>/<group>/<class>/<name>``, |
| 4334 |
which allows the exporter to group resources for various usage scenarios, e.g. |
| 4335 |
all resources of a specific place or for a specific test setup. |
| 4336 |
For information on how the exporter fits into the rest of labgrid, see |
| 4337 |
:any:`remote-resources-and-places`. |
| 4338 |
|
| 4339 |
The ``<exporter>`` part can be specified on the :ref:`labgrid-exporter` command |
| 4340 |
line, and defaults to the hostname of the exporter. |
| 4341 |
|
| 4342 |
The basic structure of an exporter configuration file is: |
| 4343 |
|
| 4344 |
.. code-block:: yaml |
| 4345 |
|
| 4346 |
<group-1>: |
| 4347 |
<resource-name-1>: |
| 4348 |
<params> |
| 4349 |
<resource-name-2>: |
| 4350 |
<params> |
| 4351 |
<group-2>: |
| 4352 |
<resource-name-1>: |
| 4353 |
<params> |
| 4354 |
|
| 4355 |
By default, the class name is inferred from the resource name, |
| 4356 |
and ``<params>`` will be passed to its constructor. |
| 4357 |
For USB resources, you will most likely want to use :ref:`udev-matching` here. |
| 4358 |
|
| 4359 |
As a simple example, here is one group called ``usb-hub-in-rack12`` containing |
| 4360 |
a single `USBSerialPort`_ resource (using udev matching), which will be |
| 4361 |
exported as ``exportername/usb-hub-in-rack12/NetworkSerialPort/USBSerialPort``: |
| 4362 |
|
| 4363 |
.. code-block:: yaml |
| 4364 |
|
| 4365 |
usb-hub-in-rack12: |
| 4366 |
USBSerialPort: |
| 4367 |
match: |
| 4368 |
'@ID_PATH': 'pci-0000:05:00.0-usb-3-1.3' |
| 4369 |
|
| 4370 |
To export multiple resources of the same class in the same group, |
| 4371 |
you can choose a unique resource name, and then use the ``cls`` parameter to |
| 4372 |
specify the class name instead (which will not be passed as a parameter to the |
| 4373 |
class constructor). |
| 4374 |
In this next example we will export one `USBSerialPort`_ as |
| 4375 |
``exportername/usb-hub-in-rack12/NetworkSerialPort/console-main``, |
| 4376 |
and another `USBSerialPort`_ as |
| 4377 |
``exportername/usb-hub-in-rack12/NetworkSerialPort/console-secondary``: |
| 4378 |
|
| 4379 |
.. code-block:: yaml |
| 4380 |
|
| 4381 |
usb-hub-in-rack12: |
| 4382 |
console-main: |
| 4383 |
cls: 'USBSerialPort' |
| 4384 |
match: |
| 4385 |
'@ID_PATH': 'pci-0000:05:00.0-usb-3-1.3' |
| 4386 |
console-secondary: |
| 4387 |
cls: 'USBSerialPort' |
| 4388 |
match: |
| 4389 |
'@ID_PATH': 'pci-0000:05:00.0-usb-3-1.4' |
| 4390 |
|
| 4391 |
Note that you could also split the resources up into distinct groups instead |
| 4392 |
to achieve the same effect: |
| 4393 |
|
| 4394 |
.. code-block:: yaml |
| 4395 |
|
| 4396 |
usb-hub-in-rack12-port3: |
| 4397 |
USBSerialPort: |
| 4398 |
match: |
| 4399 |
'@ID_PATH': 'pci-0000:05:00.0-usb-3-1.3' |
| 4400 |
usb-hub-in-rack12-port4: |
| 4401 |
USBSerialPort: |
| 4402 |
match: |
| 4403 |
'@ID_PATH': 'pci-0000:05:00.0-usb-3-1.4' |
| 4404 |
|
| 4405 |
Templating the Exporter Configuration |
| 4406 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 4407 |
To reduce the amount of repeated declarations when many similar resources |
| 4408 |
need to be exported, the `Jinja2 template engine <http://jinja.pocoo.org/>`_ |
| 4409 |
is used as a preprocessor for the configuration file: |
| 4410 |
|
| 4411 |
.. code-block:: yaml |
| 4412 |
|
| 4413 |
## Iterate from group 1001 to 1016 |
| 4414 |
# for idx in range(1, 17) |
| 4415 |
{{ 1000 + idx }}: |
| 4416 |
NetworkSerialPort: |
| 4417 |
host: 'rl1' |
| 4418 |
port: {{ 4000 + idx }} |
| 4419 |
NetworkPowerPort: |
| 4420 |
# if 1 <= idx <= 8 |
| 4421 |
model: 'apc' |
| 4422 |
host: 'apc1' |
| 4423 |
index: {{ idx }} |
| 4424 |
# elif 9 <= idx <= 12 |
| 4425 |
model: 'netio' |
| 4426 |
host: 'netio4' |
| 4427 |
index: {{ idx - 8 }} |
| 4428 |
# elif 13 <= idx <= 16 |
| 4429 |
model: 'netio' |
| 4430 |
host: 'netio5' |
| 4431 |
index: {{ idx - 12 }} |
| 4432 |
# endif |
| 4433 |
# endfor |
| 4434 |
|
| 4435 |
Use ``#`` for line statements (like the for loops in the example) and ``##`` |
| 4436 |
for line comments. |
| 4437 |
Statements like ``{{ 4000 + idx }}`` are expanded based on variables in the |
| 4438 |
Jinja2 template. |
| 4439 |
|
| 4440 |
The template processing also supports use of OS environment variables, using |
| 4441 |
something like ``{{ env['FOOBAR'] }}`` to insert the content of environment |
| 4442 |
variable ``FOOBAR``. |
| 4443 |
In addition to ``env`` the template also has access to the following variables: |
| 4444 |
|
| 4445 |
drop_ins |
| 4446 |
An alphabetically sorted list of files in a directory named after the |
| 4447 |
currently processed template with ".d" appended. For example if the template |
| 4448 |
is named ``/etc/labgrid/configuration.yaml`` the list will contain files |
| 4449 |
matching ``/etc/labgrid/configuration.yaml.d/*.yaml`` pattern. The paths are |
| 4450 |
relative to the directory containing the template (i.e. ``/etc/labgrid`` |
| 4451 |
in our example). These files can be included using the ``include`` directive. |
| 4452 |
A template loading all its drop-ins at would look like this |
| 4453 |
|
| 4454 |
.. code-block:: |
| 4455 |
|
| 4456 |
# for f in drop_ins |
| 4457 |
{% include f %} |
| 4458 |
# endfor |
| 4459 |
|
| 4460 |
.. warning:: |
| 4461 |
Use the ``{% include f %}`` form instead of ``# include f``, otherwise |
| 4462 |
Jinja2 would strip newline characters before concatenation, and thus break |
| 4463 |
the YAML formatting. |
| 4464 |
|
| 4465 |
hostname |
| 4466 |
The hostname of the exporter host. Can be used to e.g. construct URLs to the |
| 4467 |
current host (``http://{{ hostname }}/``). |
| 4468 |
|
| 4469 |
isolated |
| 4470 |
``True`` or ``False``, depending on the :code:`--isolated` command line option. |
| 4471 |
|
| 4472 |
name |
| 4473 |
The name of the exporter. |