Bug #10001 » chirp-py3-issue10001.patch
chirp/drivers/alinco.py | ||
---|---|---|
self._mmap = self._download(self._memsize)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
self.process_mmap()
|
||
... | ... | |
self._upload(self._memsize)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
def get_raw_memory(self, number):
|
chirp/drivers/anytone.py | ||
---|---|---|
try:
|
||
radio.pipe.write(data)
|
||
radio.pipe.read(len(data))
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.error("Error writing to radio: %s" % e)
|
||
raise errors.RadioError("Unable to write to radio")
|
||
... | ... | |
def _read(radio, length):
|
||
try:
|
||
data = radio.pipe.read(length)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.error("Error reading from radio: %s" % e)
|
||
raise errors.RadioError("Unable to read from radio")
|
||
chirp/drivers/anytone_ht.py | ||
---|---|---|
def _echo_write(radio, data):
|
||
try:
|
||
radio.pipe.write(data)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.error("Error writing to radio: %s" % e)
|
||
raise errors.RadioError("Unable to write to radio")
|
||
... | ... | |
def _read(radio, length):
|
||
try:
|
||
data = radio.pipe.read(length)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.error("Error reading from radio: %s" % e)
|
||
raise errors.RadioError("Unable to read from radio")
|
||
... | ... | |
else:
|
||
LOG.debug("Setting %s = %s" % (setting, element.value))
|
||
setattr(obj, setting, element.value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
chirp/drivers/ap510.py | ||
---|---|---|
def drain(pipe):
|
||
"""Chew up any data waiting on @pipe"""
|
||
for x in xrange(3):
|
||
for x in range(3):
|
||
buf = pipe.read(4096)
|
||
if not buf:
|
||
return
|
||
... | ... | |
def enter_setup(pipe):
|
||
"""Put AP510 in configuration mode."""
|
||
for x in xrange(30):
|
||
for x in range(30):
|
||
if x % 2:
|
||
pipe.write("@SETUP")
|
||
else:
|
||
... | ... | |
radio.pipe.write("@DISP")
|
||
buf = ""
|
||
for status.cur in xrange(status.cur, status.max):
|
||
for status.cur in range(status.cur, status.max):
|
||
buf += radio.pipe.read(1024)
|
||
if buf.endswith("\r\n"):
|
||
status.cur = status.max
|
||
... | ... | |
class AP510Memory20141215(AP510Memory):
|
||
"""Compatible with firmware version 20141215"""
|
||
ATTR_MAP = dict(AP510Memory.ATTR_MAP.items() + {
|
||
ATTR_MAP = dict(AP510Memory.ATTR_MAP)
|
||
ATTR_MAP.update( {
|
||
'tx_volume': '21', # 1-6
|
||
'rx_volume': '22', # 1-9
|
||
'tx_power': '23', # 1: 1 watt, 0: 0.5 watt
|
||
... | ... | |
'path3': '27', # like "WIDE1 1" else "0"
|
||
'multiple': '28',
|
||
'auto_on': '29',
|
||
}.items())
|
||
})
|
||
def get_multiple(self):
|
||
return dict(zip(
|
||
... | ... | |
data = download(self)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
# _mmap isn't a Chirp MemoryMap, but since AP510Memory implements
|
||
... | ... | |
upload(self)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
def load_mmap(self, filename):
|
||
"""Load the radio's memory map from @filename"""
|
||
mapfile = file(filename, "rb")
|
||
mapfile = open(filename, "rb")
|
||
data = mapfile.read()
|
||
if data.startswith('\r\n00=%s 20141215' % self._model):
|
||
self._mmap = AP510Memory20141215(data)
|
chirp/drivers/baofeng_common.py | ||
---|---|---|
"""common functions for Baofeng (or similar) handheld radios"""
|
||
from __future__ import print_function
|
||
import time
|
||
import struct
|
||
import logging
|
||
... | ... | |
try:
|
||
data = _do_ident(radio, magic)
|
||
return data
|
||
except errors.RadioError, e:
|
||
print e
|
||
except errors.RadioError as e:
|
||
print(e)
|
||
error = e
|
||
time.sleep(2)
|
||
if error:
|
||
... | ... | |
_upload(self)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
# If anything unexpected happens, make sure we raise
|
||
# a RadioError and log the problem
|
||
LOG.exception('Unexpected error during upload')
|
||
... | ... | |
elif element.value.get_mutable():
|
||
LOG.debug("Setting %s = %s" % (setting, element.value))
|
||
setattr(obj, setting, element.value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
... | ... | |
value = int(val.get_value() * 10)
|
||
LOG.debug("Setting fm_presets = %s" % (value))
|
||
self._memobj.fm_presets = value
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
chirp/drivers/baofeng_uv3r.py | ||
---|---|---|
import os
|
||
import logging
|
||
from wouxun_common import do_download, do_upload
|
||
from chirp.drivers.wouxun_common import do_download, do_upload
|
||
from chirp import util, chirp_common, bitwise, errors, directory
|
||
from chirp.settings import RadioSetting, RadioSettingGroup, \
|
||
RadioSettingValueBoolean, RadioSettingValueList, \
|
||
... | ... | |
for _i in range(0, 10):
|
||
try:
|
||
return _uv3r_prep(radio)
|
||
except errors.RadioError, e:
|
||
except errors.RadioError as e:
|
||
time.sleep(1)
|
||
raise e
|
||
raise e
|
||
def uv3r_download(radio):
|
||
... | ... | |
return do_download(radio, 0x0000, 0x0E40, 0x0010)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
... | ... | |
return do_upload(radio, 0x0000, 0x0E40, 0x0010)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
... | ... | |
else:
|
||
LOG.debug("Setting %s = %s" % (setting, element.value))
|
||
setattr(obj, setting, element.value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
... | ... | |
LOG.debug("Setting fm_presets[%1i] = %s" % (index, value))
|
||
setting = self._memobj.fm_presets
|
||
setting[index] = value
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
chirp/drivers/bf-t1.py | ||
---|---|---|
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Error sending Magic to radio:\n%s" % e)
|
||
... | ... | |
_upload(self)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Error: %s" % e)
|
||
def _decode_tone(self, val, inv):
|
||
... | ... | |
setattr(_settings, name, value)
|
||
LOG.debug("Setting %s: %s" % (name, value))
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
chirp/drivers/bj9900.py | ||
---|---|---|
self._mmap = self._clone_in()
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
self.process_mmap()
|
||
... | ... | |
self._clone_out()
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
def process_mmap(self):
|
chirp/drivers/bjuv55.py | ||
---|---|---|
value = int(val.get_value() * 10 - 870)
|
||
LOG.debug("Setting fm_preset = %s" % (value))
|
||
self._memobj.fm_preset = value
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
chirp/drivers/fd268.py | ||
---|---|---|
obj = getattr(_mem, sett)
|
||
setattr(obj, name, element.value)
|
||
except AttributeError, e:
|
||
except AttributeError as e:
|
||
m = "Setting %s is not in this setting block" % name
|
||
LOG.debug(m)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
chirp/drivers/ft1d.py | ||
---|---|---|
except AttributeError as e:
|
||
LOG.error("Setting %s is not in the memory map: %s" %
|
||
(element.get_name(), e))
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
chirp/drivers/ft2800.py | ||
---|---|---|
import logging
|
||
from chirp import util, memmap, chirp_common, bitwise, directory, errors
|
||
from yaesu_clone import YaesuCloneModeRadio
|
||
from chirp.drivers.yaesu_clone import YaesuCloneModeRadio
|
||
LOG = logging.getLogger(__name__)
|
||
... | ... | |
self._mmap = _download(self)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
LOG.info("Downloaded in %.2f sec" % (time.time() - start))
|
||
self.process_mmap()
|
||
... | ... | |
_upload(self)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
LOG.info("Uploaded in %.2f sec" % (time.time() - start))
|
||
chirp/drivers/ft2900.py | ||
---|---|---|
self._mmap = _download(self)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
LOG.info("Downloaded in %.2f sec" % (time.time() - start))
|
||
self.process_mmap()
|
||
... | ... | |
_upload(self)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
LOG.info("Uploaded in %.2f sec" % (time.time() - start))
|
||
... | ... | |
setattr(_settings, name, value)
|
||
LOG.debug("Setting %s: %s" % (name, value))
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
chirp/drivers/ft450d.py | ||
---|---|---|
struct mem_struct current;
|
||
|
||
"""
|
||
_CALLSIGN_CHARSET = [chr(x) for x in range(ord("0"), ord("9") + 1) +
|
||
range(ord("A"), ord("Z") + 1) + [ord(" ")]]
|
||
_CALLSIGN_CHARSET = [chr(x) for x in list(range(ord("0"), ord("9") + 1)) +
|
||
list(range(ord("A"), ord("Z") + 1)) + [ord(" ")]]
|
||
_CALLSIGN_CHARSET_REV = dict(zip(_CALLSIGN_CHARSET,
|
||
range(0, len(_CALLSIGN_CHARSET))))
|
||
list(range(0, len(_CALLSIGN_CHARSET)))))
|
||
|
||
# WARNING Indecis are hard wired in get/set_memory code !!!
|
||
# Channels print in + increasing index order (PMS first)
|
||
... | ... | |
self._mmap = self._clone_in()
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s"
|
||
% e)
|
||
self.process_mmap()
|
||
... | ... | |
self._clone_out()
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s"
|
||
% e)
|
||
|
||
... | ... | |
elif element.value.get_mutable():
|
||
LOG.debug("Setting %s = %s" % (setting, element.value))
|
||
setattr(obj, setting, element.value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
chirp/drivers/ft50.py | ||
---|---|---|
def _clone_out(radio):
|
||
try:
|
||
return __clone_out(radio)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with the radio: %s" % e)
|
||
chirp/drivers/ft60.py | ||
---|---|---|
self._mmap = _download(self)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
self.process_mmap()
|
||
self.check_checksums()
|
||
... | ... | |
_upload(self)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
def process_mmap(self):
|
||
... | ... | |
setattr(_settings, name, value)
|
||
LOG.debug("Setting %s: %s" % (name, value))
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
chirp/drivers/ft70.py | ||
---|---|---|
_DG_ID = ["%d" % x for x in range(0, 100)]
|
||
_GM_RING = ("OFF", "IN RING", "AlWAYS")
|
||
_GM_INTERVAL = ("LONG", "NORMAL", "OFF")
|
||
|
||
_MYCALL_CHR_SET = list(string.uppercase) + list(string.digits) + ['-','/' ]
|
||
#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
|
||
_MYCALL_CHR_SET = list(string.ascii_uppercase) + list(string.digits) + ['-','/' ]
|
||
|
||
@classmethod
|
||
def get_prompts(cls):
|
||
... | ... | |
except AttributeError as e:
|
||
LOG.error("Setting %s is not in the memory map: %s" %
|
||
(element.get_name(), e))
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
|
chirp/drivers/ft7100.py | ||
---|---|---|
self._mmap = _download(self)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
LOG.info("Downloaded in %.2f sec", (time.time() - start))
|
||
self.process_mmap()
|
||
... | ... | |
_upload(self)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
LOG.info("Uploaded in %.2f sec", (time.time() - start))
|
||
... | ... | |
setattr(_overlay, name, value)
|
||
LOG.debug("Setting %s: %s", name, value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
chirp/drivers/ft8100.py | ||
---|---|---|
# 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 __future__ import print_function
|
||
import time
|
||
import os
|
||
... | ... | |
if _mem.duplex == DUPLEX.index("split"):
|
||
tx_freq = int(_mem.offset) * 1000
|
||
print self.VARIANT, number, tx_freq, mem.freq
|
||
print(self.VARIANT, number, tx_freq, mem.freq)
|
||
mem.offset = tx_freq - mem.freq
|
||
else:
|
||
mem.offset = int(_mem.offset) * 1000
|
||
... | ... | |
if not self._memobj.enables[byte] & bit and number != 1:
|
||
mem.empty = True
|
||
print 'R', self.VARIANT, number, _mem.baud9600
|
||
print('R', self.VARIANT, number, _mem.baud9600)
|
||
return mem
|
||
... | ... | |
def _clone_out(radio):
|
||
try:
|
||
return __clone_out(radio)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with the radio: %s" % e)
|
||
... | ... | |
pos = 0
|
||
for block in radio._block_lengths:
|
||
if os.getenv("CHIRP_DEBUG"):
|
||
print "\nSending %i-%i" % (pos, pos + block)
|
||
print("\nSending %i-%i" % (pos, pos + block))
|
||
out = radio.get_mmap()[pos:pos + block]
|
||
# need to chew byte-by-byte here or else we lose the ACK...not sure why
|
||
... | ... | |
pos += block
|
||
print "Clone completed in %i seconds" % (time.time() - start)
|
||
print("Clone completed in %i seconds" % (time.time() - start))
|
||
return True
|
chirp/drivers/ft90.py | ||
---|---|---|
chirp_common.PowerLevel("Low", watts=5)]
|
||
FT90_DUPLEX = ["", "-", "+", "split"]
|
||
FT90_CWID_CHARS = list(string.digits) + list(string.uppercase) + list(" ")
|
||
#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
|
||
FT90_CWID_CHARS = list(string.digits) + list(string.ascii_uppercase) + list(" ")
|
||
FT90_DTMF_CHARS = list("0123456789ABCD*#")
|
||
FT90_SPECIAL = ["vfo_vhf", "home_vhf", "vfo_uhf", "home_uhf",
|
||
"pms_1L", "pms_1U", "pms_2L", "pms_2U"]
|
||
... | ... | |
self._mmap = self._clone_in()
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
trace = traceback.format_exc()
|
||
raise errors.RadioError(
|
||
"Failed to communicate with radio: %s" % trace)
|
||
... | ... | |
self._clone_out()
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
trace = traceback.format_exc()
|
||
raise errors.RadioError(
|
||
"Failed to communicate with radio: %s" % trace)
|
||
... | ... | |
newval = self._dtmf2bbcd(newval)
|
||
LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval))
|
||
setattr(_settings, setting, newval)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
chirp/drivers/ftm350.py | ||
---|---|---|
self._mmap = _clone_in(self)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to download from radio (%s)" % e)
|
||
self.process_mmap()
|
||
... | ... | |
_clone_out(self)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to upload to radio (%s)" % e)
|
||
def process_mmap(self):
|
chirp/drivers/kguv8d.py | ||
---|---|---|
self._mmap = self._download()
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
self.process_mmap()
|
||
... | ... | |
return self._do_download(0, 32768, 64)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.exception('Unknown error during download process')
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
... | ... | |
self._do_upload(0, 32768, 64)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
return
|
||
chirp/drivers/kguv8dplus.py | ||
---|---|---|
self._mmap = self._download()
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
self.process_mmap()
|
||
... | ... | |
return self._do_download(0, 32768, 64)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.exception('Unknown error during download process')
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
... | ... | |
self._do_upload(0, 32768, 64)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
return
|
||
... | ... | |
setattr(obj, setting, int(element.value)/10)
|
||
else:
|
||
setattr(obj, setting, element.value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
def _is_freq(self, element):
|
||
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()
|
||
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 | ||
---|---|---|
try:
|
||
self.pipe.write(_header)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
def _read_record(self):
|
||
... | ... | |
self._mmap = self._download()
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
self.process_mmap()
|
||
... | ... | |
return self._do_download(0, 32768, 64)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.exception('Unknown error during download process')
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
... | ... | |
self._do_upload(0, 32768, 64)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
return
|
||
... | ... | |
setattr(obj, setting, int(element.value)/10)
|
||
else:
|
||
setattr(obj, setting, element.value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
chirp/drivers/kguv9dplus.py | ||
---|---|---|
self._write_record(CMD_HANGUP)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.exception('Unknown error during download process')
|
||
raise errors.RadioError(
|
||
"Failed to communicate with radio: %s" % e)
|
||
... | ... | |
self._write_record(CMD_HANGUP)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError(
|
||
"Failed to communicate with radio: %s" % e)
|
||
return
|
||
... | ... | |
setattr(obj, setting, int(element.value)/10)
|
||
else:
|
||
setattr(obj, setting, element.value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug("set_settings: Exception with %s" %
|
||
element.get_name())
|
||
raise
|
chirp/drivers/kyd.py | ||
---|---|---|
LOG.debug("Setting %s = %s" % (setting, element.value))
|
||
setattr(obj, setting, element.value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
chirp/drivers/kyd_IP620.py | ||
---|---|---|
# TODO: Channel name
|
||
# TODO: Tuning step
|
||
from __future__ import print_function
|
||
import struct
|
||
import time
|
||
import os
|
||
... | ... | |
self.pipe.write("\x06")
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Radio refused to exit programming mode: %s" % e)
|
||
def _ip620_enter_programming_mode(self):
|
||
... | ... | |
_ack = self.pipe.read(1)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Error communicating with radio: %s" % e)
|
||
if not _ack:
|
||
raise errors.RadioError("No response from radio")
|
||
... | ... | |
_ident = self.pipe.read(8)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Error communicating with radio: %s" % e)
|
||
if not _ident.startswith("\x06\x4B\x47\x36\x37\x01\x56\xF8"):
|
||
print util.hexprint(_ident)
|
||
print(util.hexprint(_ident))
|
||
raise errors.RadioError("Radio returned unknown identification string")
|
||
try:
|
||
self.pipe.write(CMD_ACK)
|
||
_ack = self.pipe.read(1)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Error communicating with radio: %s" % e)
|
||
if _ack != CMD_ACK:
|
||
raise errors.RadioError("Radio refused to enter programming mode")
|
||
... | ... | |
self._mmap = self._do_download()
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
self.process_mmap()
|
||
... | ... | |
setattr(self._memobj.settings_misc,
|
||
element.get_name(),
|
||
element.value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
... | ... | |
setattr(_settings_misc, setting, newval)
|
||
else:
|
||
setattr(_settings, setting, newval)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
chirp/drivers/leixen.py | ||
---|---|---|
]
|
||
MODES = ["NFM", "FM"]
|
||
WTFTONES = map(float, xrange(56, 64))
|
||
WTFTONES = list(map(float, range(56, 64)))
|
||
TONES = WTFTONES + chirp_common.TONES
|
||
DTCS_CODES = [17, 50, 645] + chirp_common.DTCS_CODES
|
||
DTCS_CODES.sort()
|
||
... | ... | |
# util.hexprint(frame).replace("\n", "\n ")))
|
||
try:
|
||
radio.pipe.write(frame)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
... | ... | |
def sync_in(self):
|
||
try:
|
||
self._mmap = do_download(self)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
finish(self)
|
||
raise errors.RadioError("Failed to download from radio: %s" % e)
|
||
self.process_mmap()
|
||
... | ... | |
except errors.RadioError:
|
||
finish(self)
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to upload to radio: %s" % e)
|
||
def get_raw_memory(self, number):
|
||
... | ... | |
else:
|
||
LOG.debug("Setting %s = %s" % (setting, element.value))
|
||
setattr(obj, setting, element.value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
chirp/drivers/lt725uv.py | ||
---|---|---|
elif element.value.get_mutable():
|
||
LOG.debug("Setting %s = %s" % (setting, element.value))
|
||
setattr(obj, setting, element.value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
chirp/drivers/puxing.py | ||
---|---|---|
for _i in range(0, 10):
|
||
try:
|
||
return _puxing_prep(radio)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
time.sleep(1)
|
||
raise e
|
||
... | ... | |
return do_download(radio, 0x0000, 0x0C60, 0x0008)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
... | ... | |
return do_upload(radio, 0x0000, 0x0C40, 0x0008)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00),
|
||
... | ... | |
return do_download(radio, 0x0000, 0x0FE0, 0x0010)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
... | ... | |
return do_upload(radio, 0x0000, 0x0FE0, 0x0010)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
PUXING_2R_MEM_FORMAT = """
|
chirp/drivers/puxing_px888k.py | ||
---|---|---|
TONE_RESET_TIME = ['Off'] + ['%ds' % x for x in range(1, 256)]
|
||
DTMF_TONE_RESET_TIME = TONE_RESET_TIME[0:16]
|
||
DTMF_GROUPS = zip(["Off", "A", "B", "C", "D", "*", "#"], [255]+range(10, 16))
|
||
DTMF_GROUPS = zip(["Off", "A", "B", "C", "D", "*", "#"], [255]+list(range(10, 16)))
|
||
FIVE_TONE_STANDARDS = ['ZVEI1', 'ZVEI2', 'CCIR1', 'CCITT']
|
||
# should mimic the defaults in the memedit MemoryEditor somewhat
|
||
... | ... | |
DTMF_ALERT_TRANSPOND = zip(['Off', 'Call alert',
|
||
'Transpond-alert',
|
||
'Transpond-ID code'],
|
||
[255]+range(1, 4))
|
||
[255]+list(range(1, 4)))
|
||
FIVE_TONE_ALERT_TRANSPOND = zip(['Off', 'Alert tone',
|
||
'Transpond', 'Transpond-ID code'],
|
||
[255]+range(1, 4))
|
||
[255]+list(range(1, 4)))
|
||
BFM_BANDS = ['87.5-108MHz', '76.0-91.0MHz', '76.0-108.0MHz', '65.0-76.0MHz']
|
||
BFM_STRIDE = ['100kHz', '50kHz']
|
chirp/drivers/radioddity_r2.py | ||
---|---|---|
LOG.debug("Setting %s = %s" % (setting, element.value))
|
||
setattr(obj, setting, element.value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
chirp/drivers/radtel_t18.py | ||
---|---|---|
else:
|
||
LOG.debug("Setting %s = %s" % (setting, element.value))
|
||
setattr(obj, setting, element.value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
chirp/drivers/retevis_rt1.py | ||
---|---|---|
elif element.value.get_mutable():
|
||
LOG.debug("Setting %s = %s" % (setting, element.value))
|
||
setattr(obj, setting, element.value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
chirp/drivers/retevis_rt21.py | ||
---|---|---|
elif element.value.get_mutable():
|
||
LOG.debug("Setting %s = %s" % (setting, element.value))
|
||
setattr(obj, setting, element.value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
|
chirp/drivers/retevis_rt22.py | ||
---|---|---|
LOG.debug("Setting %s = %s" % (setting, element.value))
|
||
setattr(obj, setting, element.value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
chirp/drivers/retevis_rt23.py | ||
---|---|---|
elif element.value.get_mutable():
|
||
LOG.debug("Setting %s = %s" % (setting, element.value))
|
||
setattr(obj, setting, element.value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
chirp/drivers/retevis_rt26.py | ||
---|---|---|
elif element.value.get_mutable():
|
||
LOG.debug("Setting %s = %s" % (setting, element.value))
|
||
setattr(obj, setting, element.value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
chirp/drivers/rfinder.py | ||
---|---|---|
dist = distance(self.__lat, self.__lon, lat, lon)
|
||
bear = fuzzy_to(self.__lat, self.__lon, lat, lon)
|
||
mem.comment = "(%imi %s) %s" % (dist, bear, mem.comment)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.error("Failed to calculate distance: %s" % e)
|
||
return mem
|
||
... | ... | |
mem.number = number
|
||
number += 1
|
||
self.__memories.append(mem)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
import traceback
|
||
LOG.error(traceback.format_exc())
|
||
LOG.error("Error in received data, cannot continue")
|
||
... | ... | |
self._rfp = None
|
||
def set_params(self, (lat, lon), miles, email, password):
|
||
def set_params(self, lat_lon_tuple, miles, email, password):
|
||
"""Sets the parameters to use for the query"""
|
||
lat, lon = lat_lon_tuple #py3: PEP 3113 – Removal of Tuple Parameter Unpacking https://peps.python.org/pep-3113/
|
||
self._lat = lat
|
||
self._lon = lon
|
||
self._miles = miles
|
chirp/drivers/rh5r_v2.py | ||
---|---|---|
"""Rugged RH5R V2 radio management module"""
|
||
from __future__ import print_function
|
||
import struct
|
||
import logging
|
||
... | ... | |
filedata[0x840:0x848] == cls._FILEID)
|
||
def process_mmap(self):
|
||
print MEM_FORMAT
|
||
print(MEM_FORMAT)
|
||
self._memobj = bitwise.parse(MEM_FORMAT, self._mmap)
|
||
def get_raw_memory(self, number):
|
chirp/drivers/tdxone_tdq8a.py | ||
---|---|---|
# 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 __future__ import print_function
|
||
import time
|
||
import struct
|
||
import logging
|
||
... | ... | |
try:
|
||
data = _do_ident(radio, magic)
|
||
return data
|
||
except errors.RadioError, e:
|
||
print e
|
||
except errors.RadioError as e:
|
||
print(e)
|
||
error = e
|
||
time.sleep(2)
|
||
if error:
|
||
... | ... | |
if len(data) == 0x2008:
|
||
rid = data[0x2000:0x2008]
|
||
print rid
|
||
print(rid)
|
||
return rid.startswith(cls.MODEL)
|
||
else:
|
||
return False
|
||
... | ... | |
elif element.value.get_mutable():
|
||
LOG.debug("Setting %s = %s" % (setting, element.value))
|
||
setattr(obj, setting, element.value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
... | ... | |
value = int(val.get_value() * 10)
|
||
LOG.debug("Setting fm_presets = %s" % (value))
|
||
self._memobj.fm_presets = value
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
chirp/drivers/th7800.py | ||
---|---|---|
LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval))
|
||
setattr(_settings, setting, newval)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
... | ... | |
def sync_in(self):
|
||
try:
|
||
self._mmap = _download(self)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError(
|
||
"Failed to communicate with the radio: %s" % e)
|
||
self.process_mmap()
|
||
... | ... | |
def sync_out(self):
|
||
try:
|
||
_upload(self)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError(
|
||
"Failed to communicate with the radio: %s" % e)
|
chirp/drivers/th9000.py | ||
---|---|---|
try:
|
||
radio.pipe.write(data)
|
||
radio.pipe.read(len(data))
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.error("Error writing to radio: %s" % e)
|
||
raise errors.RadioError("Unable to write to radio")
|
||
... | ... | |
def _read(radio, length):
|
||
try:
|
||
data = radio.pipe.read(length)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.error( "Error reading from radio: %s" % e)
|
||
raise errors.RadioError("Unable to read from radio")
|
||
... | ... | |
else:
|
||
LOG.debug( "Setting %s = %s" % (setting, element.value))
|
||
setattr(obj, setting, element.value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug( element.get_name())
|
||
raise
|
||
chirp/drivers/th9800.py | ||
---|---|---|
LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval))
|
||
setattr(_settings, setting, newval)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
... | ... | |
def sync_in(self):
|
||
try:
|
||
self._mmap = _download(self)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError(
|
||
"Failed to communicate with the radio: %s" % e)
|
||
self.process_mmap()
|
||
... | ... | |
def sync_out(self):
|
||
try:
|
||
_upload(self)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError(
|
||
"Failed to communicate with the radio: %s" % e)
|
chirp/drivers/th_uv3r25.py | ||
---|---|---|
RadioSettingValueInteger, RadioSettingValueList, \
|
||
RadioSettingValueBoolean, RadioSettingValueString
|
||
from th_uv3r import TYTUV3RRadio, tyt_uv3r_prep, THUV3R_CHARSET
|
||
from chirp.drivers.th_uv3r import TYTUV3RRadio, tyt_uv3r_prep, THUV3R_CHARSET
|
||
def tyt_uv3r_download(radio):
|
chirp/drivers/th_uv8000.py | ||
---|---|---|
elif element.value.get_mutable():
|
||
LOG.debug("Setting %s = %s" % (setting, element.value))
|
||
setattr(obj, setting, element.value)
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
chirp/drivers/thd72.py | ||
---|---|---|
# 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 __future__ import print_function
|
||
from chirp import chirp_common, errors, util, directory
|
||
from chirp import bitwise, memmap
|
||
from chirp.settings import RadioSettingGroup, RadioSetting, RadioSettings
|
||
... | ... | |
except AttributeError as e:
|
||
LOG.error("Setting %s is not in the memory map: %s" %
|
||
(element.get_name(), e))
|
||
except Exception, e:
|
||
except Exception as e:
|
||
LOG.debug(element.get_name())
|
||
raise
|
||
... | ... | |
return r
|
||
def usage():
|
||
print "Usage: %s <-i input.img>|<-o output.img> -p port " \
|
||
print("Usage: %s <-i input.img>|<-o output.img> -p port " \
|
||
"[[-f first-addr] [-l last-addr] | [-b list,of,blocks]]" % \
|
||
sys.argv[0]
|
||
sys.argv[0])
|
||
sys.exit(1)
|
||
opts, args = getopt.getopt(sys.argv[1:], "i:o:p:f:l:b:")
|
||
... | ... | |
else:
|
||
r._mmap = file(fname, "rb").read(r._memsize)
|
||
r.upload(blocks)
|
||
print "\nDone"
|
||
print("\nDone")
|
chirp/drivers/thuv1f.py | ||
---|---|---|
self._mmap = uvf1_download(self)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
self.process_mmap()
|
||
... | ... | |
uvf1_upload(self)
|
||
except errors.RadioError:
|
||
raise
|
||
except Exception, e:
|
||
except Exception as e:
|
||
raise errors.RadioError("Failed to communicate with radio: %s" % e)
|
||
@classmethod
|
chirp/drivers/tk270.py | ||
---|---|---|
# 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 __future__ import division
|
||
import time
|
||
import struct
|
||
import logging
|
||
... | ... | |
MEM_SIZE = 0x400
|
||
BLOCK_SIZE = 8
|
||
MEM_BLOCKS = range(0, (MEM_SIZE / BLOCK_SIZE))
|
||
MEM_BLOCKS = range(0, (MEM_SIZE // BLOCK_SIZE)) #TODO: py3 __floordiv__ or __truediv__ ???
|
||
ACK_CMD = "\x06"
|
||
TIMEOUT = 0.05 # from 0.03 up it' s safe, we set in 0.05 for a margin
|
||
... | ... | |
# UI progress
|
||
status = chirp_common.Status()
|
||
status.cur = 0
|
||
status.max = MEM_SIZE / BLOCK_SIZE
|
||
status.max = MEM_SIZE / BLOCK_SIZE #TODO: py3 __floordiv__ or __truediv__ ???
|
||
status.msg = "Cloning to radio..."
|
||
radio.status_fn(status)
|
||
count = 0
|
chirp/drivers/tk760.py | ||
---|---|---|
# 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 __future__ import division
|
||
import time
|
||
import struct
|
||
import logging
|
||
... | ... | |
MEM_SIZE = 0x400
|
||
BLOCK_SIZE = 8
|
||
MEM_BLOCKS = range(0, (MEM_SIZE / BLOCK_SIZE))
|
||
MEM_BLOCKS = range(0, (MEM_SIZE // BLOCK_SIZE)) #TODO: py3 __floordiv__ or __truediv__ ???
|
||
ACK_CMD = "\x06"
|
||
# from 0.03 up it' s safe
|
||
# I have to turn it up, some users reported problems with this, was 0.05
|
||
... | ... | |
# UI progress
|
||
status = chirp_common.Status()
|
||
status.cur = 0
|
||
status.max = MEM_SIZE / BLOCK_SIZE
|
||
status.max = MEM_SIZE / BLOCK_SIZE #TODO: py3 __floordiv__ or __truediv__ ???
|
||
status.msg = "Cloning from radio..."
|
||
radio.status_fn(status)
|
||
... | ... | |
# UI progress
|
||
status = chirp_common.Status()
|
||
status.cur = 0
|
||
status.max = MEM_SIZE / BLOCK_SIZE
|
||
status.max = MEM_SIZE / BLOCK_SIZE #TODO: py3 __floordiv__ or __truediv__ ???
|
||
status.msg = "Cloning to radio..."
|
||
radio.status_fn(status)
|
||
count = 0
|
||
... | ... | |
"""Get the channel scan status from the 4 bytes array on the eeprom
|
||
then from the bits on the byte, return '' or 'S' as needed"""
|
||
result = "S"
|
||
byte = int(chan/8)
|
||
byte = int(chan/8) #TODO: py3 __floordiv__
|
||
bit = chan % 8
|
||
res = self._memobj.settings.scan[byte] & (pow(2, bit))
|
||
if res > 0:
|
||
... | ... | |
def set_scan(self, chan, value):
|
||
"""Set the channel scan status from UI to the mem_map"""
|
||
byte = int(chan/8)
|
||
byte = int(chan/8) #TODO: py3 __floordiv__
|
||
bit = chan % 8
|
||