# HG changeset patch # User Zachary T Welch zach@mandolincreekfarm.com # Fake Node ID bf9127c9169b04a0cd81e23910a6c69a5eea7a39
Use logging in drivers/k*.py (#2347)
diff --git a/chirp/drivers/kguv8d.py b/chirp/drivers/kguv8d.py index ab27a76..cf130ce 100644 --- a/chirp/drivers/kguv8d.py +++ b/chirp/drivers/kguv8d.py @@ -314,8 +314,8 @@ class KGUV8DRadio(chirp_common.CloneModeRadio, _cs += self._checksum(_packet) _cs %= 256 _rcs = ord(self.pipe.read(1)) - LOG.debug("_cs =", _cs) - LOG.debug("_rcs=", _rcs) + LOG.debug("_cs =%x", _cs) + LOG.debug("_rcs=%x", _rcs) return (_rcs != _cs, _packet)
# Identify the radio @@ -348,7 +348,7 @@ class KGUV8DRadio(chirp_common.CloneModeRadio, _chksum_err, _resp = self._read_record() LOG.debug("Got:\n%s" % util.hexprint(_resp)) if _chksum_err: - print "Checksum error: retrying ident..." + LOG.error("Checksum error: retrying ident...") time.sleep(0.100) continue LOG.debug("Model %s" % util.hexprint(_resp[0:7])) @@ -399,7 +399,7 @@ class KGUV8DRadio(chirp_common.CloneModeRadio, cs_error, resp = self._read_record() if cs_error: # TODO: probably should retry a few times here - print util.hexprint(resp) + LOG.debug(util.hexprint(resp)) raise Exception("Checksum error on read") LOG.debug("Got:\n%s" % util.hexprint(resp)) image += resp[2:] @@ -926,6 +926,5 @@ class KGUV8DRadio(chirp_common.CloneModeRadio, return self._get_settings() except: import traceback - print "Failed to parse settings:" - traceback.print_exc() + LOG.error("Failed to parse settings: %s", traceback.format_exc()) return None diff --git a/chirp/drivers/kyd.py b/chirp/drivers/kyd.py index a6db68a..87c46cc 100644 --- a/chirp/drivers/kyd.py +++ b/chirp/drivers/kyd.py @@ -110,7 +110,7 @@ def _nc630a_enter_programming_mode(radio): raise errors.RadioError("Error communicating with radio")
if not ident.startswith("P32073"): - print util.hexprint(ident) + LOG.debug(util.hexprint(ident)) raise errors.RadioError("Radio returned unknown identification string")
try: @@ -176,7 +176,7 @@ def _nc630a_write_block(radio, block_addr, block_size):
def do_download(radio): - print "download" + LOG.debug("download") _nc630a_enter_programming_mode(radio)
data = "" @@ -312,8 +312,8 @@ class NC630aRadio(chirp_common.CloneModeRadio): def get_memory(self, number): bitpos = (1 << ((number - 1) % 8)) bytepos = ((number - 1) / 8) - print "bitpos %s" % bitpos - print "bytepos %s" % bytepos + LOG.debug("bitpos %s" % bitpos) + LOG.debug("bytepos %s" % bytepos)
_mem = self._memobj.memory[number - 1] _skp = self._memobj.skipflags[bytepos] @@ -347,7 +347,7 @@ class NC630aRadio(chirp_common.CloneModeRadio): mem.power = NC630A_POWER_LEVELS[_mem.highpower]
mem.skip = "" if (_skp & bitpos) else "S" - print "mem.skip %s" % mem.skip + LOG.debug("mem.skip %s" % mem.skip)
mem.extra = RadioSettingGroup("Extra", "extra")
@@ -396,8 +396,8 @@ class NC630aRadio(chirp_common.CloneModeRadio): def set_memory(self, mem): bitpos = (1 << ((mem.number - 1) % 8)) bytepos = ((mem.number - 1) / 8) - print "bitpos %s" % bitpos - print "bytepos %s" % bytepos + LOG.debug("bitpos %s" % bitpos) + LOG.debug("bytepos %s" % bytepos)
_mem = self._memobj.memory[mem.number - 1] _skp = self._memobj.skipflags[bytepos] @@ -430,7 +430,7 @@ class NC630aRadio(chirp_common.CloneModeRadio): _skp |= bitpos else: _skp &= ~bitpos - print "_skp %s" % _skp + LOG.debug("_skp %s" % _skp)
for setting in mem.extra: setattr(_mem, setting.get_name(), setting.value) @@ -499,8 +499,8 @@ class NC630aRadio(chirp_common.CloneModeRadio): obj = self._memobj.settings setting = element.get_name()
- print "Setting %s = %s" % (setting, element.value) + LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) except Exception, e: - print element.get_name() + LOG.debug(element.get_name()) raise