Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ enumeration order.
RawSerialPort:
port: '/dev/ttyUSB0'
speed: 115200
xonxoff: False

The example would access the serial port ``/dev/ttyUSB0`` on the local computer
with a baud rate of ``115200``.

Arguments:
- port (str): path to the serial device
- speed (int, default=115200): desired baud rate
- xonxoff (bool, default=False): software flow control

Used by:
- `SerialDriver`_
Expand Down
1 change: 1 addition & 0 deletions labgrid/driver/serialdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def on_activate(self):
if isinstance(self.port, SerialPort):
self.serial.port = self.port.port
self.serial.baudrate = self.port.speed
self.serial.xonxoff = self.port.xonxoff
else:
host, port = proxymanager.get_host_and_port(self.port)
if self.port.protocol == "rfc2217":
Expand Down
4 changes: 3 additions & 1 deletion labgrid/resource/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ class SerialPort(Resource):

Args:
port (str): port to connect to
speed (int): speed of the port, defaults to 115200"""
speed (int): speed of the port, defaults to 115200
xonxoff (bool): software flow control, defaults to False (=off)"""
port = attr.ib(default=None)
speed = attr.ib(default=115200, validator=attr.validators.instance_of(int))
xonxoff = attr.ib(default=False, validator=attr.validators.instance_of(bool))


@target_factory.reg_resource
Expand Down
1 change: 1 addition & 0 deletions tests/test_serialport.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ def test_instanziation_with(self, target):
s = RawSerialPort(target, 'serial', 'port', 115200)
assert (s.port == 'port')
assert (s.speed == 115200)
assert (s.xonxoff == False)
assert s in target.resources
Loading