chirp_bugfix_5275_v1.patch

Initial patch to address this - Mathias Weyland, 10/26/2017 10:28 am

Download (4.5 kB)

b/chirp/drivers/alinco.py Tue Oct 24 22:12:54 2017 +0200
577 577
ul16 special_bank[7];
578 578
#seekto 0x1200;
579 579
struct {
580
    u8   unknown;
580
    u8   empty;
581 581
    ul32 freq;
582 582
    u8   mode;
583 583
    u8   step;
......
587 587
    u8   tx_tone;
588 588
    u8   rx_tone;
589 589
    u8   dcs;
590
#seek 3;
590
    ul24 unknown1;
591 591
    u8   skip;
592
#seek 12;
592
    ul32 unknown2;
593
    ul32 unknown3;
594
    ul32 unknown4;
593 595
    char name[32];
594 596
} memory[1000];
595 597
"""
......
747 749
        _mem = self._memobj.memory[number]
748 750
        mem = chirp_common.Memory()
749 751
        mem.number = number
750
        if _mem.unknown == 0:
752
        if _mem.empty == 0:
751 753
            mem.empty = True
752 754
        else:
755
            if _mem.unknown1 == 0xffffff:
756
                # Previous versions of this code have not touched those unknown
757
                # fields. They contain bytes of value if the channel is empty and
758
                # thus those bytes remain 0xff when the channel is put to use.
759
                # The radio is totally fine with this but the Alinco programming
760
                # software is not (see #5275). Thus, we set them to the correct
761
                # values manually to fix those images who are affected in this
762
                # manner.
763
                LOG.info("Fixing contradictory image (channel %d)" % number)
764
                _mem.unknown1 = 0x3e001c
765
                _mem.unknown2 = 0x0000000a
766
                _mem.unknown3 = 0x00000000
767
                _mem.unknown4 = 0x00000000
768

  
753 769
            mem.freq = int(_mem.freq)
754 770
            mem.mode = self.MODES[_mem.mode]
755 771
            mem.tuning_step = self.STEPS[_mem.step]
......
774 790
        # Get a low-level memory object mapped to the image
775 791
        _mem = self._memobj.memory[mem.number]
776 792
        if mem.empty:
777
            _mem.unknown = 0x00  # Maybe 0 is empty, 2 is used?
793
            _mem.set_raw("\xff" * (_mem.size()/8))
794
            _mem.empty = 0x00  # Maybe 0 is empty, 2 is used?
778 795
        else:
779
            _mem.unknown = 0x02
796
            _mem.empty = 0x02
780 797
            _mem.freq = mem.freq
781 798
            _mem.mode = self.MODES.index(mem.mode)
782 799
            _mem.step = self.STEPS.index(mem.tuning_step)
......
819 836
            _mem.dcs = DCS_CODES[self.VENDOR].index(mem.dtcs)
820 837
            _mem.skip = (mem.skip == "S")
821 838
            _mem.name = "\x00".join(mem.name).ljust(32, "\x00")
839
            _mem.unknown1 = 0x3e001c
840
            _mem.unknown2 = 0x0000000a
841
            _mem.unknown3 = 0x00000000
842
            _mem.unknown4 = 0x00000000