[chirp_devel] [PATCH] [RT22] Add additional ident string to Retevis RT22 driver

Jim Unroe
Fri Oct 12 18:08:23 PDT 2018


# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1539392711 14400
# Node ID cea09edbe8619c5842a21f7e09be17e67e1c3a3f
# Parent  371c7471286c0d38550658a445bdc9bae772c25e
[RT22] Add additional ident string to Retevis RT22 driver

add detection for newly discovered identification string

fixes #6147

diff -r 371c7471286c -r cea09edbe861 chirp/drivers/retevis_rt22.py
--- a/chirp/drivers/retevis_rt22.py	Fri Sep 07 21:35:15 2018 -0700
+++ b/chirp/drivers/retevis_rt22.py	Fri Oct 12 21:05:11 2018 -0400
@@ -125,10 +125,18 @@
         _rt22_exit_programming_mode(radio)
         raise errors.RadioError("Error communicating with radio")
 
-    if not ident.startswith("P32073"):
-        _rt22_exit_programming_mode(radio)
-        LOG.debug(util.hexprint(ident))
-        raise errors.RadioError("Radio returned unknown identification string")
+    # check if ident is OK
+    itis = False
+    for fp in radio._fileid:
+        if fp in ident:
+            # got it!
+            itis = True
+
+            break
+
+    if itis is False:
+        LOG.debug("Incorrect model ID, got this:\n\n" + util.hexprint(ident))
+        raise errors.RadioError("Radio identification failed.")
 
     try:
         serial.write(CMD_ACK)
@@ -289,6 +297,7 @@
               ]
     _memsize = 0x0400
     _block_size = 0x40
+    _fileid = ["P32073", "P3" + "\x00\x00\x00" + "3"]
 
     def get_features(self):
         rf = chirp_common.RadioFeatures()



More information about the chirp_devel mailing list