# HG changeset patch # User Jim Unroe rock.unroe@gmail.com # Date 1518142573 18000 # Node ID 96ffc23b6e5e43de0f19e086527302e672043a76 # Parent e3b90fa8c3160eb3ff9a44a17b789e572d379b07 [MURS-V1] Prepare CHIRP for BTech MURS-V1 (update baofeng_common.py)
The BTech GMRS-V1 and BTech MURS-V1 are very different radios but both respond to the same "magic". This patch provides checks to make sure...
1. the model selected by the user matches the physical radio model. 2. the image being uploaded matches the physical radio model.
related to #5255
diff -r e3b90fa8c316 -r 96ffc23b6e5e chirp/drivers/baofeng_common.py --- a/chirp/drivers/baofeng_common.py Fri Feb 02 17:22:29 2018 -0800 +++ b/chirp/drivers/baofeng_common.py Thu Feb 08 21:16:13 2018 -0500 @@ -185,6 +185,13 @@
if radio_ident == "\xFF" * 16: ident += radio.MODEL.ljust(8) + elif radio.MODEL in ("GMRS-V1", "MURS-V1"): + # check if radio_ident is OK + if not radio_ident[:7] in radio._fileid: + msg = "Incorrect model ID, got this:\n\n" + msg += util.hexprint(radio_ident) + LOG.debug(msg) + raise errors.RadioError("Incorrect 'Model' selected.")
# UI progress status = chirp_common.Status() @@ -242,6 +249,14 @@ LOG.info("Image firmware version:") LOG.debug(util.hexprint(image_ident))
+ if radio.MODEL in ("GMRS-V1", "MURS-V1"): + # check if radio_ident is OK + if radio_ident != image_ident: + msg = "Incorrect model ID, got this:\n\n" + msg += util.hexprint(radio_ident) + LOG.debug(msg) + raise errors.RadioError("Image not supported by radio") + if radio_ident != "0xFF" * 16 and image_ident == radio_ident: _ranges = radio._ranges else: @@ -319,7 +334,9 @@ """Upload to radio""" try: _upload(self) - except: + except errors.RadioError: + raise + except Exception, e: # If anything unexpected happens, make sure we raise # a RadioError and log the problem LOG.exception('Unexpected error during upload')