Bug #10001 » chirp-py3-issue10001.patch
chirp/drivers/alinco.py | ||
---|---|---|
199 | 199 |
self._mmap = self._download(self._memsize) |
200 | 200 |
except errors.RadioError: |
201 | 201 |
raise |
202 |
except Exception, e:
|
|
202 |
except Exception as e:
|
|
203 | 203 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
204 | 204 |
self.process_mmap() |
205 | 205 | |
... | ... | |
208 | 208 |
self._upload(self._memsize) |
209 | 209 |
except errors.RadioError: |
210 | 210 |
raise |
211 |
except Exception, e:
|
|
211 |
except Exception as e:
|
|
212 | 212 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
213 | 213 | |
214 | 214 |
def get_raw_memory(self, number): |
chirp/drivers/anytone.py | ||
---|---|---|
177 | 177 |
try: |
178 | 178 |
radio.pipe.write(data) |
179 | 179 |
radio.pipe.read(len(data)) |
180 |
except Exception, e:
|
|
180 |
except Exception as e:
|
|
181 | 181 |
LOG.error("Error writing to radio: %s" % e) |
182 | 182 |
raise errors.RadioError("Unable to write to radio") |
183 | 183 | |
... | ... | |
185 | 185 |
def _read(radio, length): |
186 | 186 |
try: |
187 | 187 |
data = radio.pipe.read(length) |
188 |
except Exception, e:
|
|
188 |
except Exception as e:
|
|
189 | 189 |
LOG.error("Error reading from radio: %s" % e) |
190 | 190 |
raise errors.RadioError("Unable to read from radio") |
191 | 191 |
chirp/drivers/anytone_ht.py | ||
---|---|---|
233 | 233 |
def _echo_write(radio, data): |
234 | 234 |
try: |
235 | 235 |
radio.pipe.write(data) |
236 |
except Exception, e:
|
|
236 |
except Exception as e:
|
|
237 | 237 |
LOG.error("Error writing to radio: %s" % e) |
238 | 238 |
raise errors.RadioError("Unable to write to radio") |
239 | 239 | |
... | ... | |
241 | 241 |
def _read(radio, length): |
242 | 242 |
try: |
243 | 243 |
data = radio.pipe.read(length) |
244 |
except Exception, e:
|
|
244 |
except Exception as e:
|
|
245 | 245 |
LOG.error("Error reading from radio: %s" % e) |
246 | 246 |
raise errors.RadioError("Unable to read from radio") |
247 | 247 | |
... | ... | |
930 | 930 |
else: |
931 | 931 |
LOG.debug("Setting %s = %s" % (setting, element.value)) |
932 | 932 |
setattr(obj, setting, element.value) |
933 |
except Exception, e:
|
|
933 |
except Exception as e:
|
|
934 | 934 |
LOG.debug(element.get_name()) |
935 | 935 |
raise |
936 | 936 |
chirp/drivers/ap510.py | ||
---|---|---|
44 | 44 | |
45 | 45 |
def drain(pipe): |
46 | 46 |
"""Chew up any data waiting on @pipe""" |
47 |
for x in xrange(3):
|
|
47 |
for x in range(3): |
|
48 | 48 |
buf = pipe.read(4096) |
49 | 49 |
if not buf: |
50 | 50 |
return |
... | ... | |
53 | 53 | |
54 | 54 |
def enter_setup(pipe): |
55 | 55 |
"""Put AP510 in configuration mode.""" |
56 |
for x in xrange(30):
|
|
56 |
for x in range(30): |
|
57 | 57 |
if x % 2: |
58 | 58 |
pipe.write("@SETUP") |
59 | 59 |
else: |
... | ... | |
84 | 84 |
radio.pipe.write("@DISP") |
85 | 85 |
buf = "" |
86 | 86 | |
87 |
for status.cur in xrange(status.cur, status.max):
|
|
87 |
for status.cur in range(status.cur, status.max): |
|
88 | 88 |
buf += radio.pipe.read(1024) |
89 | 89 |
if buf.endswith("\r\n"): |
90 | 90 |
status.cur = status.max |
... | ... | |
242 | 242 | |
243 | 243 |
class AP510Memory20141215(AP510Memory): |
244 | 244 |
"""Compatible with firmware version 20141215""" |
245 |
ATTR_MAP = dict(AP510Memory.ATTR_MAP.items() + { |
|
245 |
ATTR_MAP = dict(AP510Memory.ATTR_MAP) |
|
246 |
ATTR_MAP.update( { |
|
246 | 247 |
'tx_volume': '21', # 1-6 |
247 | 248 |
'rx_volume': '22', # 1-9 |
248 | 249 |
'tx_power': '23', # 1: 1 watt, 0: 0.5 watt |
... | ... | |
252 | 253 |
'path3': '27', # like "WIDE1 1" else "0" |
253 | 254 |
'multiple': '28', |
254 | 255 |
'auto_on': '29', |
255 |
}.items())
|
|
256 |
}) |
|
256 | 257 | |
257 | 258 |
def get_multiple(self): |
258 | 259 |
return dict(zip( |
... | ... | |
380 | 381 |
data = download(self) |
381 | 382 |
except errors.RadioError: |
382 | 383 |
raise |
383 |
except Exception, e:
|
|
384 |
except Exception as e:
|
|
384 | 385 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
385 | 386 | |
386 | 387 |
# _mmap isn't a Chirp MemoryMap, but since AP510Memory implements |
... | ... | |
398 | 399 |
upload(self) |
399 | 400 |
except errors.RadioError: |
400 | 401 |
raise |
401 |
except Exception, e:
|
|
402 |
except Exception as e:
|
|
402 | 403 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
403 | 404 | |
404 | 405 |
def load_mmap(self, filename): |
405 | 406 |
"""Load the radio's memory map from @filename""" |
406 |
mapfile = file(filename, "rb")
|
|
407 |
mapfile = open(filename, "rb")
|
|
407 | 408 |
data = mapfile.read() |
408 | 409 |
if data.startswith('\r\n00=%s 20141215' % self._model): |
409 | 410 |
self._mmap = AP510Memory20141215(data) |
chirp/drivers/baofeng_common.py | ||
---|---|---|
16 | 16 | |
17 | 17 |
"""common functions for Baofeng (or similar) handheld radios""" |
18 | 18 | |
19 |
from __future__ import print_function |
|
20 | ||
19 | 21 |
import time |
20 | 22 |
import struct |
21 | 23 |
import logging |
... | ... | |
164 | 166 |
try: |
165 | 167 |
data = _do_ident(radio, magic) |
166 | 168 |
return data |
167 |
except errors.RadioError, e:
|
|
168 |
print e
|
|
169 |
except errors.RadioError as e:
|
|
170 |
print(e)
|
|
169 | 171 |
error = e |
170 | 172 |
time.sleep(2) |
171 | 173 |
if error: |
... | ... | |
336 | 338 |
_upload(self) |
337 | 339 |
except errors.RadioError: |
338 | 340 |
raise |
339 |
except Exception, e:
|
|
341 |
except Exception as e:
|
|
340 | 342 |
# If anything unexpected happens, make sure we raise |
341 | 343 |
# a RadioError and log the problem |
342 | 344 |
LOG.exception('Unexpected error during upload') |
... | ... | |
622 | 624 |
elif element.value.get_mutable(): |
623 | 625 |
LOG.debug("Setting %s = %s" % (setting, element.value)) |
624 | 626 |
setattr(obj, setting, element.value) |
625 |
except Exception, e:
|
|
627 |
except Exception as e:
|
|
626 | 628 |
LOG.debug(element.get_name()) |
627 | 629 |
raise |
628 | 630 | |
... | ... | |
636 | 638 |
value = int(val.get_value() * 10) |
637 | 639 |
LOG.debug("Setting fm_presets = %s" % (value)) |
638 | 640 |
self._memobj.fm_presets = value |
639 |
except Exception, e:
|
|
641 |
except Exception as e:
|
|
640 | 642 |
LOG.debug(element.get_name()) |
641 | 643 |
raise |
chirp/drivers/baofeng_uv3r.py | ||
---|---|---|
19 | 19 |
import os |
20 | 20 |
import logging |
21 | 21 | |
22 |
from wouxun_common import do_download, do_upload |
|
22 |
from chirp.drivers.wouxun_common import do_download, do_upload
|
|
23 | 23 |
from chirp import util, chirp_common, bitwise, errors, directory |
24 | 24 |
from chirp.settings import RadioSetting, RadioSettingGroup, \ |
25 | 25 |
RadioSettingValueBoolean, RadioSettingValueList, \ |
... | ... | |
51 | 51 |
for _i in range(0, 10): |
52 | 52 |
try: |
53 | 53 |
return _uv3r_prep(radio) |
54 |
except errors.RadioError, e:
|
|
54 |
except errors.RadioError as e:
|
|
55 | 55 |
time.sleep(1) |
56 | ||
57 |
raise e |
|
56 |
raise e |
|
58 | 57 | |
59 | 58 | |
60 | 59 |
def uv3r_download(radio): |
... | ... | |
64 | 63 |
return do_download(radio, 0x0000, 0x0E40, 0x0010) |
65 | 64 |
except errors.RadioError: |
66 | 65 |
raise |
67 |
except Exception, e:
|
|
66 |
except Exception as e:
|
|
68 | 67 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
69 | 68 | |
70 | 69 | |
... | ... | |
75 | 74 |
return do_upload(radio, 0x0000, 0x0E40, 0x0010) |
76 | 75 |
except errors.RadioError: |
77 | 76 |
raise |
78 |
except Exception, e:
|
|
77 |
except Exception as e:
|
|
79 | 78 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
80 | 79 | |
81 | 80 | |
... | ... | |
623 | 622 |
else: |
624 | 623 |
LOG.debug("Setting %s = %s" % (setting, element.value)) |
625 | 624 |
setattr(obj, setting, element.value) |
626 |
except Exception, e:
|
|
625 |
except Exception as e:
|
|
627 | 626 |
LOG.debug(element.get_name()) |
628 | 627 |
raise |
629 | 628 | |
... | ... | |
639 | 638 |
LOG.debug("Setting fm_presets[%1i] = %s" % (index, value)) |
640 | 639 |
setting = self._memobj.fm_presets |
641 | 640 |
setting[index] = value |
642 |
except Exception, e:
|
|
641 |
except Exception as e:
|
|
643 | 642 |
LOG.debug(element.get_name()) |
644 | 643 |
raise |
645 | 644 |
chirp/drivers/bf-t1.py | ||
---|---|---|
225 | 225 | |
226 | 226 |
except errors.RadioError: |
227 | 227 |
raise |
228 |
except Exception, e:
|
|
228 |
except Exception as e:
|
|
229 | 229 |
raise errors.RadioError("Error sending Magic to radio:\n%s" % e) |
230 | 230 | |
231 | 231 | |
... | ... | |
561 | 561 |
_upload(self) |
562 | 562 |
except errors.RadioError: |
563 | 563 |
raise |
564 |
except Exception, e:
|
|
564 |
except Exception as e:
|
|
565 | 565 |
raise errors.RadioError("Error: %s" % e) |
566 | 566 | |
567 | 567 |
def _decode_tone(self, val, inv): |
... | ... | |
894 | 894 |
setattr(_settings, name, value) |
895 | 895 | |
896 | 896 |
LOG.debug("Setting %s: %s" % (name, value)) |
897 |
except Exception, e:
|
|
897 |
except Exception as e:
|
|
898 | 898 |
LOG.debug(element.get_name()) |
899 | 899 |
raise |
900 | 900 |
chirp/drivers/bj9900.py | ||
---|---|---|
178 | 178 |
self._mmap = self._clone_in() |
179 | 179 |
except errors.RadioError: |
180 | 180 |
raise |
181 |
except Exception, e:
|
|
181 |
except Exception as e:
|
|
182 | 182 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
183 | 183 |
self.process_mmap() |
184 | 184 | |
... | ... | |
187 | 187 |
self._clone_out() |
188 | 188 |
except errors.RadioError: |
189 | 189 |
raise |
190 |
except Exception, e:
|
|
190 |
except Exception as e:
|
|
191 | 191 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
192 | 192 | |
193 | 193 |
def process_mmap(self): |
chirp/drivers/bjuv55.py | ||
---|---|---|
647 | 647 |
value = int(val.get_value() * 10 - 870) |
648 | 648 |
LOG.debug("Setting fm_preset = %s" % (value)) |
649 | 649 |
self._memobj.fm_preset = value |
650 |
except Exception, e:
|
|
650 |
except Exception as e:
|
|
651 | 651 |
LOG.debug(element.get_name()) |
652 | 652 |
raise |
chirp/drivers/fd268.py | ||
---|---|---|
790 | 790 |
obj = getattr(_mem, sett) |
791 | 791 |
setattr(obj, name, element.value) |
792 | 792 | |
793 |
except AttributeError, e:
|
|
793 |
except AttributeError as e:
|
|
794 | 794 |
m = "Setting %s is not in this setting block" % name |
795 | 795 |
LOG.debug(m) |
796 | 796 | |
797 |
except Exception, e:
|
|
797 |
except Exception as e:
|
|
798 | 798 |
LOG.debug(element.get_name()) |
799 | 799 |
raise |
800 | 800 |
chirp/drivers/ft1d.py | ||
---|---|---|
1890 | 1890 |
except AttributeError as e: |
1891 | 1891 |
LOG.error("Setting %s is not in the memory map: %s" % |
1892 | 1892 |
(element.get_name(), e)) |
1893 |
except Exception, e:
|
|
1893 |
except Exception as e:
|
|
1894 | 1894 |
LOG.debug(element.get_name()) |
1895 | 1895 |
raise |
1896 | 1896 |
chirp/drivers/ft2800.py | ||
---|---|---|
18 | 18 |
import logging |
19 | 19 | |
20 | 20 |
from chirp import util, memmap, chirp_common, bitwise, directory, errors |
21 |
from yaesu_clone import YaesuCloneModeRadio |
|
21 |
from chirp.drivers.yaesu_clone import YaesuCloneModeRadio
|
|
22 | 22 | |
23 | 23 |
LOG = logging.getLogger(__name__) |
24 | 24 | |
... | ... | |
201 | 201 |
self._mmap = _download(self) |
202 | 202 |
except errors.RadioError: |
203 | 203 |
raise |
204 |
except Exception, e:
|
|
204 |
except Exception as e:
|
|
205 | 205 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
206 | 206 |
LOG.info("Downloaded in %.2f sec" % (time.time() - start)) |
207 | 207 |
self.process_mmap() |
... | ... | |
214 | 214 |
_upload(self) |
215 | 215 |
except errors.RadioError: |
216 | 216 |
raise |
217 |
except Exception, e:
|
|
217 |
except Exception as e:
|
|
218 | 218 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
219 | 219 |
LOG.info("Uploaded in %.2f sec" % (time.time() - start)) |
220 | 220 |
chirp/drivers/ft2900.py | ||
---|---|---|
537 | 537 |
self._mmap = _download(self) |
538 | 538 |
except errors.RadioError: |
539 | 539 |
raise |
540 |
except Exception, e:
|
|
540 |
except Exception as e:
|
|
541 | 541 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
542 | 542 |
LOG.info("Downloaded in %.2f sec" % (time.time() - start)) |
543 | 543 |
self.process_mmap() |
... | ... | |
549 | 549 |
_upload(self) |
550 | 550 |
except errors.RadioError: |
551 | 551 |
raise |
552 |
except Exception, e:
|
|
552 |
except Exception as e:
|
|
553 | 553 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
554 | 554 |
LOG.info("Uploaded in %.2f sec" % (time.time() - start)) |
555 | 555 | |
... | ... | |
1210 | 1210 |
setattr(_settings, name, value) |
1211 | 1211 | |
1212 | 1212 |
LOG.debug("Setting %s: %s" % (name, value)) |
1213 |
except Exception, e:
|
|
1213 |
except Exception as e:
|
|
1214 | 1214 |
LOG.debug(element.get_name()) |
1215 | 1215 |
raise |
1216 | 1216 |
chirp/drivers/ft450d.py | ||
---|---|---|
304 | 304 |
struct mem_struct current; |
305 | 305 |
|
306 | 306 |
""" |
307 |
_CALLSIGN_CHARSET = [chr(x) for x in range(ord("0"), ord("9") + 1) +
|
|
308 |
range(ord("A"), ord("Z") + 1) + [ord(" ")]]
|
|
307 |
_CALLSIGN_CHARSET = [chr(x) for x in list(range(ord("0"), ord("9") + 1)) +
|
|
308 |
list(range(ord("A"), ord("Z") + 1)) + [ord(" ")]]
|
|
309 | 309 |
_CALLSIGN_CHARSET_REV = dict(zip(_CALLSIGN_CHARSET, |
310 |
range(0, len(_CALLSIGN_CHARSET))))
|
|
310 |
list(range(0, len(_CALLSIGN_CHARSET)))))
|
|
311 | 311 |
|
312 | 312 |
# WARNING Indecis are hard wired in get/set_memory code !!! |
313 | 313 |
# Channels print in + increasing index order (PMS first) |
... | ... | |
499 | 499 |
self._mmap = self._clone_in() |
500 | 500 |
except errors.RadioError: |
501 | 501 |
raise |
502 |
except Exception, e:
|
|
502 |
except Exception as e:
|
|
503 | 503 |
raise errors.RadioError("Failed to communicate with radio: %s" |
504 | 504 |
% e) |
505 | 505 |
self.process_mmap() |
... | ... | |
509 | 509 |
self._clone_out() |
510 | 510 |
except errors.RadioError: |
511 | 511 |
raise |
512 |
except Exception, e:
|
|
512 |
except Exception as e:
|
|
513 | 513 |
raise errors.RadioError("Failed to communicate with radio: %s" |
514 | 514 |
% e) |
515 | 515 |
|
... | ... | |
1489 | 1489 |
elif element.value.get_mutable(): |
1490 | 1490 |
LOG.debug("Setting %s = %s" % (setting, element.value)) |
1491 | 1491 |
setattr(obj, setting, element.value) |
1492 |
except Exception, e:
|
|
1492 |
except Exception as e:
|
|
1493 | 1493 |
LOG.debug(element.get_name()) |
1494 | 1494 |
raise |
chirp/drivers/ft50.py | ||
---|---|---|
586 | 586 |
def _clone_out(radio): |
587 | 587 |
try: |
588 | 588 |
return __clone_out(radio) |
589 |
except Exception, e:
|
|
589 |
except Exception as e:
|
|
590 | 590 |
raise errors.RadioError("Failed to communicate with the radio: %s" % e) |
591 | 591 | |
592 | 592 |
chirp/drivers/ft60.py | ||
---|---|---|
403 | 403 |
self._mmap = _download(self) |
404 | 404 |
except errors.RadioError: |
405 | 405 |
raise |
406 |
except Exception, e:
|
|
406 |
except Exception as e:
|
|
407 | 407 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
408 | 408 |
self.process_mmap() |
409 | 409 |
self.check_checksums() |
... | ... | |
414 | 414 |
_upload(self) |
415 | 415 |
except errors.RadioError: |
416 | 416 |
raise |
417 |
except Exception, e:
|
|
417 |
except Exception as e:
|
|
418 | 418 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
419 | 419 | |
420 | 420 |
def process_mmap(self): |
... | ... | |
716 | 716 |
setattr(_settings, name, value) |
717 | 717 | |
718 | 718 |
LOG.debug("Setting %s: %s" % (name, value)) |
719 |
except Exception, e:
|
|
719 |
except Exception as e:
|
|
720 | 720 |
LOG.debug(element.get_name()) |
721 | 721 |
raise |
722 | 722 |
chirp/drivers/ft70.py | ||
---|---|---|
527 | 527 |
_DG_ID = ["%d" % x for x in range(0, 100)] |
528 | 528 |
_GM_RING = ("OFF", "IN RING", "AlWAYS") |
529 | 529 |
_GM_INTERVAL = ("LONG", "NORMAL", "OFF") |
530 |
|
|
531 |
_MYCALL_CHR_SET = list(string.uppercase) + list(string.digits) + ['-','/' ]
|
|
530 |
#TODO: 2to3 python3 string.uppercase removed; do we need python2 string.uppercase locale dependent functionality? https://stackoverflow.com/questions/4942239/python-string-uppercase-vs-string-ascii-uppercase |
|
531 |
_MYCALL_CHR_SET = list(string.ascii_uppercase) + list(string.digits) + ['-','/' ]
|
|
532 | 532 |
|
533 | 533 |
@classmethod |
534 | 534 |
def get_prompts(cls): |
... | ... | |
1162 | 1162 |
except AttributeError as e: |
1163 | 1163 |
LOG.error("Setting %s is not in the memory map: %s" % |
1164 | 1164 |
(element.get_name(), e)) |
1165 |
except Exception, e:
|
|
1165 |
except Exception as e:
|
|
1166 | 1166 |
LOG.debug(element.get_name()) |
1167 | 1167 |
raise |
1168 | 1168 |
|
chirp/drivers/ft7100.py | ||
---|---|---|
568 | 568 |
self._mmap = _download(self) |
569 | 569 |
except errors.RadioError: |
570 | 570 |
raise |
571 |
except Exception, e:
|
|
571 |
except Exception as e:
|
|
572 | 572 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
573 | 573 |
LOG.info("Downloaded in %.2f sec", (time.time() - start)) |
574 | 574 |
self.process_mmap() |
... | ... | |
580 | 580 |
_upload(self) |
581 | 581 |
except errors.RadioError: |
582 | 582 |
raise |
583 |
except Exception, e:
|
|
583 |
except Exception as e:
|
|
584 | 584 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
585 | 585 |
LOG.info("Uploaded in %.2f sec", (time.time() - start)) |
586 | 586 | |
... | ... | |
1091 | 1091 |
setattr(_overlay, name, value) |
1092 | 1092 | |
1093 | 1093 |
LOG.debug("Setting %s: %s", name, value) |
1094 |
except Exception, e:
|
|
1094 |
except Exception as e:
|
|
1095 | 1095 |
LOG.debug(element.get_name()) |
1096 | 1096 |
raise |
1097 | 1097 |
chirp/drivers/ft8100.py | ||
---|---|---|
13 | 13 |
# You should have received a copy of the GNU General Public License |
14 | 14 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 | |
16 |
from __future__ import print_function |
|
17 | ||
16 | 18 |
import time |
17 | 19 |
import os |
18 | 20 | |
... | ... | |
175 | 177 | |
176 | 178 |
if _mem.duplex == DUPLEX.index("split"): |
177 | 179 |
tx_freq = int(_mem.offset) * 1000 |
178 |
print self.VARIANT, number, tx_freq, mem.freq
|
|
180 |
print(self.VARIANT, number, tx_freq, mem.freq)
|
|
179 | 181 |
mem.offset = tx_freq - mem.freq |
180 | 182 |
else: |
181 | 183 |
mem.offset = int(_mem.offset) * 1000 |
... | ... | |
189 | 191 |
if not self._memobj.enables[byte] & bit and number != 1: |
190 | 192 |
mem.empty = True |
191 | 193 | |
192 |
print 'R', self.VARIANT, number, _mem.baud9600
|
|
194 |
print('R', self.VARIANT, number, _mem.baud9600)
|
|
193 | 195 | |
194 | 196 |
return mem |
195 | 197 | |
... | ... | |
270 | 272 |
def _clone_out(radio): |
271 | 273 |
try: |
272 | 274 |
return __clone_out(radio) |
273 |
except Exception, e:
|
|
275 |
except Exception as e:
|
|
274 | 276 |
raise errors.RadioError("Failed to communicate with the radio: %s" % e) |
275 | 277 | |
276 | 278 | |
... | ... | |
291 | 293 |
pos = 0 |
292 | 294 |
for block in radio._block_lengths: |
293 | 295 |
if os.getenv("CHIRP_DEBUG"): |
294 |
print "\nSending %i-%i" % (pos, pos + block)
|
|
296 |
print("\nSending %i-%i" % (pos, pos + block))
|
|
295 | 297 |
out = radio.get_mmap()[pos:pos + block] |
296 | 298 | |
297 | 299 |
# need to chew byte-by-byte here or else we lose the ACK...not sure why |
... | ... | |
309 | 311 | |
310 | 312 |
pos += block |
311 | 313 | |
312 |
print "Clone completed in %i seconds" % (time.time() - start)
|
|
314 |
print("Clone completed in %i seconds" % (time.time() - start))
|
|
313 | 315 | |
314 | 316 |
return True |
chirp/drivers/ft90.py | ||
---|---|---|
52 | 52 |
chirp_common.PowerLevel("Low", watts=5)] |
53 | 53 | |
54 | 54 |
FT90_DUPLEX = ["", "-", "+", "split"] |
55 |
FT90_CWID_CHARS = list(string.digits) + list(string.uppercase) + list(" ") |
|
55 |
#TODO: 2to3 python3 string.uppercase removed; do we need python2 string.uppercase locale dependent functionality? https://stackoverflow.com/questions/4942239/python-string-uppercase-vs-string-ascii-uppercase |
|
56 |
FT90_CWID_CHARS = list(string.digits) + list(string.ascii_uppercase) + list(" ") |
|
56 | 57 |
FT90_DTMF_CHARS = list("0123456789ABCD*#") |
57 | 58 |
FT90_SPECIAL = ["vfo_vhf", "home_vhf", "vfo_uhf", "home_uhf", |
58 | 59 |
"pms_1L", "pms_1U", "pms_2L", "pms_2U"] |
... | ... | |
332 | 333 |
self._mmap = self._clone_in() |
333 | 334 |
except errors.RadioError: |
334 | 335 |
raise |
335 |
except Exception, e:
|
|
336 |
except Exception as e:
|
|
336 | 337 |
trace = traceback.format_exc() |
337 | 338 |
raise errors.RadioError( |
338 | 339 |
"Failed to communicate with radio: %s" % trace) |
... | ... | |
343 | 344 |
self._clone_out() |
344 | 345 |
except errors.RadioError: |
345 | 346 |
raise |
346 |
except Exception, e:
|
|
347 |
except Exception as e:
|
|
347 | 348 |
trace = traceback.format_exc() |
348 | 349 |
raise errors.RadioError( |
349 | 350 |
"Failed to communicate with radio: %s" % trace) |
... | ... | |
670 | 671 |
newval = self._dtmf2bbcd(newval) |
671 | 672 |
LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval)) |
672 | 673 |
setattr(_settings, setting, newval) |
673 |
except Exception, e:
|
|
674 |
except Exception as e:
|
|
674 | 675 |
LOG.debug(element.get_name()) |
675 | 676 |
raise |
chirp/drivers/ftm350.py | ||
---|---|---|
278 | 278 |
self._mmap = _clone_in(self) |
279 | 279 |
except errors.RadioError: |
280 | 280 |
raise |
281 |
except Exception, e:
|
|
281 |
except Exception as e:
|
|
282 | 282 |
raise errors.RadioError("Failed to download from radio (%s)" % e) |
283 | 283 |
self.process_mmap() |
284 | 284 | |
... | ... | |
287 | 287 |
_clone_out(self) |
288 | 288 |
except errors.RadioError: |
289 | 289 |
raise |
290 |
except Exception, e:
|
|
290 |
except Exception as e:
|
|
291 | 291 |
raise errors.RadioError("Failed to upload to radio (%s)" % e) |
292 | 292 | |
293 | 293 |
def process_mmap(self): |
chirp/drivers/kguv8d.py | ||
---|---|---|
376 | 376 |
self._mmap = self._download() |
377 | 377 |
except errors.RadioError: |
378 | 378 |
raise |
379 |
except Exception, e:
|
|
379 |
except Exception as e:
|
|
380 | 380 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
381 | 381 |
self.process_mmap() |
382 | 382 | |
... | ... | |
393 | 393 |
return self._do_download(0, 32768, 64) |
394 | 394 |
except errors.RadioError: |
395 | 395 |
raise |
396 |
except Exception, e:
|
|
396 |
except Exception as e:
|
|
397 | 397 |
LOG.exception('Unknown error during download process') |
398 | 398 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
399 | 399 | |
... | ... | |
426 | 426 |
self._do_upload(0, 32768, 64) |
427 | 427 |
except errors.RadioError: |
428 | 428 |
raise |
429 |
except Exception, e:
|
|
429 |
except Exception as e:
|
|
430 | 430 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
431 | 431 |
return |
432 | 432 |
chirp/drivers/kguv8dplus.py | ||
---|---|---|
418 | 418 |
self._mmap = self._download() |
419 | 419 |
except errors.RadioError: |
420 | 420 |
raise |
421 |
except Exception, e:
|
|
421 |
except Exception as e:
|
|
422 | 422 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
423 | 423 |
self.process_mmap() |
424 | 424 | |
... | ... | |
435 | 435 |
return self._do_download(0, 32768, 64) |
436 | 436 |
except errors.RadioError: |
437 | 437 |
raise |
438 |
except Exception, e:
|
|
438 |
except Exception as e:
|
|
439 | 439 |
LOG.exception('Unknown error during download process') |
440 | 440 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
441 | 441 | |
... | ... | |
467 | 467 |
self._do_upload(0, 32768, 64) |
468 | 468 |
except errors.RadioError: |
469 | 469 |
raise |
470 |
except Exception, e:
|
|
470 |
except Exception as e:
|
|
471 | 471 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
472 | 472 |
return |
473 | 473 | |
... | ... | |
1103 | 1103 |
setattr(obj, setting, int(element.value)/10) |
1104 | 1104 |
else: |
1105 | 1105 |
setattr(obj, setting, element.value) |
1106 |
except Exception, e:
|
|
1106 |
except Exception as e:
|
|
1107 | 1107 |
LOG.debug(element.get_name()) |
1108 | 1108 |
raise |
1109 | 1109 | |
1110 | 1110 |
def _is_freq(self, element): |
1111 |
return "rxfreq" in element.get_name() or "txoffset" in element.get_name() or "rx_start" in element.get_name() or "rx_stop" in element.get_name() or "tx_start" in element.get_name() or "tx_stop" in element.get_name() |
|
1111 |
return "rxfreq" in element.get_name() or "txoffset" in element.get_name() or "rx_start" in element.get_name() or "rx_stop" in element.get_name() or "tx_start" in element.get_name() or "tx_stop" in element.get_name() |
chirp/drivers/kguv8e.py | ||
---|---|---|
337 | 337 | |
338 | 338 |
try: |
339 | 339 |
self.pipe.write(_header) |
340 |
except Exception, e:
|
|
340 |
except Exception as e:
|
|
341 | 341 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
342 | 342 | |
343 | 343 |
def _read_record(self): |
... | ... | |
423 | 423 |
self._mmap = self._download() |
424 | 424 |
except errors.RadioError: |
425 | 425 |
raise |
426 |
except Exception, e:
|
|
426 |
except Exception as e:
|
|
427 | 427 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
428 | 428 |
self.process_mmap() |
429 | 429 | |
... | ... | |
440 | 440 |
return self._do_download(0, 32768, 64) |
441 | 441 |
except errors.RadioError: |
442 | 442 |
raise |
443 |
except Exception, e:
|
|
443 |
except Exception as e:
|
|
444 | 444 |
LOG.exception('Unknown error during download process') |
445 | 445 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
446 | 446 | |
... | ... | |
472 | 472 |
self._do_upload(0, 32768, 64) |
473 | 473 |
except errors.RadioError: |
474 | 474 |
raise |
475 |
except Exception, e:
|
|
475 |
except Exception as e:
|
|
476 | 476 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
477 | 477 |
return |
478 | 478 | |
... | ... | |
1138 | 1138 |
setattr(obj, setting, int(element.value)/10) |
1139 | 1139 |
else: |
1140 | 1140 |
setattr(obj, setting, element.value) |
1141 |
except Exception, e:
|
|
1141 |
except Exception as e:
|
|
1142 | 1142 |
LOG.debug(element.get_name()) |
1143 | 1143 |
raise |
1144 | 1144 |
chirp/drivers/kguv9dplus.py | ||
---|---|---|
877 | 877 |
self._write_record(CMD_HANGUP) |
878 | 878 |
except errors.RadioError: |
879 | 879 |
raise |
880 |
except Exception, e:
|
|
880 |
except Exception as e:
|
|
881 | 881 |
LOG.exception('Unknown error during download process') |
882 | 882 |
raise errors.RadioError( |
883 | 883 |
"Failed to communicate with radio: %s" % e) |
... | ... | |
894 | 894 |
self._write_record(CMD_HANGUP) |
895 | 895 |
except errors.RadioError: |
896 | 896 |
raise |
897 |
except Exception, e:
|
|
897 |
except Exception as e:
|
|
898 | 898 |
raise errors.RadioError( |
899 | 899 |
"Failed to communicate with radio: %s" % e) |
900 | 900 |
return |
... | ... | |
1887 | 1887 |
setattr(obj, setting, int(element.value)/10) |
1888 | 1888 |
else: |
1889 | 1889 |
setattr(obj, setting, element.value) |
1890 |
except Exception, e:
|
|
1890 |
except Exception as e:
|
|
1891 | 1891 |
LOG.debug("set_settings: Exception with %s" % |
1892 | 1892 |
element.get_name()) |
1893 | 1893 |
raise |
chirp/drivers/kyd.py | ||
---|---|---|
500 | 500 | |
501 | 501 |
LOG.debug("Setting %s = %s" % (setting, element.value)) |
502 | 502 |
setattr(obj, setting, element.value) |
503 |
except Exception, e:
|
|
503 |
except Exception as e:
|
|
504 | 504 |
LOG.debug(element.get_name()) |
505 | 505 |
raise |
506 | 506 |
chirp/drivers/kyd_IP620.py | ||
---|---|---|
20 | 20 |
# TODO: Channel name |
21 | 21 |
# TODO: Tuning step |
22 | 22 | |
23 |
from __future__ import print_function |
|
24 | ||
23 | 25 |
import struct |
24 | 26 |
import time |
25 | 27 |
import os |
... | ... | |
181 | 183 |
self.pipe.write("\x06") |
182 | 184 |
except errors.RadioError: |
183 | 185 |
raise |
184 |
except Exception, e:
|
|
186 |
except Exception as e:
|
|
185 | 187 |
raise errors.RadioError("Radio refused to exit programming mode: %s" % e) |
186 | 188 | |
187 | 189 |
def _ip620_enter_programming_mode(self): |
... | ... | |
192 | 194 |
_ack = self.pipe.read(1) |
193 | 195 |
except errors.RadioError: |
194 | 196 |
raise |
195 |
except Exception, e:
|
|
197 |
except Exception as e:
|
|
196 | 198 |
raise errors.RadioError("Error communicating with radio: %s" % e) |
197 | 199 |
if not _ack: |
198 | 200 |
raise errors.RadioError("No response from radio") |
... | ... | |
203 | 205 |
_ident = self.pipe.read(8) |
204 | 206 |
except errors.RadioError: |
205 | 207 |
raise |
206 |
except Exception, e:
|
|
208 |
except Exception as e:
|
|
207 | 209 |
raise errors.RadioError("Error communicating with radio: %s" % e) |
208 | 210 |
if not _ident.startswith("\x06\x4B\x47\x36\x37\x01\x56\xF8"): |
209 |
print util.hexprint(_ident)
|
|
211 |
print(util.hexprint(_ident))
|
|
210 | 212 |
raise errors.RadioError("Radio returned unknown identification string") |
211 | 213 |
try: |
212 | 214 |
self.pipe.write(CMD_ACK) |
213 | 215 |
_ack = self.pipe.read(1) |
214 | 216 |
except errors.RadioError: |
215 | 217 |
raise |
216 |
except Exception, e:
|
|
218 |
except Exception as e:
|
|
217 | 219 |
raise errors.RadioError("Error communicating with radio: %s" % e) |
218 | 220 |
if _ack != CMD_ACK: |
219 | 221 |
raise errors.RadioError("Radio refused to enter programming mode") |
... | ... | |
316 | 318 |
self._mmap = self._do_download() |
317 | 319 |
except errors.RadioError: |
318 | 320 |
raise |
319 |
except Exception, e:
|
|
321 |
except Exception as e:
|
|
320 | 322 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
321 | 323 |
self.process_mmap() |
322 | 324 | |
... | ... | |
597 | 599 |
setattr(self._memobj.settings_misc, |
598 | 600 |
element.get_name(), |
599 | 601 |
element.value) |
600 |
except Exception, e:
|
|
602 |
except Exception as e:
|
|
601 | 603 |
LOG.debug(element.get_name()) |
602 | 604 |
raise |
603 | 605 | |
... | ... | |
624 | 626 |
setattr(_settings_misc, setting, newval) |
625 | 627 |
else: |
626 | 628 |
setattr(_settings, setting, newval) |
627 |
except Exception, e:
|
|
629 |
except Exception as e:
|
|
628 | 630 |
LOG.debug(element.get_name()) |
629 | 631 |
raise |
chirp/drivers/leixen.py | ||
---|---|---|
226 | 226 |
] |
227 | 227 | |
228 | 228 |
MODES = ["NFM", "FM"] |
229 |
WTFTONES = map(float, xrange(56, 64))
|
|
229 |
WTFTONES = list(map(float, range(56, 64)))
|
|
230 | 230 |
TONES = WTFTONES + chirp_common.TONES |
231 | 231 |
DTCS_CODES = [17, 50, 645] + chirp_common.DTCS_CODES |
232 | 232 |
DTCS_CODES.sort() |
... | ... | |
261 | 261 |
# util.hexprint(frame).replace("\n", "\n "))) |
262 | 262 |
try: |
263 | 263 |
radio.pipe.write(frame) |
264 |
except Exception, e:
|
|
264 |
except Exception as e:
|
|
265 | 265 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
266 | 266 | |
267 | 267 | |
... | ... | |
427 | 427 |
def sync_in(self): |
428 | 428 |
try: |
429 | 429 |
self._mmap = do_download(self) |
430 |
except Exception, e:
|
|
430 |
except Exception as e:
|
|
431 | 431 |
finish(self) |
432 | 432 |
raise errors.RadioError("Failed to download from radio: %s" % e) |
433 | 433 |
self.process_mmap() |
... | ... | |
442 | 442 |
except errors.RadioError: |
443 | 443 |
finish(self) |
444 | 444 |
raise |
445 |
except Exception, e:
|
|
445 |
except Exception as e:
|
|
446 | 446 |
raise errors.RadioError("Failed to upload to radio: %s" % e) |
447 | 447 | |
448 | 448 |
def get_raw_memory(self, number): |
... | ... | |
941 | 941 |
else: |
942 | 942 |
LOG.debug("Setting %s = %s" % (setting, element.value)) |
943 | 943 |
setattr(obj, setting, element.value) |
944 |
except Exception, e:
|
|
944 |
except Exception as e:
|
|
945 | 945 |
LOG.debug(element.get_name()) |
946 | 946 |
raise |
947 | 947 |
chirp/drivers/lt725uv.py | ||
---|---|---|
1393 | 1393 |
elif element.value.get_mutable(): |
1394 | 1394 |
LOG.debug("Setting %s = %s" % (setting, element.value)) |
1395 | 1395 |
setattr(obj, setting, element.value) |
1396 |
except Exception, e:
|
|
1396 |
except Exception as e:
|
|
1397 | 1397 |
LOG.debug(element.get_name()) |
1398 | 1398 |
raise |
1399 | 1399 |
chirp/drivers/puxing.py | ||
---|---|---|
47 | 47 |
for _i in range(0, 10): |
48 | 48 |
try: |
49 | 49 |
return _puxing_prep(radio) |
50 |
except Exception, e:
|
|
50 |
except Exception as e:
|
|
51 | 51 |
time.sleep(1) |
52 | 52 | |
53 | 53 |
raise e |
... | ... | |
60 | 60 |
return do_download(radio, 0x0000, 0x0C60, 0x0008) |
61 | 61 |
except errors.RadioError: |
62 | 62 |
raise |
63 |
except Exception, e:
|
|
63 |
except Exception as e:
|
|
64 | 64 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
65 | 65 | |
66 | 66 | |
... | ... | |
71 | 71 |
return do_upload(radio, 0x0000, 0x0C40, 0x0008) |
72 | 72 |
except errors.RadioError: |
73 | 73 |
raise |
74 |
except Exception, e:
|
|
74 |
except Exception as e:
|
|
75 | 75 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
76 | 76 | |
77 | 77 |
POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00), |
... | ... | |
372 | 372 |
return do_download(radio, 0x0000, 0x0FE0, 0x0010) |
373 | 373 |
except errors.RadioError: |
374 | 374 |
raise |
375 |
except Exception, e:
|
|
375 |
except Exception as e:
|
|
376 | 376 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
377 | 377 | |
378 | 378 | |
... | ... | |
383 | 383 |
return do_upload(radio, 0x0000, 0x0FE0, 0x0010) |
384 | 384 |
except errors.RadioError: |
385 | 385 |
raise |
386 |
except Exception, e:
|
|
386 |
except Exception as e:
|
|
387 | 387 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
388 | 388 | |
389 | 389 |
PUXING_2R_MEM_FORMAT = """ |
chirp/drivers/puxing_px888k.py | ||
---|---|---|
527 | 527 |
TONE_RESET_TIME = ['Off'] + ['%ds' % x for x in range(1, 256)] |
528 | 528 |
DTMF_TONE_RESET_TIME = TONE_RESET_TIME[0:16] |
529 | 529 | |
530 |
DTMF_GROUPS = zip(["Off", "A", "B", "C", "D", "*", "#"], [255]+range(10, 16))
|
|
530 |
DTMF_GROUPS = zip(["Off", "A", "B", "C", "D", "*", "#"], [255]+list(range(10, 16)))
|
|
531 | 531 |
FIVE_TONE_STANDARDS = ['ZVEI1', 'ZVEI2', 'CCIR1', 'CCITT'] |
532 | 532 | |
533 | 533 |
# should mimic the defaults in the memedit MemoryEditor somewhat |
... | ... | |
543 | 543 |
DTMF_ALERT_TRANSPOND = zip(['Off', 'Call alert', |
544 | 544 |
'Transpond-alert', |
545 | 545 |
'Transpond-ID code'], |
546 |
[255]+range(1, 4))
|
|
546 |
[255]+list(range(1, 4)))
|
|
547 | 547 |
FIVE_TONE_ALERT_TRANSPOND = zip(['Off', 'Alert tone', |
548 | 548 |
'Transpond', 'Transpond-ID code'], |
549 |
[255]+range(1, 4))
|
|
549 |
[255]+list(range(1, 4)))
|
|
550 | 550 | |
551 | 551 |
BFM_BANDS = ['87.5-108MHz', '76.0-91.0MHz', '76.0-108.0MHz', '65.0-76.0MHz'] |
552 | 552 |
BFM_STRIDE = ['100kHz', '50kHz'] |
chirp/drivers/radioddity_r2.py | ||
---|---|---|
611 | 611 | |
612 | 612 |
LOG.debug("Setting %s = %s" % (setting, element.value)) |
613 | 613 |
setattr(obj, setting, element.value) |
614 |
except Exception, e:
|
|
614 |
except Exception as e:
|
|
615 | 615 |
LOG.debug(element.get_name()) |
616 | 616 |
raise |
617 | 617 |
chirp/drivers/radtel_t18.py | ||
---|---|---|
478 | 478 |
else: |
479 | 479 |
LOG.debug("Setting %s = %s" % (setting, element.value)) |
480 | 480 |
setattr(obj, setting, element.value) |
481 |
except Exception, e:
|
|
481 |
except Exception as e:
|
|
482 | 482 |
LOG.debug(element.get_name()) |
483 | 483 |
raise |
484 | 484 |
chirp/drivers/retevis_rt1.py | ||
---|---|---|
726 | 726 |
elif element.value.get_mutable(): |
727 | 727 |
LOG.debug("Setting %s = %s" % (setting, element.value)) |
728 | 728 |
setattr(obj, setting, element.value) |
729 |
except Exception, e:
|
|
729 |
except Exception as e:
|
|
730 | 730 |
LOG.debug(element.get_name()) |
731 | 731 |
raise |
732 | 732 |
chirp/drivers/retevis_rt21.py | ||
---|---|---|
561 | 561 |
elif element.value.get_mutable(): |
562 | 562 |
LOG.debug("Setting %s = %s" % (setting, element.value)) |
563 | 563 |
setattr(obj, setting, element.value) |
564 |
except Exception, e:
|
|
564 |
except Exception as e:
|
|
565 | 565 |
LOG.debug(element.get_name()) |
566 | 566 |
raise |
567 | 567 |
|
chirp/drivers/retevis_rt22.py | ||
---|---|---|
605 | 605 | |
606 | 606 |
LOG.debug("Setting %s = %s" % (setting, element.value)) |
607 | 607 |
setattr(obj, setting, element.value) |
608 |
except Exception, e:
|
|
608 |
except Exception as e:
|
|
609 | 609 |
LOG.debug(element.get_name()) |
610 | 610 |
raise |
611 | 611 |
chirp/drivers/retevis_rt23.py | ||
---|---|---|
846 | 846 |
elif element.value.get_mutable(): |
847 | 847 |
LOG.debug("Setting %s = %s" % (setting, element.value)) |
848 | 848 |
setattr(obj, setting, element.value) |
849 |
except Exception, e:
|
|
849 |
except Exception as e:
|
|
850 | 850 |
LOG.debug(element.get_name()) |
851 | 851 |
raise |
852 | 852 |
chirp/drivers/retevis_rt26.py | ||
---|---|---|
897 | 897 |
elif element.value.get_mutable(): |
898 | 898 |
LOG.debug("Setting %s = %s" % (setting, element.value)) |
899 | 899 |
setattr(obj, setting, element.value) |
900 |
except Exception, e:
|
|
900 |
except Exception as e:
|
|
901 | 901 |
LOG.debug(element.get_name()) |
902 | 902 |
raise |
903 | 903 |
chirp/drivers/rfinder.py | ||
---|---|---|
240 | 240 |
dist = distance(self.__lat, self.__lon, lat, lon) |
241 | 241 |
bear = fuzzy_to(self.__lat, self.__lon, lat, lon) |
242 | 242 |
mem.comment = "(%imi %s) %s" % (dist, bear, mem.comment) |
243 |
except Exception, e:
|
|
243 |
except Exception as e:
|
|
244 | 244 |
LOG.error("Failed to calculate distance: %s" % e) |
245 | 245 | |
246 | 246 |
return mem |
... | ... | |
258 | 258 |
mem.number = number |
259 | 259 |
number += 1 |
260 | 260 |
self.__memories.append(mem) |
261 |
except Exception, e:
|
|
261 |
except Exception as e:
|
|
262 | 262 |
import traceback |
263 | 263 |
LOG.error(traceback.format_exc()) |
264 | 264 |
LOG.error("Error in received data, cannot continue") |
... | ... | |
287 | 287 | |
288 | 288 |
self._rfp = None |
289 | 289 | |
290 |
def set_params(self, (lat, lon), miles, email, password):
|
|
290 |
def set_params(self, lat_lon_tuple, miles, email, password):
|
|
291 | 291 |
"""Sets the parameters to use for the query""" |
292 |
lat, lon = lat_lon_tuple #py3: PEP 3113 – Removal of Tuple Parameter Unpacking https://peps.python.org/pep-3113/ |
|
292 | 293 |
self._lat = lat |
293 | 294 |
self._lon = lon |
294 | 295 |
self._miles = miles |
chirp/drivers/rh5r_v2.py | ||
---|---|---|
15 | 15 | |
16 | 16 |
"""Rugged RH5R V2 radio management module""" |
17 | 17 | |
18 |
from __future__ import print_function |
|
19 | ||
18 | 20 |
import struct |
19 | 21 |
import logging |
20 | 22 | |
... | ... | |
167 | 169 |
filedata[0x840:0x848] == cls._FILEID) |
168 | 170 | |
169 | 171 |
def process_mmap(self): |
170 |
print MEM_FORMAT
|
|
172 |
print(MEM_FORMAT)
|
|
171 | 173 |
self._memobj = bitwise.parse(MEM_FORMAT, self._mmap) |
172 | 174 | |
173 | 175 |
def get_raw_memory(self, number): |
chirp/drivers/tdxone_tdq8a.py | ||
---|---|---|
14 | 14 |
# You should have received a copy of the GNU General Public License |
15 | 15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | |
17 |
from __future__ import print_function |
|
18 | ||
17 | 19 |
import time |
18 | 20 |
import struct |
19 | 21 |
import logging |
... | ... | |
301 | 303 |
try: |
302 | 304 |
data = _do_ident(radio, magic) |
303 | 305 |
return data |
304 |
except errors.RadioError, e:
|
|
305 |
print e
|
|
306 |
except errors.RadioError as e:
|
|
307 |
print(e)
|
|
306 | 308 |
error = e |
307 | 309 |
time.sleep(2) |
308 | 310 |
if error: |
... | ... | |
426 | 428 | |
427 | 429 |
if len(data) == 0x2008: |
428 | 430 |
rid = data[0x2000:0x2008] |
429 |
print rid
|
|
431 |
print(rid)
|
|
430 | 432 |
return rid.startswith(cls.MODEL) |
431 | 433 |
else: |
432 | 434 |
return False |
... | ... | |
1117 | 1119 |
elif element.value.get_mutable(): |
1118 | 1120 |
LOG.debug("Setting %s = %s" % (setting, element.value)) |
1119 | 1121 |
setattr(obj, setting, element.value) |
1120 |
except Exception, e:
|
|
1122 |
except Exception as e:
|
|
1121 | 1123 |
LOG.debug(element.get_name()) |
1122 | 1124 |
raise |
1123 | 1125 | |
... | ... | |
1131 | 1133 |
value = int(val.get_value() * 10) |
1132 | 1134 |
LOG.debug("Setting fm_presets = %s" % (value)) |
1133 | 1135 |
self._memobj.fm_presets = value |
1134 |
except Exception, e:
|
|
1136 |
except Exception as e:
|
|
1135 | 1137 |
LOG.debug(element.get_name()) |
1136 | 1138 |
raise |
1137 | 1139 |
chirp/drivers/th7800.py | ||
---|---|---|
536 | 536 | |
537 | 537 |
LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval)) |
538 | 538 |
setattr(_settings, setting, newval) |
539 |
except Exception, e:
|
|
539 |
except Exception as e:
|
|
540 | 540 |
LOG.debug(element.get_name()) |
541 | 541 |
raise |
542 | 542 | |
... | ... | |
726 | 726 |
def sync_in(self): |
727 | 727 |
try: |
728 | 728 |
self._mmap = _download(self) |
729 |
except Exception, e:
|
|
729 |
except Exception as e:
|
|
730 | 730 |
raise errors.RadioError( |
731 | 731 |
"Failed to communicate with the radio: %s" % e) |
732 | 732 |
self.process_mmap() |
... | ... | |
734 | 734 |
def sync_out(self): |
735 | 735 |
try: |
736 | 736 |
_upload(self) |
737 |
except Exception, e:
|
|
737 |
except Exception as e:
|
|
738 | 738 |
raise errors.RadioError( |
739 | 739 |
"Failed to communicate with the radio: %s" % e) |
chirp/drivers/th9000.py | ||
---|---|---|
352 | 352 |
try: |
353 | 353 |
radio.pipe.write(data) |
354 | 354 |
radio.pipe.read(len(data)) |
355 |
except Exception, e:
|
|
355 |
except Exception as e:
|
|
356 | 356 |
LOG.error("Error writing to radio: %s" % e) |
357 | 357 |
raise errors.RadioError("Unable to write to radio") |
358 | 358 | |
... | ... | |
366 | 366 |
def _read(radio, length): |
367 | 367 |
try: |
368 | 368 |
data = radio.pipe.read(length) |
369 |
except Exception, e:
|
|
369 |
except Exception as e:
|
|
370 | 370 |
LOG.error( "Error reading from radio: %s" % e) |
371 | 371 |
raise errors.RadioError("Unable to read from radio") |
372 | 372 | |
... | ... | |
793 | 793 |
else: |
794 | 794 |
LOG.debug( "Setting %s = %s" % (setting, element.value)) |
795 | 795 |
setattr(obj, setting, element.value) |
796 |
except Exception, e:
|
|
796 |
except Exception as e:
|
|
797 | 797 |
LOG.debug( element.get_name()) |
798 | 798 |
raise |
799 | 799 |
chirp/drivers/th9800.py | ||
---|---|---|
598 | 598 | |
599 | 599 |
LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval)) |
600 | 600 |
setattr(_settings, setting, newval) |
601 |
except Exception, e:
|
|
601 |
except Exception as e:
|
|
602 | 602 |
LOG.debug(element.get_name()) |
603 | 603 |
raise |
604 | 604 | |
... | ... | |
785 | 785 |
def sync_in(self): |
786 | 786 |
try: |
787 | 787 |
self._mmap = _download(self) |
788 |
except Exception, e:
|
|
788 |
except Exception as e:
|
|
789 | 789 |
raise errors.RadioError( |
790 | 790 |
"Failed to communicate with the radio: %s" % e) |
791 | 791 |
self.process_mmap() |
... | ... | |
793 | 793 |
def sync_out(self): |
794 | 794 |
try: |
795 | 795 |
_upload(self) |
796 |
except Exception, e:
|
|
796 |
except Exception as e:
|
|
797 | 797 |
raise errors.RadioError( |
798 | 798 |
"Failed to communicate with the radio: %s" % e) |
chirp/drivers/th_uv3r25.py | ||
---|---|---|
22 | 22 |
RadioSettingValueInteger, RadioSettingValueList, \ |
23 | 23 |
RadioSettingValueBoolean, RadioSettingValueString |
24 | 24 | |
25 |
from th_uv3r import TYTUV3RRadio, tyt_uv3r_prep, THUV3R_CHARSET |
|
25 |
from chirp.drivers.th_uv3r import TYTUV3RRadio, tyt_uv3r_prep, THUV3R_CHARSET
|
|
26 | 26 | |
27 | 27 | |
28 | 28 |
def tyt_uv3r_download(radio): |
chirp/drivers/th_uv8000.py | ||
---|---|---|
1486 | 1486 |
elif element.value.get_mutable(): |
1487 | 1487 |
LOG.debug("Setting %s = %s" % (setting, element.value)) |
1488 | 1488 |
setattr(obj, setting, element.value) |
1489 |
except Exception, e:
|
|
1489 |
except Exception as e:
|
|
1490 | 1490 |
LOG.debug(element.get_name()) |
1491 | 1491 |
raise |
chirp/drivers/thd72.py | ||
---|---|---|
14 | 14 |
# You should have received a copy of the GNU General Public License |
15 | 15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | |
17 |
from __future__ import print_function |
|
18 | ||
17 | 19 |
from chirp import chirp_common, errors, util, directory |
18 | 20 |
from chirp import bitwise, memmap |
19 | 21 |
from chirp.settings import RadioSettingGroup, RadioSetting, RadioSettings |
... | ... | |
581 | 583 |
except AttributeError as e: |
582 | 584 |
LOG.error("Setting %s is not in the memory map: %s" % |
583 | 585 |
(element.get_name(), e)) |
584 |
except Exception, e:
|
|
586 |
except Exception as e:
|
|
585 | 587 |
LOG.debug(element.get_name()) |
586 | 588 |
raise |
587 | 589 | |
... | ... | |
738 | 740 |
return r |
739 | 741 | |
740 | 742 |
def usage(): |
741 |
print "Usage: %s <-i input.img>|<-o output.img> -p port " \
|
|
743 |
print("Usage: %s <-i input.img>|<-o output.img> -p port " \
|
|
742 | 744 |
"[[-f first-addr] [-l last-addr] | [-b list,of,blocks]]" % \ |
743 |
sys.argv[0] |
|
745 |
sys.argv[0])
|
|
744 | 746 |
sys.exit(1) |
745 | 747 | |
746 | 748 |
opts, args = getopt.getopt(sys.argv[1:], "i:o:p:f:l:b:") |
... | ... | |
793 | 795 |
else: |
794 | 796 |
r._mmap = file(fname, "rb").read(r._memsize) |
795 | 797 |
r.upload(blocks) |
796 |
print "\nDone" |
|
798 |
print("\nDone") |
chirp/drivers/thuv1f.py | ||
---|---|---|
214 | 214 |
self._mmap = uvf1_download(self) |
215 | 215 |
except errors.RadioError: |
216 | 216 |
raise |
217 |
except Exception, e:
|
|
217 |
except Exception as e:
|
|
218 | 218 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
219 | 219 |
self.process_mmap() |
220 | 220 | |
... | ... | |
223 | 223 |
uvf1_upload(self) |
224 | 224 |
except errors.RadioError: |
225 | 225 |
raise |
226 |
except Exception, e:
|
|
226 |
except Exception as e:
|
|
227 | 227 |
raise errors.RadioError("Failed to communicate with radio: %s" % e) |
228 | 228 | |
229 | 229 |
@classmethod |
chirp/drivers/tk270.py | ||
---|---|---|
13 | 13 |
# You should have received a copy of the GNU General Public License |
14 | 14 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 | |
16 |
from __future__ import division |
|
17 | ||
16 | 18 |
import time |
17 | 19 |
import struct |
18 | 20 |
import logging |
... | ... | |
96 | 98 | |
97 | 99 |
MEM_SIZE = 0x400 |
98 | 100 |
BLOCK_SIZE = 8 |
99 |
MEM_BLOCKS = range(0, (MEM_SIZE / BLOCK_SIZE))
|
|
101 |
MEM_BLOCKS = range(0, (MEM_SIZE // BLOCK_SIZE)) #TODO: py3 __floordiv__ or __truediv__ ???
|
|
100 | 102 |
ACK_CMD = "\x06" |
101 | 103 |
TIMEOUT = 0.05 # from 0.03 up it' s safe, we set in 0.05 for a margin |
102 | 104 | |
... | ... | |
269 | 271 |
# UI progress |
270 | 272 |
status = chirp_common.Status() |
271 | 273 |
status.cur = 0 |
272 |
status.max = MEM_SIZE / BLOCK_SIZE |
|
274 |
status.max = MEM_SIZE / BLOCK_SIZE #TODO: py3 __floordiv__ or __truediv__ ???
|
|
273 | 275 |
status.msg = "Cloning to radio..." |
274 | 276 |
radio.status_fn(status) |
275 | 277 |
count = 0 |
chirp/drivers/tk760.py | ||
---|---|---|
13 | 13 |
# You should have received a copy of the GNU General Public License |
14 | 14 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 | |
16 |
from __future__ import division |
|
17 | ||
16 | 18 |
import time |
17 | 19 |
import struct |
18 | 20 |
import logging |
... | ... | |
97 | 99 | |
98 | 100 |
MEM_SIZE = 0x400 |
99 | 101 |
BLOCK_SIZE = 8 |
100 |
MEM_BLOCKS = range(0, (MEM_SIZE / BLOCK_SIZE))
|
|
102 |
MEM_BLOCKS = range(0, (MEM_SIZE // BLOCK_SIZE)) #TODO: py3 __floordiv__ or __truediv__ ???
|
|
101 | 103 |
ACK_CMD = "\x06" |
102 | 104 |
# from 0.03 up it' s safe |
103 | 105 |
# I have to turn it up, some users reported problems with this, was 0.05 |
... | ... | |
256 | 258 |
# UI progress |
257 | 259 |
status = chirp_common.Status() |
258 | 260 |
status.cur = 0 |
259 |
status.max = MEM_SIZE / BLOCK_SIZE |
|
261 |
status.max = MEM_SIZE / BLOCK_SIZE #TODO: py3 __floordiv__ or __truediv__ ???
|
|
260 | 262 |
status.msg = "Cloning from radio..." |
261 | 263 |
radio.status_fn(status) |
262 | 264 | |
... | ... | |
283 | 285 |
# UI progress |
284 | 286 |
status = chirp_common.Status() |
285 | 287 |
status.cur = 0 |
286 |
status.max = MEM_SIZE / BLOCK_SIZE |
|
288 |
status.max = MEM_SIZE / BLOCK_SIZE #TODO: py3 __floordiv__ or __truediv__ ???
|
|
287 | 289 |
status.msg = "Cloning to radio..." |
288 | 290 |
radio.status_fn(status) |
289 | 291 |
count = 0 |
... | ... | |
514 | 516 |
"""Get the channel scan status from the 4 bytes array on the eeprom |
515 | 517 |
then from the bits on the byte, return '' or 'S' as needed""" |
516 | 518 |
result = "S" |
517 |
byte = int(chan/8) |
|
519 |
byte = int(chan/8) #TODO: py3 __floordiv__
|
|
518 | 520 |
bit = chan % 8 |
519 | 521 |
res = self._memobj.settings.scan[byte] & (pow(2, bit)) |
520 | 522 |
if res > 0: |
... | ... | |
524 | 526 | |
525 | 527 |
def set_scan(self, chan, value): |
526 | 528 |
"""Set the channel scan status from UI to the mem_map""" |
527 |
byte = int(chan/8) |
|
529 |
byte = int(chan/8) #TODO: py3 __floordiv__
|
|
528 | 530 |
bit = chan % 8 |
529 | 531 |