[chirp_devel] [PATCH] [UV-5R] Update Firmware Version Detection
Jim Unroe
Tue Jul 22 17:07:33 PDT 2014
# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1406071893 14400
# Node ID 832afc1a783c279c9567c09fa2eeae89396b3c02
# Parent 76dd80f6f44561dda2c77e52258de8fa88d333d9
[UV-5R] Update Firmware Version Detection
Fix firmware version block length (14 characters instead of 16). The
firmware version check was failing on characters outside of the firmware
version block.
Swap the check order for BFB and BFS in the firmware version string so
the first occurance will always be selected. The previous method was
allowing different firmware versions to be detected as being the same.
Related to bug #1751
diff -r 76dd80f6f445 -r 832afc1a783c chirp/uv5r.py
--- a/chirp/uv5r.py Sun Jul 20 11:37:55 2014 -0700
+++ b/chirp/uv5r.py Tue Jul 22 19:31:33 2014 -0400
@@ -443,7 +443,7 @@
block1 = _read_block(radio, 0x1EC0, 0x40)
block2 = _read_block(radio, 0x1F00, 0x40)
block = block1 + block2
- version = block[48:64]
+ version = block[48:62]
return version
def _get_radio_special_block(radio):
@@ -573,7 +573,7 @@
)
# offset of fw version in image file
_fw_ver_file_start = 0x1838
- _fw_ver_file_stop = 0x1848
+ _fw_ver_file_stop = 0x1846
@classmethod
def get_prompts(cls):
@@ -896,12 +896,12 @@
def _my_version(self):
version_tag = _firmware_version_from_image(self)
- if 'BFB' in version_tag:
+ if 'BFS' in version_tag:
+ idx = version_tag.index("BFS") + 3
+ return int(version_tag[idx:idx + 3])
+ elif 'BFB' in version_tag:
idx = version_tag.index("BFB") + 3
return int(version_tag[idx:idx + 3])
- elif 'BFS' in version_tag:
- idx = version_tag.index("BFS") + 3
- return int(version_tag[idx:idx + 3])
elif 'BF82' in version_tag:
idx = version_tag.index("BF82") + 2
return int(version_tag[idx:idx + 4])
More information about the chirp_devel
mailing list