tbot_contrib.connector

A module containing various additional connectors for convenience. These are:

class tbot_contrib.connector.auto.AutoConsoleConnector(mach: LinuxShell)[source]

Bases: ConsoleConnector

Console connector that automatically chooses an available terminal emulator to connect to a local console device.

Example:

from tbot_contrib.connector.auto import AutoConsoleConnector
from tbot.machine import board

class FooBoard(AutoConsoleConnector, board.Board):
    serial_port = "/dev/ttyUSB0"
    baudrate = 115200

New in version 0.10.3.

Parameters:

mach (LinuxShell) – A cloneable lab-host machine. The ConsoleConnector will try to clone this machine’s connection and use that to connect to the board. This means that you have to make sure you give the correct lab-host for your respective board to the constructor here.

abstract property serial_port: str | Path

Serial port to connect to.

baudrate = 115200

Baudrate of the serial line.

tools = [<class 'tbot_contrib.connector.auto.Tio'>, <class 'tbot_contrib.connector.auto.Picocom'>]

List of terminal emulators which may be used to connect.

It is best the leave this list complete so tbot can automatically figure out which tool is available and use that one.

class tbot_contrib.connector.conserver.ConserverConnector(mach: LinuxShell)[source]

Bases: ConsoleConnector

Connect to a serial console using conserver.

You can configure the device name using the conserver_device property.

Example: (board config)

from tbot.machine import board
from tbot_contrib.connector import conserver

class MyBoard(conserver.ConserverConnector, board.Board):
    conserver_device = "ttyS0"

BOARD = MyBoard
Parameters:

mach (LinuxShell) – A cloneable lab-host machine. The ConsoleConnector will try to clone this machine’s connection and use that to connect to the board. This means that you have to make sure you give the correct lab-host for your respective board to the constructor here.

abstract property conserver_device: str

Device name for conserver.

This property is required.

conserver_master: str | None = None

Optional name of the conserver master to connect to (-M).

conserver_command: str | List = 'console'

Command to connect with conserver.

Can be either a str (single command name) or a list (with added command-line args). For example:

conserver_command = ["console", "-p1234", "-n"]
conserver_forcerw: bool = True

Whether to force the console into read-write mode (-f).

This is necessary for the case where a session is already attached to this console while tbot is running. Otherwise, tbot will not be able to properly intercept the boot process and might fail for odd reasons.

If you don’t want tbot to mess with an already running session, set this to False.

class tbot_contrib.connector.pyserial.PyserialConnector(host: LinuxShell | None = None)[source]

Bases: Connector

Connect to a console connected to localhost (i.e. the host tbot is running on) using pyserial.

Example:

from tbot_contrib.connector import pyserial

class MyBoard(pyserial.PyserialConnector, board.Board):
    serial_port = "/dev/ttyUSB0"
    baudrate = 57600
abstract property serial_port: str | PathLike

Serial port to connect to. Keep in mind that this path is not on the lab-host but on the localhost.

baudrate = 115200

Baudrate of the serial line.