summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Liechti <cliechti@gmx.net>2016-10-09 23:41:26 +0200
committerChris Liechti <cliechti@gmx.net>2016-10-09 23:41:26 +0200
commit21a306b77630116b052d53fc7a4deddaccec4d40 (patch)
tree4b5e7ba4c67fe4615275972087b6deede37a4377
parent73ff15c1c66ea73e1a2886a418da7c6c9c251274 (diff)
downloadpyserial-git-21a306b77630116b052d53fc7a4deddaccec4d40.tar.gz
posix: support for arbitrary baudrates on BSD family, see #169
-rw-r--r--serial/serialposix.py15
1 files changed, 15 insertions, 0 deletions
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