[chirp_devel] [PATCH] Support Wouxun KG-818 with KG-816 driver. #356

Tom Hayward
Sun Feb 17 12:12:40 PST 2013


# HG changeset patch
# User Tom Hayward <tom at tomh.us>
# Date 1361131936 28800
# Node ID 7b5f7fd9262ca867e086634c6596443091ce575a
# Parent  3aeeaedfb5f721bf72c26a416b0a053f96173831
Support Wouxun KG-818 with KG-816 driver. #356

diff -r 3aeeaedfb5f7 -r 7b5f7fd9262c chirp/wouxun.py
--- a/chirp/wouxun.py	Sat Feb 16 21:30:58 2013 -0500
+++ b/chirp/wouxun.py	Sun Feb 17 12:12:16 2013 -0800
@@ -953,42 +953,42 @@
         top = RadioSettingGroup("top", "All Settings", freqranges)
 
         rs = RadioSetting("vhf_rx_start", "vhf rx start",
-                          RadioSettingValueInteger(136, 520, 
+                          RadioSettingValueInteger(66, 520, 
                                 decode_freq(
                                     self._memobj.freq_ranges.vhf_rx_start)))
         freqranges.append(rs)
         rs = RadioSetting("vhf_rx_stop", "vhf rx stop",
-                          RadioSettingValueInteger(136, 520, 
+                          RadioSettingValueInteger(66, 520, 
                                 decode_freq(
                                     self._memobj.freq_ranges.vhf_rx_stop)))
         freqranges.append(rs)
         rs = RadioSetting("uhf_rx_start", "uhf rx start",
-                          RadioSettingValueInteger(136, 520, 
+                          RadioSettingValueInteger(66, 520, 
                                 decode_freq(
                                     self._memobj.freq_ranges.uhf_rx_start)))
         freqranges.append(rs)
         rs = RadioSetting("uhf_rx_stop", "uhf rx stop",
-                          RadioSettingValueInteger(136, 520, 
+                          RadioSettingValueInteger(66, 520, 
                                 decode_freq(
                                     self._memobj.freq_ranges.uhf_rx_stop)))
         freqranges.append(rs)
         rs = RadioSetting("vhf_tx_start", "vhf tx start",
-                          RadioSettingValueInteger(136, 520, 
+                          RadioSettingValueInteger(66, 520, 
                                 decode_freq(
                                     self._memobj.freq_ranges.vhf_tx_start)))
         freqranges.append(rs)
         rs = RadioSetting("vhf_tx_stop", "vhf tx stop",
-                          RadioSettingValueInteger(136, 520, 
+                          RadioSettingValueInteger(66, 520, 
                                 decode_freq(
                                     self._memobj.freq_ranges.vhf_tx_stop)))
         freqranges.append(rs)
         rs = RadioSetting("uhf_tx_start", "uhf tx start",
-                          RadioSettingValueInteger(136, 520, 
+                          RadioSettingValueInteger(66, 520, 
                                 decode_freq(
                                     self._memobj.freq_ranges.uhf_tx_start)))
         freqranges.append(rs)
         rs = RadioSetting("uhf_tx_stop", "uhf tx stop",
-                          RadioSettingValueInteger(136, 520, 
+                          RadioSettingValueInteger(66, 520, 
                                 decode_freq(
                                     self._memobj.freq_ranges.uhf_tx_stop)))
         freqranges.append(rs)
@@ -1005,8 +1005,24 @@
         if len(filedata) == 8192 and \
                 filedata[0x60:0x64] != "2009" and \
                 filedata[0x1f77:0x1f7d] == "\xff\xff\xff\xff\xff\xff" and \
-                filedata[0x0d70:0x0d80] != "\xff\xff\xff\xff\xff\xff\xff\xff" \
-                                           "\xff\xff\xff\xff\xff\xff\xff\xff": 
+                filedata[0x0d70:0x0d80] not in (
+                    "\xff\xff\xff\xff\xff\xff\xff\xff" \
+                    "\xff\xff\xff\xff\xff\xff\xff\xff",
+                    "w\xeew1w\xeew1w\xeew1w\xeew1"):  # <-- KG818 Low Band PMR
             return True
         return False
 
+
+ at directory.register
+class KG818Radio(KG816Radio):
+    """Wouxun KG818"""
+    MODEL = "KG818"
+
+    @classmethod
+    def match_model(cls, filedata, filename):
+        if len(filedata) == 8192 and \
+                filedata[0x60:0x64] != "2009" and \
+                filedata[0x1f77:0x1f7d] == "\xff\xff\xff\xff\xff\xff" and \
+                filedata[0x0d70:0x0d80] == "w\xeew1w\xeew1w\xeew1w\xeew1":
+            return True
+        return False



More information about the chirp_devel mailing list