From ff24e5a6d9780d4970bd47ca239baf5a90d00626 Mon Sep 17 00:00:00 2001 From: "Iain R. Learmonth" Date: Sun, 3 May 2015 18:21:12 +0100 Subject: Imported Upstream version 0.4.1 --- PKG-INFO | 2 +- chirp/__init__.py | 2 +- chirp/uv5r.py | 28 ++++++++++++++++++++++++++-- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/PKG-INFO b/PKG-INFO index 1d5e8a6..42fa59a 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: chirp -Version: 0.4.0 +Version: 0.4.1 Summary: UNKNOWN Home-page: UNKNOWN Author: UNKNOWN diff --git a/chirp/__init__.py b/chirp/__init__.py index e676a98..bf501cc 100644 --- a/chirp/__init__.py +++ b/chirp/__init__.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -CHIRP_VERSION="0.4.0" +CHIRP_VERSION="0.4.1" import os import sys diff --git a/chirp/uv5r.py b/chirp/uv5r.py index dcd3afc..54b743b 100644 --- a/chirp/uv5r.py +++ b/chirp/uv5r.py @@ -360,6 +360,16 @@ def _firmware_version_from_image(radio): print "_firmware_version_from_image: " + util.hexprint(version) return version +def _special_block_from_data(data, special_block_start, special_block_stop): + special_block_tag = data[special_block_start:special_block_stop] + return special_block_tag + +def _special_block_from_image(radio): + special_block = _special_block_from_data(radio.get_mmap(), 0x0CFA, 0x0D01) + if CHIRP_DEBUG: + print "_special_block_from_image: " + util.hexprint(special_block) + return special_block + def _do_ident(radio, magic): serial = radio.pipe serial.setTimeout(1) @@ -427,6 +437,11 @@ def _get_radio_firmware_version(radio): version = block[48:64] return version +def _get_radio_special_block(radio): + block = _read_block(radio, 0xCF0, 0x40) + special_block = block[2:9] + return special_block + def _ident_radio(radio): for magic in radio._idents: error = None @@ -479,13 +494,22 @@ def _do_upload(radio): image_version = _firmware_version_from_image(radio) radio_version = _get_radio_firmware_version(radio) - print "Image is %s" % repr(image_version) - print "Radio is %s" % repr(radio_version) + print "Image Version is %s" % repr(image_version) + print "Radio Version is %s" % repr(radio_version) if not any(type in radio_version for type in BASETYPE_LIST): raise errors.RadioError("Unsupported firmware version: `%s'" % radio_version) + image_special_block = _special_block_from_image(radio) + radio_special_block = _get_radio_special_block(radio) + print "Image Special Block is " + util.hexprint(image_special_block) + print "Radio Special Block is " + util.hexprint(radio_special_block) + + if image_special_block != radio_special_block: + raise errors.RadioError("Image not supported by radio: `%s'" % + radio_special_block) + # Main block for i in range(0x08, 0x1808, 0x10): _send_block(radio, i - 0x08, radio.get_mmap()[i:i + 0x10]) -- cgit v1.2.3