This file is indexed.

/usr/share/pyshared/chirp/ict70.py is in chirp 0.1.12-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# Copyright 2011 Dan Smith <dsmith@danplanet.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from chirp import chirp_common, icf, errors, util
from chirp import bitwise
from chirp.memmap import MemoryMap

mem_format = """
struct {
  u24 freq;
  ul16 offset;
  char name[6];
  u8 unknown2:2,
     rtone:6;
  u8 unknown3:2,
     ctone:6;
  u8 unknown4:1,
     dtcs:7;
  u8 tuning_step:4,
     narrow:1,
     unknown5:1,
     duplex:2;
  u8 unknown6:1,
     power:2,
     dtcs_polarity:2,
     tmode:3;
} memory[300];

#seekto 0x12E0;
u8 used[38];

#seekto 0x1306;
u8 skips[38];

#seekto 0x132C;
u8 pskips[38];

#seekto 0x1360;
struct {
  u8 bank;
  u8 index;
} banks[300];

#seekto 0x16D0;
struct {
  char name[6];
} bank_names[26];

"""

TMODES = ["", "Tone", "TSQL", "TSQL", "DTCS", "DTCS"]
DUPLEX = ["", "-", "+"]
DTCS_POLARITY = ["NN", "NR", "RN", "RR"]
TUNING_STEPS = [5.0, "", "", "", 10.0, 12.5, 15.0, 20.0, 25.0, 30.0,
                50.0, 100.0, 125.0, 200.0]
POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5),
                chirp_common.PowerLevel("Low", watts=0.5),
                chirp_common.PowerLevel("Mid", watts=1.0),
                ]

class ICT70Radio(icf.IcomCloneModeRadio):
    VENDOR = "Icom"
    MODEL = "IC-T70"

    _model = "\x32\x53\x00\x01"
    _memsize = 0x19E0
    _endframe = "Icom Inc\x2eCF"

    _ranges = [(0x0000, 0x19E0, 32)]

    def get_features(self):
        rf = chirp_common.RadioFeatures()
        rf.memory_bounds = (0, 299)
        rf.valid_tmodes = TMODES
        rf.valid_duplexes = DUPLEX
        rf.valid_power_levels = POWER_LEVELS
        rf.valid_modes = ["FM", "NFM"]
        rf.valid_bands = [(136000000, 174000000), (400000000, 479000000)]
        rf.valid_skips = ["", "S", "P"]
        rf.valid_name_length = 6
        rf.has_ctone = True
        rf.has_bank_index = True
        return rf

    def process_mmap(self):
        self._memobj = bitwise.parse(mem_format, self._mmap)

    def get_banks(self):
        banks = []
        for i in range(0, 26):
            name = str(self._memobj.bank_names[i].name)
            banks.append(name.rstrip())
        return banks

    def set_banks(self, banks):
        for i in range(0, 26):
            self._memobj.bank_names[i].name = banks[i].upper().ljust(6)[:6]

    def get_available_bank_index(self, bank):
        indexes = []
        for i in range(0, 299):
            m = self.get_memory(i)
            if m.bank == bank and m.bank_index >= 0:
                indexes.append(m.bank_index)

        for i in range(0, 256):
            if i not in indexes:
                return i

        raise errors.RadioError("Out of slots in this bank")

    def get_raw_memory(self, number):
        return repr(self._memobj.memory[number])

    def get_memory(self, number):
        bit = 1 << (number % 8)
        byte = int(number / 8)

        _mem = self._memobj.memory[number]
        _usd = self._memobj.used[byte]
        _bnk = self._memobj.banks[number]
        _skp = self._memobj.skips[byte]
        _psk = self._memobj.pskips[byte]

        mem = chirp_common.Memory()
        mem.number = number

        if _usd & bit:
            mem.empty = True
            return mem

        if _mem.freq & 0x800000:
            mem.freq = (_mem.freq & ~0x800000) * 6250
        else:
            mem.freq = _mem.freq * 5000
        mem.offset = _mem.offset * 5000
        mem.name = str(_mem.name).rstrip()
        mem.rtone = chirp_common.TONES[_mem.rtone]
        mem.ctone = chirp_common.TONES[_mem.ctone]
        mem.dtcs = chirp_common.DTCS_CODES[_mem.dtcs]
        mem.tuning_step = TUNING_STEPS[_mem.tuning_step]
        mem.mode = _mem.narrow and "NFM" or "FM"
        mem.duplex = DUPLEX[_mem.duplex]
        mem.power = POWER_LEVELS[_mem.power]
        mem.dtcs_polarity = DTCS_POLARITY[_mem.dtcs_polarity]
        mem.tmode = TMODES[_mem.tmode]

        if _bnk.bank != 0xFF:
            mem.bank = _bnk.bank
            mem.bank_index = _bnk.index

        mem.skip = (_psk & bit and "P") or (_skp & bit and "S") or ""
        
        return mem

    def set_memory(self, mem):
        bit = 1 << (mem.number % 8)
        byte = int(mem.number / 8)

        _mem = self._memobj.memory[mem.number]
        _usd = self._memobj.used[byte]
        _bnk = self._memobj.banks[mem.number]
        _skp = self._memobj.skips[byte]
        _psk = self._memobj.pskips[byte]

        _mem.set_raw("\x00" * (_mem.size() / 8))

        if mem.empty:
            _usd |= bit
            return

        _usd &= ~bit

        if chirp_common.is_12_5(mem.freq):
            _mem.freq = (mem.freq / 6250) | 0x800000
        else:
            _mem.freq = mem.freq / 5000
        _mem.offset = mem.offset / 5000
        _mem.name = mem.name.ljust(6)[:6]
        _mem.rtone = chirp_common.TONES.index(mem.rtone)
        _mem.ctone = chirp_common.TONES.index(mem.ctone)
        _mem.dtcs = chirp_common.DTCS_CODES.index(mem.dtcs)
        _mem.tuning_step = TUNING_STEPS.index(mem.tuning_step)
        _mem.narrow = mem.mode == "NFM"
        _mem.duplex = DUPLEX.index(mem.duplex)
        _mem.dtcs_polarity = DTCS_POLARITY.index(mem.dtcs_polarity)
        _mem.tmode = TMODES.index(mem.tmode)
        if mem.power:
            _mem.power = POWER_LEVELS.index(mem.power)
        else:
            _mem.power = 0

        if mem.bank is None:
            _bnk.bank = 0xFF
            _bnk.index = 0xFF
        else:
            _bnk.bank = mem.bank
            _bnk.index = mem.bank_index

        if mem.skip == "S":
            _skp |= bit
            _psk &= ~bit
        elif mem.skip == "P":
            _skp &= ~bit
            _psk |= bit
        else:
            _skp &= ~bit
            _psk &= ~bit