[chirp_devel] [PATCH] Fix older Icom radio models by properly sending commands with raw encoding
# HG changeset patch # User Rhett Robinson rrhett@gmail.com # Date 1517620949 28800 # Fri Feb 02 17:22:29 2018 -0800 # Node ID e3b90fa8c3160eb3ff9a44a17b789e572d379b07 # Parent 05f340866a9c6de505f569ed6400d3d62f10369b Fix older Icom radio models by properly sending commands with raw encoding.
Fixes #5545.
diff -r 05f340866a9c -r e3b90fa8c316 chirp/drivers/icf.py --- a/chirp/drivers/icf.py Wed Jan 17 17:04:56 2018 -0800 +++ b/chirp/drivers/icf.py Fri Feb 02 17:22:29 2018 -0800 @@ -137,7 +137,7 @@
def get_model_data(radio, mdata="\x00\x00\x00\x00"): """Query the @radio for its model data""" - send_clone_frame(radio, 0xe0, mdata) + send_clone_frame(radio, 0xe0, mdata, raw=True)
stream = RadioStream(radio.pipe) frames = stream.get_frames() @@ -165,9 +165,9 @@ return resp
-def send_clone_frame(radio, cmd, data, checksum=False): +def send_clone_frame(radio, cmd, data, raw=False, checksum=False): """Send a clone frame with @cmd and @data to the @radio""" - payload = radio.get_payload(data, checksum) + payload = radio.get_payload(data, raw, checksum)
frame = "\xfe\xfe\xee\xef%s%s\xfd" % (chr(cmd), payload)
@@ -243,7 +243,7 @@ if radio.is_hispeed(): start_hispeed_clone(radio, CMD_CLONE_OUT) else: - send_clone_frame(radio, CMD_CLONE_OUT, radio.get_model()) + send_clone_frame(radio, CMD_CLONE_OUT, radio.get_model(), raw=True)
LOG.debug("Sent clone frame")
@@ -313,6 +313,7 @@ send_clone_frame(radio, CMD_CLONE_DAT, chunk, + raw=False, checksum=True)
if radio.status_fn: @@ -343,7 +344,7 @@ if radio.is_hispeed(): start_hispeed_clone(radio, CMD_CLONE_IN) else: - send_clone_frame(radio, CMD_CLONE_IN, radio.get_model()) + send_clone_frame(radio, CMD_CLONE_IN, radio.get_model(), raw=True)
frames = []
@@ -352,7 +353,7 @@ break frames += stream.get_frames()
- send_clone_frame(radio, CMD_CLONE_END, radio.get_endframe()) + send_clone_frame(radio, CMD_CLONE_END, radio.get_endframe(), raw=True)
if SAVE_PIPE: SAVE_PIPE.close() @@ -604,8 +605,10 @@
return data
- def get_payload(self, data, checksum): + def get_payload(self, data, raw, checksum): """Returns the data with optional checksum BCD-encoded for the radio""" + if raw: + return data payload = "" for byte in data: payload += "%02X" % ord(byte) @@ -685,7 +688,7 @@ """Payloads from a raw-clone-mode radio are already in raw format.""" return unescape_raw_bytes(payload)
- def get_payload(self, data, checksum): + def get_payload(self, data, raw, checksum): """Returns the data with optional checksum in raw format.""" if checksum: cs = chr(compute_checksum(data))
participants (1)
-
Rhett Robinson