diff --git a/chirp/drivers/wouxun.py b/chirp/drivers/wouxun.py index 6b7df705..302ab4ee 100644 --- a/chirp/drivers/wouxun.py +++ b/chirp/drivers/wouxun.py @@ -60,9 +60,10 @@ class KGUVD1PRadio(chirp_common.CloneModeRadio, """Wouxun KG-UVD1P,UV2,UV3""" VENDOR = "Wouxun" MODEL = "KG-UVD1P" - _model = "KG669V" + _model = b"KG669V" + NEEDS_COMPAT_SERIAL = False - _querymodel = ("HiWOUXUN\x02", "PROGUV6X\x02") + _querymodel = (b"HiWOUXUN\x02", b"PROGUV6X\x02") CHARSET = list("0123456789") + \ [chr(x + ord("A")) for x in range(0, 26)] + list("?+-") @@ -260,10 +261,10 @@ class KGUVD1PRadio(chirp_common.CloneModeRadio, def _start_transfer(self): """Tell the radio to go into transfer mode""" - self.pipe.write("\x02\x06") + self.pipe.write(b"\x02\x06") time.sleep(0.05) ack = self.pipe.read(1) - if ack != "\x06": + if ack != b"\x06": raise Exception("Radio refused transfer mode") def _download(self): @@ -910,7 +911,7 @@ class KGUV6DRadio(KGUVD1PRadio): """Wouxun KG-UV6 (D and X variants)""" MODEL = "KG-UV6" - _querymodel = ("HiWXUVD1\x02", "HiKGUVD1\x02") + _querymodel = (b"HiWXUVD1\x02", b"HiKGUVD1\x02") _MEM_FORMAT = """ #seekto 0x0010; @@ -1437,7 +1438,7 @@ class KG816Radio(KGUVD1PRadio, chirp_common.ExperimentalRadio): """Wouxun KG-816""" MODEL = "KG-816" - _querymodel = "HiWOUXUN\x02" + _querymodel = b"HiWOUXUN\x02" _MEM_FORMAT = """ #seekto 0x0010; diff --git a/chirp/drivers/wouxun_common.py b/chirp/drivers/wouxun_common.py index 3e9f21e7..ce1509f2 100644 --- a/chirp/drivers/wouxun_common.py +++ b/chirp/drivers/wouxun_common.py @@ -31,11 +31,11 @@ def wipe_memory(_mem, byte): def do_download(radio, start, end, blocksize): """Initiate a download of @radio between @start and @end""" - image = "" + image = b"" for i in range(start, end, blocksize): cmd = struct.pack(">cHb", b"R", i, blocksize) LOG.debug(util.hexprint(cmd)) - radio.pipe.write(bitwise.string_straight_decode(cmd)) + radio.pipe.write(cmd) length = len(cmd) + blocksize resp = radio.pipe.read(length) if len(resp) != (len(cmd) + blocksize): @@ -43,7 +43,7 @@ def do_download(radio, start, end, blocksize): raise Exception("Failed to read full block (%i!=%i)" % (len(resp), len(cmd) + blocksize)) - radio.pipe.write("\x06") + radio.pipe.write(b"\x06") radio.pipe.read(1) image += resp[4:] @@ -54,7 +54,7 @@ def do_download(radio, start, end, blocksize): status.msg = "Cloning from radio" radio.status_fn(status) - return memmap.MemoryMap(image) + return memmap.MemoryMapBytes(image) def do_upload(radio, start, end, blocksize): @@ -62,13 +62,13 @@ def do_upload(radio, start, end, blocksize): ptr = start for i in range(start, end, blocksize): cmd = struct.pack(">cHb", b"W", i, blocksize) - chunk = radio.get_mmap().get_byte_compatible()[ptr:ptr+blocksize] + chunk = radio.get_mmap()[ptr:ptr+blocksize] ptr += blocksize - radio.pipe.write(bitwise.string_straight_decode(cmd + chunk)) + radio.pipe.write(cmd + chunk) LOG.debug(util.hexprint(cmd + chunk)) ack = radio.pipe.read(1) - if not ack == "\x06": + if not ack == b"\x06": raise Exception("Radio did not ack block %i" % ptr) # radio.pipe.write(ack) diff --git a/tests/Python3_Driver_Testing.md b/tests/Python3_Driver_Testing.md index ee83bd9d..7efa00be 100644 --- a/tests/Python3_Driver_Testing.md +++ b/tests/Python3_Driver_Testing.md @@ -300,16 +300,16 @@ | Vertex_Standard_VXA-700 | | | | 0.02% | | WACCOM_MINI-8900 | [@KC9HI](https://github.com/KC9HI) | 11-Nov-2022 | Yes | 0.12% | | WLN_KD-C1 | [Implied by Retevis_RT22](#user-content-Retevis_RT22) | 9-Dec-2022 | Yes | **1.73%** | -| Wouxun_KG-816 | | | | 0.07% | -| Wouxun_KG-818 | | | | 0.04% | +| Wouxun_KG-816 | [Implied by Wouxun_KG-UV6](#user-content-Wouxun_KG-UV6) | 11-Dec-2022 | Yes | 0.07% | +| Wouxun_KG-818 | [Implied by Wouxun_KG-UV6](#user-content-Wouxun_KG-UV6) | 11-Dec-2022 | Yes | 0.04% | | Wouxun_KG-935G | | | | 0.05% | -| Wouxun_KG-UV6 | | | | 0.19% | +| Wouxun_KG-UV6 | [@KC9HI](https://github.com/KC9HI) | 11-Dec-2022 | Yes | 0.19% | | Wouxun_KG-UV8D | | | | 0.24% | | Wouxun_KG-UV8D_Plus | | | | 0.08% | | Wouxun_KG-UV8E | | | | 0.05% | | Wouxun_KG-UV920P-A | | | | 0.04% | | Wouxun_KG-UV9D_Plus | | | | 0.39% | -| Wouxun_KG-UVD1P | | | | 0.35% | +| Wouxun_KG-UVD1P | [Implied by Wouxun_KG-UV6](#user-content-Wouxun_KG-UV6) | 11-Dec-2022 | Yes | 0.35% | | Yaesu_FT-1500M | [@f3sty](https://github.com/f3sty) | 05-Dec-2022 | Yes | 0.02% | | Yaesu_FT-1802M | | | Yes | 0.02% | | Yaesu_FT-1D_R | | | Yes | 0.03% | @@ -360,9 +360,9 @@ **Drivers:** 355 -**Tested:** 57% (205/150) (86% of usage stats) +**Tested:** 58% (209/146) (86% of usage stats) -**Byte clean:** 73% (262/93) +**Byte clean:** 74% (266/89) ## Minimal test prodecure For the purposes of the Python 3 effort, a "tested" radio means diff --git a/tests/py3_driver_testers.txt b/tests/py3_driver_testers.txt index cd3f6b32..5cf2f9ab 100644 --- a/tests/py3_driver_testers.txt +++ b/tests/py3_driver_testers.txt @@ -189,6 +189,10 @@ TYT_TH9000_220,+Retevis_RT9000D_220-260,8-Dec-2022 TYT_TH9000_440,+Retevis_RT9000D_400-490,8-Dec-2022 WACCOM_MINI-8900,@KC9HI,11-Nov-2022 WLN_KD-C1,+Retevis_RT22,9-Dec-2022 +Wouxun_KG-816,+Wouxun_KG-UV6,11-Dec-2022 +Wouxun_KG-818,+Wouxun_KG-UV6,11-Dec-2022 +Wouxun_KG-UV6,@KC9HI,11-Dec-2022 +Wouxun_KG-UVD1P,+Wouxun_KG-UV6,11-Dec-2022 Yaesu_FT-1500M,@f3sty,05-Dec-2022 Yaesu_FT-70D,@n8sqt,05-Dec-2022 Yaesu_FT-7800_7900,@kk7ds,24-Oct-2022