I need pyserial for firmware updates with products from the company 4DSystems. The initialisation of their hardware requires a very special setting but pyserial likes no overwrite the user parameter. I need e.g. rts and dtr off during opening the port and in Windows pyserial set dtr always on and so on. Is it possible to rebuild the communication without rewriting of the library?
<20141230120101.774 SYS>
COM ist offen
<20141230120101.774 SYS>
Leeren der seriellen Schnittstelle: RXABORT, RXCLEAR, TXABORT, TXCLEAR
<20141230120101.774 SYS>
Zeitüberschreitungen: ReadInterval=5, ReadTotalTimeoutMultiplier=1, ReadTotalTimeoutConstant=1, WriteTotalTimeoutMultiplier=0, WriteTotalTimeoutConstant=0
<20141230120101.775 SYS>
Baud-Rate 115200
<20141230120101.775 SYS>
RTS aus
<20141230120101.775 SYS>
DTR aus
<20141230120101.776 SYS>
Data Bits=8, Stop Bits=1, Parity=None
<20141230120101.776 SYS>
Zeichen setzen: Eof=0x00, Error=0x00, Break=0x00, Event=0x00, Xon=0x00, Xoff=0x00
<20141230120101.777 SYS>
Handflow: ControlHandShake=(), FlowReplace=(), XonLimit=32768, XoffLimit=8192
<20141230120101.778 SYS>
DTR an
<20141230120101.779 SYS>
DTR aus
<20141230120101.799 SYS>
Leeren der seriellen Schnittstelle: RXABORT, RXCLEAR, TXABORT, TXCLEAR
<20141230120101.799 TX>
4DGL
<20141230120101.809 RX>
4dgl
<20141230120101.848 TX>
e
<20141230120101.855 RX>
<ack>E
<20141230120102.984 TX>
p<nul>BzJè¿<enq>'zETDÀJe"<gs>é"·³Ó<¹<dc1><stx>>J<dle><si>u(ÉÝÇ%Š&š[<fs>_~hÇgÙ™@ª~<can>º˜õÛzûq‰¹ž\çëQG9GôQO<dle>×\<nak>®Ÿ¤JF<nul><etx>È2ÈQ·<ff>(c{¡CÒΕþ<bel>“cò<nak>»TÅÆð‡ûñ^”Û~Ó™Êf‡÷œy„ÿPiwh`6-<us>Ž<eot>Ñ!›IáΟuìû±0†Ÿ‹<so>?cTM¦—¸ê$è#~öfvE<si>Ò´ë2} q<dc3>9‡æµØµ‚·í¹2:p¡CŠ<fs>ÒÞYý$z;n™mbz6ð¤<eot>?=qéÉ<ack>["?=qéÉ<ack>["?=qéÉ<ack>["?=qéÉ<ack>["?=qéÉ<ack>["Ï
<20141230120103.051 RX>
<ack></ack></ack></ack></ack></ack></ack></eot></fs></dc3></si></so></eot></us></nak></bel></ff></etx></nul></nak></dle></can></fs></si></dle></stx></dc1></gs></enq></nul></ack>
In my optinion this is the problem:
...
self._rtsState = win32.RTS_CONTROL_ENABLE
self._dtrState = win32.DTR_CONTROL_ENABLE
...
if self._rtscts:
comDCB.fRtsControl = win32.RTS_CONTROL_HANDSHAKE
elif self._rtsToggle:
comDCB.fRtsControl = win32.RTS_CONTROL_TOGGLE
else:
comDCB.fRtsControl = self._rtsState
if self._dsrdtr:
comDCB.fDtrControl = win32.DTR_CONTROL_HANDSHAKE
else:
comDCB.fDtrControl = self._dtrState
the win32 implementation allows to call setRTS/setDTR before opening the port.
e.g.
s = serial.Serial() # omit port to avoid auto-open
s.port = 'COM1'
s.setRTS(False)
s.setDTR(False)
s.open()