From 4265a410e3b8a6cd3fd0014a1a7570311cb4b159 Mon Sep 17 00:00:00 2001 From: cliechti Date: Thu, 29 Dec 2011 02:22:17 +0000 Subject: update for BSD: list_ports and device function git-svn-id: http://svn.code.sf.net/p/pyserial/code/trunk/pyserial@447 f19166aa-fa4f-0410-85c2-fa1106f25c8a --- CHANGES.txt | 1 + serial/serialposix.py | 8 ++++---- serial/tools/list_ports_posix.py | 7 +++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 92995cb..b615759 100644 --- a/CHANGES.txt +++ b/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/serial/serialposix.py b/serial/serialposix.py index 4438a46..6f7bb47 100644 --- a/serial/serialposix.py +++ b/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/serial/tools/list_ports_posix.py b/serial/tools/list_ports_posix.py index d5b3e42..7913d81 100644 --- a/serial/tools/list_ports_posix.py +++ b/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*') -- cgit v1.2.1