Skip to content

Commit 9e2ec49

Browse files
Extend SerialPort
Adding software flow control parameter xonoff to SerialPort. Signed-off-by: Sebastian Bergt <[email protected]>
1 parent 08eb0ea commit 9e2ec49

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

doc/configuration.rst

+2
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ enumeration order.
3131
RawSerialPort:
3232
port: '/dev/ttyUSB0'
3333
speed: 115200
34+
xonxoff: False
3435
3536
The example would access the serial port ``/dev/ttyUSB0`` on the local computer
3637
with a baud rate of ``115200``.
3738

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

4244
Used by:
4345
- `SerialDriver`_

labgrid/driver/serialdriver.py

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def on_activate(self):
3939
if isinstance(self.port, SerialPort):
4040
self.serial.port = self.port.port
4141
self.serial.baudrate = self.port.speed
42+
self.serial.xonxoff = self.port.xonxoff
4243
else:
4344
host, port = proxymanager.get_host_and_port(self.port)
4445
if self.port.protocol == "rfc2217":

labgrid/resource/base.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ class SerialPort(Resource):
1010
1111
Args:
1212
port (str): port to connect to
13-
speed (int): speed of the port, defaults to 115200"""
13+
speed (int): speed of the port, defaults to 115200
14+
xonxoff (bool): software flow control, defaults to False (=off)"""
1415
port = attr.ib(default=None)
1516
speed = attr.ib(default=115200, validator=attr.validators.instance_of(int))
17+
xonxoff = attr.ib(default=False, validator=attr.validators.instance_of(bool))
1618

1719

1820
@target_factory.reg_resource

tests/test_serialport.py

+1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ def test_instanziation_with(self, target):
1010
s = RawSerialPort(target, 'serial', 'port', 115200)
1111
assert (s.port == 'port')
1212
assert (s.speed == 115200)
13+
assert (s.xonxoff == False)
1314
assert s in target.resources

0 commit comments

Comments
 (0)