summaryrefslogtreecommitdiff
path: root/serial/sermsdos.py
diff options
context:
space:
mode:
authorcliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a>2003-08-28 22:18:14 +0000
committercliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a>2003-08-28 22:18:14 +0000
commit486cea35e0cc16ae549ccceea2eab658ce365a94 (patch)
treed9e0c3b2cff6614f824d640cfd61ce7df04a7844 /serial/sermsdos.py
parentc05b0b075e183ba8c791c6d57d2d7b9d258e3c4f (diff)
downloadpyserial-486cea35e0cc16ae549ccceea2eab658ce365a94.tar.gz
fix typo
git-svn-id: http://svn.code.sf.net/p/pyserial/code/trunk/pyserial@85 f19166aa-fa4f-0410-85c2-fa1106f25c8a
Diffstat (limited to 'serial/sermsdos.py')
-rw-r--r--serial/sermsdos.py28
1 files changed, 7 insertions, 21 deletions
diff --git a/serial/sermsdos.py b/serial/sermsdos.py
index c16d1bd..a516118 100644
--- a/serial/sermsdos.py
+++ b/serial/sermsdos.py
@@ -38,6 +38,7 @@
import os
import sys
import string
+import serialutil
BAUD_RATES = {
110: "11",
@@ -59,10 +60,10 @@ FIVEBITS, SIXBITS, SEVENBITS, EIGHTBITS = (5,6,7,8)
RETURN_NONE) = ('E', 'B', 'P', 'R', 'N')
portNotOpenError = ValueError('port not open')
-class SerialException(Exception):
- pass
+def device(portnum):
+ return 'COM%d' % (portnum+1)
-class Serial:
+class Serial(serialutil.FileLike):
"""
port: number of device; numbering starts at
zero. if everything fails, the user can
@@ -94,7 +95,7 @@ class Serial:
self.portstr = port
else:
#numbers are transformed to a string
- self.portstr = 'COM%d' % (port+1)
+ self.portstr = device(port+1)
self.baud = BAUD_RATES[baudrate]
self.bytesize = str(bytesize)
@@ -141,7 +142,7 @@ class Serial:
raise NotImplementedError
def read(self, num = 1):
- "Read num bytes from serial port"
+ """Read num bytes from serial port"""
handle = os.open(self.portstr,
os.O_RDONLY | os.O_BINARY)
# print os.fstat(handle)
@@ -150,7 +151,7 @@ class Serial:
return rv
def write(self, s):
- "Write string to serial port"
+ """Write string to serial port"""
handle = os.open(self.portstr,
os.O_WRONLY | os.O_BINARY)
rv = os.write(handle, s)
@@ -190,21 +191,6 @@ class Serial:
"""Eead terminal status line"""
raise NotImplementedError
- def readline(self, size=None):
- raise NotImplementedError
-
- def readlines(self, sizehint=None):
- raise NotImplementedError
-
- def xreadlines(self, sizehint=None):
- raise NotImplementedError
-
- def writelines(self, sequence):
- raise NotImplementedError
-
- def flush(self):
- raise NotImplementedError
-
def __repr__(self):
return string.join(( "<Serial>: ", self.portstr
, self.baud, self.parity, self.bytesize, self.stop,