[chirp_devel] [PATCH] [UV-5R] Prevent selection of incorrect Baofeng radio model when downloading

Jim Unroe
Sun Aug 17 02:50:55 PDT 2014


# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1408268367 14400
# Node ID cc8de04681f574d118040ad2a8f90710718e9f87
# Parent  7c24229fb2727c86ce11fca9a8c449f7ef4c3eed
[UV-5R] Prevent selection of incorrect Baofeng radio model when downloading

Retrieve the firmware version of the radio prior to download and abort with
an error message when none of the selected model's basetype strings are
found in the radio's firmware version.

Bug #1851

diff -r 7c24229fb272 -r cc8de04681f5 chirp/uv5r.py
--- a/chirp/uv5r.py	Sun Aug 17 04:58:13 2014 -0400
+++ b/chirp/uv5r.py	Sun Aug 17 05:39:27 2014 -0400
@@ -468,6 +468,12 @@
 def _do_download(radio):
     data = _ident_radio(radio)
 
+    radio_version = _get_radio_firmware_version(radio)
+    print "Radio Version is %s" % repr(radio_version)
+
+    if not any(type in radio_version for type in radio._basetype):
+        raise errors.RadioError("Incorrect 'Model' selected.")
+
     # Main block
     if CHIRP_DEBUG:
         print "downloading main block..."



More information about the chirp_devel mailing list