posix: support for arbitrary baudrates on BSD family, see #169
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 @@
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