Skip to content

Commit

Permalink
posix: support for arbitrary baudrates on BSD family, see #169
Browse files Browse the repository at this point in the history
  • Loading branch information
zsquareplusc committed Oct 9, 2016
1 parent 73ff15c commit 21a306b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions serial/serialposix.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,21 @@ def _set_special_baudrate(self, baudrate):
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
Expand Down

0 comments on commit 21a306b

Please sign in to comment.