Project

General

Profile

New Model #53 » wouxun6_r4.patch

Wouxun patch to accept id and attempt download - Dan Smith, 03/17/2012 10:18 AM

View differences:

chirp/wouxun.py Fri Mar 16 22:16:13 2012 -0700 → chirp/wouxun.py Sat Mar 17 10:16:30 2012 -0700
} names[128];
"""
def wouxun_identify(radio):
def _wouxun_identify(radio, string):
for i in range(0, 5):
radio.pipe.write("HiWOUXUN\x02")
radio.pipe.write(string)
r = radio.pipe.read(9)
# New style, single ACK?
if len(r) == 1 and r == "\x06":
return
# Old style, some radio model info
if len(r) != 9:
print "Got:\n%s" % util.hexprint(r)
print "Retrying identification..."
time.sleep(1)
continue
if r[2:8] != radio._model:
print "Model:\n%s" % util.hexprint(r)
raise Exception("I can't talk to this model")
return
if len(r) == 0:
......
else:
raise Exception("Unable to identify radio")
def wouxun_identify(radio):
return _wouxun_identify(radio, "HiWOUXUN\x02")
def wouxun6_identify(radio):
return _wouxun_identify(radio, "HiWXUVD1")
def wouxun_start_transfer(radio):
radio.pipe.write("\x02\x06")
time.sleep(0.05)
......
wouxun_start_transfer(radio)
return do_upload(radio, 0x0000, 0x2000, 0x0010)
def wouxun6_download(radio):
wouxun6_identify(radio)
wouxun_start_transfer(radio)
return do_download(radio, 0x0000, 0x2000, 0x0040)
def wouxun6_upload(radio):
wouxun6_identify(radio)
wouxun_start_transfer(radio)
return do_upload(radio, 0x0000, 0x2000, 0x0010)
CHARSET = list("0123456789") + [chr(x + ord("A")) for x in range(0, 26)] + \
list("?+ ")
......
return True
return False
@directory.register
class KGUV6DRadio(KGUVD1PRadio):
MODEL = "KG-UV6D"
_model = "KG????"
def sync_in(self):
self._mmap = wouxun6_download(self)
self.process_mmap()
def sync_out(self):
wouxun6_upload(self)
def _puxing_prep(radio):
radio.pipe.write("\x02PROGRA")
ack = radio.pipe.read(1)
(7-7/12)