[chirp_devel] [PATCH] [rt22] patch radio ID for RT-622
Jim Unroe
Tue Oct 20 14:37:41 PDT 2020
Dmitri,
Isn't this going to change these bytes for all models? For example, my
regular RT22 which has "P32073" at 0x01b8 will be overwritten with
"P3207!". I'm afraid to try this to see because I have already ruined
2 RT22 FRS models trying to add them to CHIRP.
Since it appears to me that this radio (and its RT22 FRS cousin) has
"P3207!" stored at 0x0000 and 0x0200, there couldn't there be some
kind of check that when 0x01b8-0x01bd is 0x00 * 6, then the value in
0x0000-0x0006 (or 0x0200-0x0206) could be sent at 0x01b8 during the
upload?
I am really glad that you have discovered this because, as I mentioned
above, I have already made 2 RT22 FRS radios unusable. The factory
software asks for a password now (for download and upload) and so far
I have not been able to discover what it is.
Jim KC9HI
On Sun, Oct 18, 2020 at 10:43 PM Dmitry Baryshkov via chirp_devel
<chirp_devel at intrepid.danplanet.com> wrote:
>
> # HG changeset patch
> # User Dmitry Baryshkov <dbaryshkov at gmail.com>
> # Date 1603075401 -10800
> # Mon Oct 19 05:43:21 2020 +0300
> # Node ID 1552c486144d10aff7a63ff6d0a14b38c2c52544
> # Parent de5d23f4a4235f42a3dee54e2054def2ac224572
> [rt22] patch radio ID for RT-622
>
> For RT-622 to update memory correctly, radio ID has to be written at the
> address 0x1b8. When reading this address reads as 0. So, patch the data during
> write operation to stop Chirp from overwriting radio ID on these radios.
>
> I don't know if this operation has to be performed for other radio IDs as well,
> so this patching is limited to RT-622.
>
> diff --git a/chirp/drivers/retevis_rt22.py b/chirp/drivers/retevis_rt22.py
> --- a/chirp/drivers/retevis_rt22.py
> +++ b/chirp/drivers/retevis_rt22.py
> @@ -205,7 +205,15 @@
> serial = radio.pipe
>
> cmd = struct.pack(">cHb", 'W', block_addr, block_size)
> - data = radio.get_mmap()[block_addr:block_addr + block_size]
> + mmap = radio.get_mmap()
> + data = mmap[block_addr:block_addr + block_size]
> +
> + # For some radios (RT-622) memory at 0x1b8 reads as 0, but radio ID should
> + # be written instead
> + if block_addr == radio._patch_addr:
> + for fp in radio._patch_id:
> + if fp in mmap[0:radio._patch_len]:
> + data = mmap[0:radio._patch_len] + data[radio._patch_len:]
>
> LOG.debug("Writing Data:")
> LOG.debug(util.hexprint(cmd + data))
> @@ -298,6 +306,9 @@
> _memsize = 0x0400
> _block_size = 0x40
> _fileid = ["P32073", "P3" + "\x00\x00\x00" + "3", "P3207!"]
> + _patch_id = ["P3207!"]
> + _patch_len = 8
> + _patch_addr = 0x1b8
>
> def get_features(self):
> rf = chirp_common.RadioFeatures()
>
> _______________________________________________
> chirp_devel mailing list
> chirp_devel at intrepid.danplanet.com
> http://intrepid.danplanet.com/mailman/listinfo/chirp_devel
> Developer docs: http://chirp.danplanet.com/projects/chirp/wiki/Developers
More information about the chirp_devel
mailing list