Bug #4687 » icf.py.diff
chirp/drivers/icf.py Mon Jul 10 17:45:50 2017 -0400 → chirp/drivers/icf.py Wed Sep 06 00:46:01 2017 +0900 | ||
---|---|---|
return resp
|
||
def discard_echoback(pipe, data):
|
||
"""Discard echoback when sending frame"""
|
||
i = 0
|
||
length = len(data)
|
||
echo = ""
|
||
while i < length:
|
||
d = pipe.read(1)
|
||
while i < length:
|
||
if d != data[i]:
|
||
i += 1
|
||
else:
|
||
echo += d
|
||
break
|
||
i += 1
|
||
|
||
if echo != data:
|
||
LOG.debug("Received echoback is different from sent frame")
|
||
LOG.debug("Sent frame (%i):\n%s" % (length, util.hexprint(data)))
|
||
LOG.debug("Echoback (%i):\n%s" % (len(echo), util.hexprint(echo)))
|
||
return
|
||
def send_clone_frame(pipe, cmd, data, raw=False, checksum=False):
|
||
"""Send a clone frame with @cmd and @data to the radio attached
|
||
to @pipe"""
|
||
... | ... | |
pipe.write(frame)
|
||
pipe.flush()
|
||
pipe.read(len(frame)) # discard echoback
|
||
discard_echoback(pipe, frame)
|
||
return frame
|
||
... | ... | |
LOG.debug("Starting HiSpeed Clone:\n%s" % util.hexprint(buf))
|
||
radio.pipe.write(buf)
|
||
radio.pipe.flush()
|
||
radio.pipe.read(len(buf)) # discard echoback
|
||
discard_echoback(radio.pipe, buf)
|
||
def _clone_from_radio(radio):
|