From 21a306b77630116b052d53fc7a4deddaccec4d40 Mon Sep 17 00:00:00 2001 From: Chris Liechti Date: Sun, 9 Oct 2016 23:41:26 +0200 Subject: posix: support for arbitrary baudrates on BSD family, see #169 --- serial/serialposix.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/serial/serialposix.py b/serial/serialposix.py index 35eb858..ccc974a 100644 --- a/serial/serialposix.py +++ b/serial/serialposix.py @@ -190,6 +190,21 @@ elif plat[:6] == 'darwin': # OS X buf = array.array('i', [baudrate]) fcntl.ioctl(self.fd, IOSSIOSPEED, buf, 1) +elif plat[:3] == 'bsd' or \ + plat[:7] == 'freebsd' or \ + plat[:6] == 'netbsd' or \ + plat[:7] == 'openbsd': + + class ReturnBaudrate(object): + def __getitem__(self, key): + return key + + class PlatformSpecific(PlatformSpecificBase): + # Only tested on FreeBSD: + # The baud rate may be passed in as + # a literal value. + BAUDRATE_CONSTANTS = ReturnBaudrate() + else: class PlatformSpecific(PlatformSpecificBase): pass -- cgit v1.2.1