Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/pyserial
Submodule pyserial updated 82 files
+9 −0 .gitignore
+18 −0 .travis.yml
+265 −7 CHANGES.rst
+37 −59 LICENSE.txt
+13 −9 MANIFEST.in
+48 −0 README.rst
+0 −38 README.txt
+60 −56 documentation/appendix.rst
+5 −5 documentation/conf.py
+90 −167 documentation/examples.rst
+12 −10 documentation/index.rst
+0 −165 documentation/pyparallel.rst
+54 −46 documentation/pyserial.rst
+614 −302 documentation/pyserial_api.rst
+25 −17 documentation/shortintro.rst
+290 −0 documentation/tools.rst
+251 −0 documentation/url_handlers.rst
+154 −0 examples/at_protocol.py
+0 −62 examples/enhancedserial.py
+574 −485 examples/port_publisher.py
+0 −0 examples/port_publisher.sh
+82 −98 examples/rfc2217_server.py
+0 −30 examples/scan.py
+0 −20 examples/scanlinux.py
+0 −232 examples/scanwin32.py
+19 −13 examples/setup-miniterm-py2exe.py
+17 −10 examples/setup-rfc2217_server-py2exe.py
+23 −17 examples/setup-wxTerminal-py2exe.py
+191 −303 examples/tcp_serial_redirect.py
+171 −138 examples/wxSerialConfigDialog.py
+145 −155 examples/wxSerialConfigDialog.wxg
+177 −138 examples/wxTerminal.py
+46 −19 examples/wxTerminal.wxg
+378 −0 pylintrc
+0 −0 requirements.txt
+0 −1 serial/.cvsignore
+42 −32 serial/__init__.py
+507 −485 serial/rfc2217.py
+92 −0 serial/rs485.py
+111 −133 serial/serialcli.py
+83 −96 serial/serialjava.py
+568 −460 serial/serialposix.py
+522 −380 serial/serialutil.py
+307 −293 serial/serialwin32.py
+0 −200 serial/sermsdos.py
+295 −0 serial/threaded/__init__.py
+124 −0 serial/tools/hexlify_codec.py
+56 −51 serial/tools/list_ports.py
+108 −0 serial/tools/list_ports_common.py
+107 −143 serial/tools/list_ports_linux.py
+136 −84 serial/tools/list_ports_osx.py
+117 −101 serial/tools/list_ports_posix.py
+305 −240 serial/tools/list_ports_windows.py
+844 −562 serial/tools/miniterm.py
+55 −0 serial/urlhandler/protocol_alt.py
+64 −20 serial/urlhandler/protocol_hwgrep.py
+179 −149 serial/urlhandler/protocol_loop.py
+4 −5 serial/urlhandler/protocol_rfc2217.py
+245 −163 serial/urlhandler/protocol_socket.py
+286 −0 serial/urlhandler/protocol_spy.py
+85 −51 serial/win32.py
+7 −0 setup.cfg
+65 −53 setup.py
+8 −8 test/handlers/protocol_test.py
+15 −13 test/run_all_tests.py
+49 −46 test/test.py
+36 −63 test/test_advanced.py
+82 −0 test/test_asyncio.py
+109 −0 test/test_cancel.py
+49 −0 test/test_context.py
+59 −0 test/test_exclusive.py
+11 −12 test/test_high_load.py
+11 −30 test/test_iolib.py
+54 −0 test/test_pty.py
+17 −20 test/test_readline.py
+42 −0 test/test_rfc2217.py
+67 −0 test/test_rs485.py
+80 −0 test/test_settings_dict.py
+75 −0 test/test_threaded.py
+66 −0 test/test_timeout_class.py
+9 −12 test/test_url.py
+36 −0 test/test_util.py
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ For reference, the following dependencies are included in Git submodules:
* brlapi Python bindings, version 0.5.7 or later, distributed with [BRLTTY for Windows](http://brl.thefreecat.org/brltty/), version 4.2-2
* ALVA BC6 generic dll, version 3.0.4.1
* lilli.dll, version 2.1.0.0
* [pyserial](http://pypi.python.org/pypi/pyserial), version 2.7
* [pySerial](http://pypi.python.org/pypi/pyserial), version 3.4
* [Python interface to FTDI driver/chip](http://fluidmotion.dyndns.org/zenphoto/index.php?p=news&title=Python-interface-to-FTDI-driver-chip)
* [Py2Exe](http://sourceforge.net/projects/py2exe/), version 0.6.9
* [Nulsoft Install System](http://nsis.sourceforge.net/), version 2.51
Expand Down
2 changes: 2 additions & 0 deletions source/braille.py
Original file line number Diff line number Diff line change
Expand Up @@ -2119,6 +2119,8 @@ def initialize():
global handler
config.addConfigDirsToPythonPackagePath(brailleDisplayDrivers)
log.info("Using liblouis version %s" % louis.version())
import serial
log.info("Using pySerial version %s"%serial.VERSION)
# #6140: Migrate to new table names as smoothly as possible.
oldTableName = config.conf["braille"]["translationTable"]
newTableName = brailleTables.RENAMED_TABLES.get(oldTableName)
Expand Down
6 changes: 3 additions & 3 deletions source/brailleDisplayDrivers/ecoBraille.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ def __init__(self, port):
# Try to open port
self._dev = serial.Serial(self._port, baudrate = 19200, bytesize = serial.EIGHTBITS, parity = serial.PARITY_NONE, stopbits = serial.STOPBITS_ONE)
# Use a longer timeout when waiting for initialisation.
self._dev.timeout = self._dev.writeTimeout = 2.7
self._dev.timeout = self._dev.write_timeout = 2.7
self._ecoType = eco_in_init(self._dev)
# Use a shorter timeout hereafter.
self._dev.timeout = self._dev.writeTimeout = TIMEOUT
self._dev.timeout = self._dev.write_timeout = TIMEOUT
# Always send the protocol answer.
self._dev.write("\x61\x10\x02\xf1\x57\x57\x57\x10\x03")
self._dev.write("\x10\x02\xbc\x00\x00\x00\x00\x00\x10\x03")
Expand Down Expand Up @@ -202,7 +202,7 @@ def display(self, cells):
pass

def _handleResponses(self):
if self._dev.inWaiting():
if self._dev.in_waiting:
command = eco_in(self._dev)
if command:
try:
Expand Down
2 changes: 1 addition & 1 deletion source/brailleDisplayDrivers/hedoMobilLine.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def display(self, cells):
self._ser.write(line)

def handleResponses(self, wait=False):
while wait or self._ser.inWaiting():
while wait or self._ser.in_waiting:
data = self._ser.read(1)
if data:
# do not handle acknowledge bytes
Expand Down
2 changes: 1 addition & 1 deletion source/brailleDisplayDrivers/hedoProfiLine.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def display(self, cells):
self._ser.write(line)

def handleResponses(self, wait=False):
while wait or self._ser.inWaiting():
while wait or self._ser.in_waiting:
data = self._ser.read(1)
if data:
# do not handle acknowledge bytes
Expand Down
4 changes: 2 additions & 2 deletions source/brailleDisplayDrivers/papenmeier_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ def brl_out(offset, data):

def brl_poll(dev):
"""read data from braille display, used by keypress handler"""
if dev.inWaiting() < 10: return ""
if dev.in_waiting < 10: return ""
ret = []
ret.append(dev.read(dev.inWaiting()))
ret.append(dev.read(dev.in_waiting))
if ret[0][0] == chr(STX) and ret[0][9] == chr(ETX):
return "".join(ret)
return ""
Expand Down
2 changes: 1 addition & 1 deletion source/brailleDisplayDrivers/seika.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def display(self, cells):
self._ser.write(line)

def handleResponses(self):
if not self._ser.inWaiting():
if not self._ser.in_waiting:
return
chars = [0,0]
key = 0
Expand Down
17 changes: 8 additions & 9 deletions source/hwIo.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ def __init__(self, *args, **kwargs):
self._origTimeout = self._ser.timeout
# We don't want a timeout while we're waiting for data.
self._setTimeout(None)
self.inWaiting = self._ser.inWaiting
super(Serial, self).__init__(self._ser.hComPort, onReceive)
super(Serial, self).__init__(self._ser._port_handle, onReceive)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This handle is now private to pyserial, but if there is no public function to retrieve it I guess this is the best we can do.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did an extra check, but there doesn't seem to be one.


def read(self, size=1):
data = self._ser.read(size)
Expand Down Expand Up @@ -205,21 +204,21 @@ def _setTimeout(self, timeout):
# #6035: pyserial reconfigures all settings of the port when setting a timeout.
# This can cause error 'Cannot configure port, some setting was wrong.'
# Therefore, manually set the timeouts using the Win32 API.
# Adapted from pyserial 3.1.1.
# Adapted from pyserial 3.4.
timeouts = COMMTIMEOUTS()
if timeout is not None:
if timeout == 0:
timeouts.ReadIntervalTimeout = win32.MAXDWORD
else:
timeouts.ReadTotalTimeoutConstant = max(int(timeout * 1000), 1)
if timeout != 0 and self._ser._interCharTimeout is not None:
timeouts.ReadIntervalTimeout = max(int(self._ser._interCharTimeout * 1000), 1)
if self._ser._writeTimeout is not None:
if self._ser._writeTimeout == 0:
if timeout != 0 and self._ser._inter_byte_timeout is not None:
timeouts.ReadIntervalTimeout = max(int(self._ser._inter_byte_timeout * 1000), 1)
if self._ser._write_timeout is not None:
if self._ser._write_timeout == 0:
timeouts.WriteTotalTimeoutConstant = win32.MAXDWORD
else:
timeouts.WriteTotalTimeoutConstant = max(int(self._ser._writeTimeout * 1000), 1)
SetCommTimeouts(self._ser.hComPort, ctypes.byref(timeouts))
timeouts.WriteTotalTimeoutConstant = max(int(self._ser._write_timeout * 1000), 1)
SetCommTimeouts(self._ser._port_handle, ctypes.byref(timeouts))

class HIDP_CAPS (ctypes.Structure):
_fields_ = (
Expand Down