[chirp_devel] [PATCH] [VV-898] Update Image Detections (Improved)

Jim Unroe
Tue Dec 30 07:40:24 PST 2014


# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1419953224 18000
# Node ID bd0e17aaab95034535ffc65820849edec035ac10
# Parent  44cde2f5afd11fe7d3bd08afb4baaf1c9d4eaa5f
[VV-898] Update Image Detections (Improved)

Improve method to fall back to original detection string for older data files

Better detect between Jetstream, Leixen (v1.02 and v1.03) images

related to #2119

diff -r 44cde2f5afd1 -r bd0e17aaab95 chirp/leixen.py
--- a/chirp/leixen.py	Thu Dec 25 07:25:01 2014 -0500
+++ b/chirp/leixen.py	Tue Dec 30 10:27:04 2014 -0500
@@ -69,7 +69,7 @@
 
 
 def _image_ident_from_data(data):
-    return data[0x170:0x176]
+    return data[0x168:0x178]
 
 def _image_ident_from_image(radio):
     return _image_ident_from_data(radio.get_mmap())
@@ -148,7 +148,7 @@
     _ranges = [(0x0d00, 0x2000)]
 
     image_ident = _image_ident_from_image(radio)
-    if image_ident == radio._file_ident:
+    if image_ident.startswith(radio._file_ident) and "LX-" in image_ident:
         _ranges = radio._ranges
 
     do_ident(radio)
@@ -183,11 +183,11 @@
     MODEL = "VV-898"
     BAUD_RATE = 9600
 
-    _file_ident = "LX-\x89\x85\x63"
+    _file_ident = "Leixen"
     _memsize = 0x2000
     _ranges = [
         (0x0000, 0x013f),
-        (0x0148, 0x016f),
+        (0x0148, 0x0167),
         (0x0184, 0x018f),
         (0x0190, 0x01cf),
         (0x0900, 0x090f),
@@ -360,11 +360,13 @@
 
     @classmethod
     def match_model(cls, filedata, filename):
-        if filedata[0x170:0x176] == cls._file_ident:
+        if filedata[0x168:0x170].startswith(cls._file_ident) and \
+                               filedata[0x170:0x178].startswith("LX-/x89/x85"):
             return True
         elif filedata[0x900:0x906] == cls.MODEL:
             return True
-        return False
+        else:
+            return False
 
 
 @directory.register
@@ -373,4 +375,4 @@
     VENDOR = "Jetstream"
     MODEL = "JT270M"
 
-    _file_ident = "LX-\x89\x85\x53"
+    _file_ident = "JET"



More information about the chirp_devel mailing list