Discussion:
[Bitpim-devel] Re: [bitpim-cvs-checkins] bitpim com_sanyo5500.py,1.1,1.2
Roger Binns
2004-02-24 05:29:18 UTC
Permalink
+ data=com_brew.unescape(data)
+ # get rid of leading junk
+ d=data.find(firsttwo)
+ data=data[d:]
+ # take off crc and terminator ::TODO:: check the crc
+ data=data[:-3]
You should add the CRC checking. Copy it from one of these places:

com_lg.py line 90
com_brew.py line 297

They also deal with multiple responses being in the data read. That
would happen if a command was sent, the comms failed for whatever
reason, a second command is sent and succeeds and then the read
returned both responses joined together.

The readuntil code in the comms is arguably broken because it
always reads all available characters, and then checks the last
one to see if it has the character being looked for. The reason
it is done that way is to avoid having buffers in the program
code with unread data.

Roger

Loading...