[chirp_devel] [PATCH] [RT21] Tigthen Image Detection
Jim Unroe
Sun Dec 3 15:27:45 PST 2017
# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1512343051 18000
# Node ID 15510909d882976b16985438796d6a8b7ab0b61e
# Parent 4d0380ebabaf418fdca10bb5979fb29886271cef
[RT21] Tigthen Image Detection
The RT26 images are inadvertenly detected as an RT21 image. This patch
tightens up the image detection of the RT21 driver.
#5415
diff -r 4d0380ebabaf -r 15510909d882 chirp/drivers/retevis_rt21.py
--- a/chirp/drivers/retevis_rt21.py Sun Dec 03 13:53:30 2017 -0500
+++ b/chirp/drivers/retevis_rt21.py Sun Dec 03 18:17:31 2017 -0500
@@ -232,6 +232,13 @@
_rt21_exit_programming_mode(radio)
+def model_match(cls, data):
+ """Match the opened/downloaded image to the correct version"""
+ rid = data[0x01B8:0x01BE]
+
+ return rid.startswith("P3207")
+
+
@directory.register
class RT21Radio(chirp_common.CloneModeRadio):
"""RETEVIS RT21"""
@@ -556,3 +563,21 @@
except Exception, e:
LOG.debug(element.get_name())
raise
+
+ @classmethod
+ def match_model(cls, filedata, filename):
+ match_size = False
+ match_model = False
+
+ # testing the file data size
+ if len(filedata) in [0x0400, ]:
+ match_size = True
+
+ # testing the model fingerprint
+ match_model = model_match(cls, filedata)
+
+ if match_size and match_model:
+ return True
+ else:
+ return False
+
More information about the chirp_devel
mailing list