serialhdl: Support working with pseudo serial devices

Support working with devices that aren't really serial ports and thus
do not have a baud rate.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2017-05-08 10:29:59 -04:00
parent 2255176228
commit c9b44b5bb6
2 changed files with 12 additions and 3 deletions

View file

@ -376,8 +376,12 @@ class MCU:
def __init__(self, printer, config):
self._printer = printer
# Serial port
baud = config.getint('baud', 250000)
self._serialport = config.get('serial', '/dev/ttyS0')
if self._serialport.startswith("/dev/rpmsg_"):
# Beaglbone PRU
baud = 0
else:
baud = config.getint('baud', 250000, minval=2400)
self.serial = serialhdl.SerialReader(
printer.reactor, self._serialport, baud)
self.is_shutdown = False