summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a>2011-12-29 02:22:17 +0000
committercliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a>2011-12-29 02:22:17 +0000
commit4a60134d55f01a5956ae7eb3f16436680a3d159f (patch)
tree5af7430fb50080198da51de7edc0b680d34f2074
parentc648da9a36bd47756bb43ba61992c2c83cb508f4 (diff)
downloadpyserial-git-4a60134d55f01a5956ae7eb3f16436680a3d159f.tar.gz
update for BSD: list_ports and device function
-rw-r--r--pyserial/CHANGES.txt1
-rw-r--r--pyserial/serial/serialposix.py8
-rw-r--r--pyserial/serial/tools/list_ports_posix.py7
3 files changed, 8 insertions, 8 deletions
diff --git a/pyserial/CHANGES.txt b/pyserial/CHANGES.txt
index 92995cb..b615759 100644
--- a/pyserial/CHANGES.txt
+++ b/pyserial/CHANGES.txt
@@ -445,6 +445,7 @@ Version 2.7 2012-nn-nn
Bugfixes (posix):
- [Patch 3462364] Fix: NameError: global name 'base' is not defined
+- list_ports and device() for BSD updated (Anders Langworthy)
Bugfixes (win32):
diff --git a/pyserial/serial/serialposix.py b/pyserial/serial/serialposix.py
index 4438a46..6f7bb47 100644
--- a/pyserial/serial/serialposix.py
+++ b/pyserial/serial/serialposix.py
@@ -103,10 +103,10 @@ elif plat == 'cygwin': # cygwin/win32 (confirmed)
baudrate_constants = {}
-elif plat == 'openbsd3': # BSD (confirmed)
+elif plat[:7] == 'openbsd': # OpenBSD
def device(port):
- return '/dev/ttyp%d' % port
+ return '/dev/cua%02d' % port
def set_special_baudrate(port, baudrate):
raise ValueError("sorry don't know how to handle non standard baud rate on this platform")
@@ -114,8 +114,7 @@ elif plat == 'openbsd3': # BSD (confirmed)
baudrate_constants = {}
elif plat[:3] == 'bsd' or \
- plat[:7] == 'freebsd' or \
- plat[:7] == 'openbsd': # BSD (confirmed for freebsd4: cuaa%d)
+ plat[:7] == 'freebsd':
def device(port):
return '/dev/cuad%d' % port
@@ -595,6 +594,7 @@ class PosixSerial(SerialBase):
WARNING: this function is not portable to different platforms!
"""
if not self.hComPort: raise portNotOpenError
+ if enable:
termios.tcflow(self.fd, TERMIOS.TCION)
else:
termios.tcflow(self.fd, TERMIOS.TCIOFF)
diff --git a/pyserial/serial/tools/list_ports_posix.py b/pyserial/serial/tools/list_ports_posix.py
index d5b3e42..7913d81 100644
--- a/pyserial/serial/tools/list_ports_posix.py
+++ b/pyserial/serial/tools/list_ports_posix.py
@@ -127,14 +127,13 @@ elif plat == 'cygwin': # cygwin/win32
devices = glob.glob('/dev/com*')
return [(d, d, d) for d in devices]
-elif plat == 'openbsd3': # BSD
+elif plat[:7] == 'openbsd': # OpenBSD
def comports():
- devices = glob.glob('/dev/ttyp*')
+ devices = glob.glob('/dev/cua*')
return [(d, d, d) for d in devices]
elif plat[:3] == 'bsd' or \
- plat[:7] == 'freebsd' or \
- plat[:7] == 'openbsd': # BSD
+ plat[:7] == 'freebsd':
def comports():
devices = glob.glob('/dev/cuad*')