New Model #53

Support Wouxun KG-UV6D

Added by Richard Shaw over 10 years ago. Updated over 1 year ago.

Status:Closed Start date:02/12/2012
Priority:Low Due date:
Assignee:Filippi Marco % Done:

0%

Category:-
Target version:0.3.0
Chirp Version:daily Equipment Loan Offered:

Description

Please consider supporting the Wouxun KG-UV6D. From what I can gather it's somewhat different from the UV2D since you can not use the software from the UV2D and even suggests it can kill your radio.

http://www.wouxun.us/item.php?item_id=222&category_id=50

wouxun6.patch - Initial wouxun6 patch (2.2 kB) Dan Smith, 03/14/2012 05:32 pm

output - KG-UV6D (3.1 kB) Stefano Comelli, 03/17/2012 08:18 am

wouxun6_r2.patch - Replacement initial wouxun patch (2.2 kB) Dan Smith, 03/17/2012 09:06 am

output_r2 - Output v2 (3.3 kB) Stefano Comelli, 03/17/2012 09:31 am

wouxun6_r3.patch (2.2 kB) Dan Smith, 03/17/2012 09:34 am

output_r3 (3.4 kB) Stefano Comelli, 03/17/2012 09:57 am

wouxun6_r4.patch - Wouxun patch to accept id and attempt download (2.3 kB) Dan Smith, 03/17/2012 10:18 am

output_r4 (3.1 kB) Stefano Comelli, 03/17/2012 10:23 am

output.log (3.1 kB) Richard Shaw, 03/19/2012 03:41 pm

Wouxun_KG-UVD6D.img - First image dowloaded from radio (8 kB) Filippi Marco, 05/24/2012 03:46 pm

wouxun_menu_lock.patch (1.8 kB) Dan Smith, 05/25/2012 07:12 pm

Wouxun-KG-UV6X-pristine.img - Initial dump from KG-UV6X, pristine (8 kB) Ed Santiago, 05/25/2012 07:26 pm

Associated revisions

Revision 1642:5751626bad70
Added by Filippi Marco over 10 years ago

[KG-UV6D/X] Initial support
implements feature #53

Revision 1643:7e89257ef507
Added by Filippi Marco over 10 years ago

[KG-UV6X] Correct frequency ranges
feature #53

Revision 1644:b40d50bf2ec5
Added by Filippi Marco over 10 years ago

[KG-UV6D/X] Add some radio settings
feature #53

Revision 1641:a7c902f31373
Added by Dan Smith over 10 years ago

[wouxun] Add RadioSetting for Menu Available toggle
Related to #53

Revision 1650:4cef6921b16d
Added by Dan Smith over 10 years ago

[wouxun] Fix CHARSET to include - but not ' ' and valid_characters too
Related to #53

Revision 1651:7248ad8a87fc
Added by Dan Smith over 10 years ago

[wouxun] Fix previous patch's valid_characters
Still somewhat related to #53

History

Updated by Dan Smith over 10 years ago

  • Status changed from New to Blocked
  • Priority changed from Normal to Low

I will certainly evaluate and make an attempt when I have an opportunity to get my hands on one.

I will say, however, that supporting these radios in a sane and safe way is an ever-increasing challenge. The ultra-low cost chinese manufacturers do no design and architecting of their products, which leads to issues like the one they have created with incompatible software and radio versions. This becomes somewhat of a liability for me, as CHIRP becomes a path to potentially bricking a radio.

Updated by Richard Shaw over 10 years ago

Is there anything I can do to help? I could do a read/write using the supplied software if there was a way to capture the serial input/output. I'm currently using Fedora 16 but running the software on a virtualized Windows XP instance.

Updated by Dan Smith over 10 years ago

Unfortunately, probably not. Have you tried downloading an image with the existing Wouxun driver? Even if it doesn't decode the memories properly, you may be able to save the image and attach it here. I can't promise anything, but I could take a look.

You can try using a serial sniffer and sending me a transcript of the communication, but having me develop at a distance may get rather frustrating and error-prone.

Updated by Dan Smith over 10 years ago

This isn't very helpful, but I think that if you (and others) want CHIRP support for the UV6, one path might be to contact the vendor you bought it from and tell them. Wouxun.us has helped in the past with providing equipment for the initial driver to be written. The radio is so cheap that it would be pretty trivial for any of the vendors to spare one, especially if their customers want CHIRP support.

So, something to think about... :)

Updated by David Behar over 10 years ago

For the Wouxun KG-UV6D, the communications protocol and the radio memory map for channel attributes are the same as for the KG-UVD1 (and successors) with the following exceptions:

Memory map - channel attributes (other than label): KG-UVD1 has 128 memory structures of sixteen bytes, starting at 0x0010. KG-UV6D has 199 memory structures of sixteen bytes, starting at 0x0010.

Memory map - channel labels: KG-UVD1 has 128 memory structures of 16 bytes (only first six bytes usable), starting at 0x1010. KG-UV6D has 199 memory structures of sixteen bytes, starting at 0x1010.

Communications protocol: For KG-UVD1, "log in" with the string "HiWOUXUN", followed by 0x02. For KG-UV6D, log in with "HiWXUVD1" -- apparently with no 0x02 following (or at least not necessary).

Channel steps accommodated. For KG-UVD1, frequencies must be a multiple of 5 kHz or a multiple of 6.25 kHz. (I believe the radio will round or round down -- not sure -- if a frequency has been specified which does not meet this requirement.) For KG-UV6D standard models, frequencies must be a multiple of 2.5 kHz or a multiple of 6.25 kHz. (Note that there are models of the KG-UV6D which do not accommodate 2.5 kHz spacing -- rather, they are like the KG-UVD1.)

Feel free to contact me for additional info, or for perhaps some help with testing.

David

Updated by Richard Shaw over 10 years ago

David,

Thanks for the detailed info!

Dan,

Does this take care of your needs? Is there anything I can do to help at this point?

Thanks,
Richard

Updated by Dan Smith over 10 years ago

  • Chirp Version changed from 0.1.12 to 0.2.0

Richard,

Yeah, it might be enough. Are either of you running Linux? It would be much easier to communicate a patch for you to test if so...

Thanks!

Updated by Dan Smith over 10 years ago

Here's a patch against the current tip that will provide the first bit of testing we need. There is another model number the early radios go by (KG669V) which I don't know for the UV6. So, if you can apply and run this patch, it will fail during identification, but will print out the information that I need.

Thanks!

Updated by Stefano Comelli over 10 years ago

Hi, I am a owner of the KG-UV6D, I've applied & tested the patch, I hope the attached file is containing the info you need.
Thank you.

Updated by Dan Smith over 10 years ago

Actually, not, but only because there was a bug in the patch. Sorry about that. I'm attaching a second revision, so if you could apply that and re-test I would appreciate it. This is in place of the previous one, so start with a fresh tree or unapply the previous one first.

Thanks!

Updated by Stefano Comelli over 10 years ago

Ok, second try. I do not know if is it relevant, but my radio is connected to my Ubuntu 11.10 thru USB cable.

Updated by Dan Smith over 10 years ago

Aiee, sorry, another typo in the patch. Attaching r3. It sure is hard to develop by proxy like this, my apologies for the extra work.

Hopefully after you get the output from this patch, I'll be able to post one that actually downloads :)

Updated by Stefano Comelli over 10 years ago

Ok, no problem at all, no need to apoligies, I'm happy to help :-)

Updated by Dan Smith over 10 years ago

Okay, got farther. It doesn't behave exactly like David says, but it is sending back the ASCII ACK character. The attached patch should treat that as success and attempt a download.

After the download, you may or may not see actual data decoded in the memory editor. However, you should be able to save it as a .img and attach here, if the download completes.

Thanks!

Updated by Stefano Comelli over 10 years ago

No download complete yet, still an error.
Now I've to go, see you later...

Updated by David Behar over 10 years ago

Re post #14... If you have a moment, Dan, I would be interested in learning about any errors you (or anyone) has found in information I posted in post #5. Thanks! David

Updated by Richard Shaw over 10 years ago

I applied the patch to my version of chrip (0.1.12) and when I try to start chirp I get the following error:

$ chirpw
Traceback (most recent call last):
File "/usr/bin/chirpw", line 28, in <module>
from chirpui import mainapp, config
File "/usr/lib/python2.7/site-packages/chirpui/mainapp.py", line 35, in <module>
from chirp import platform, xml, csv, directory, ic9x, kenwood_live, idrp, vx7
File "/usr/lib/python2.7/site-packages/chirp/directory.py", line 24, in <module>
from chirp import wouxun
File "/usr/lib/python2.7/site-packages/chirp/wouxun.py", line 336, in <module>
@directory.register
NameError: name 'directory' is not defined

Updated by Dan Smith over 10 years ago

David,

The earlier radios return a model number after the "logon" message. The UV6 seems to be returning just an ASCII ACK byte (0x06). It's not clear yet if that is a "good" thing and if it will allow a download to begin after that.

Richard,

0.1.12 is very old and thus you must apply the patch to a recent version. Preferably a snapshot of the repository (see the developers page on the website) or a very recent daily build.

Updated by Richard Shaw over 10 years ago

Dan,

I'm working on getting an updated version (0.2.0) packaged for Fedora but for some reason it's trying to install everything into /usr/usr instead of one /usr. I'm using the original spec file from the 0.1.12 source RPM which doesn't appear to contain anything strange. I've tried removing the --prefix option but it still does this. Any ideas?

Richard

Updated by Dan Smith over 10 years ago

Richard, lets please not confuse this bug with unrelated issues. Feel free to send me the spec and/or open a different bug for discussion, but lets not do it here.

Updated by Richard Shaw over 10 years ago

Sorry about that. I just want to be able to take whatever modifications you some up with here and get it into Fedora properly when we're done. I patched around the problem and I'll submit it separately. So apparently 0.2.0 isn't new enough either. What's the chances of getting a 0.2.1 release once this is figured out?

Updated by Dan Smith over 10 years ago

0.2.0 should be plenty new enough to use as a patch base for this.

0.2.1 will actually come out fairly soon, but it will only have bug fixes. This is new feature, so it won't go until 0.3.0 under the new versioning scheme, but it will be available in the daily builds as soon as we have something that actually works (as with all other changes).

Updated by Richard Shaw over 10 years ago

Well I initially had a crash in 0.2.0 with the UV6D patch applied but I just tried over SSH/X11 forwarding and it seems to work. Obviously I can't get any output from the radio until I get home from work.

Updated by Richard Shaw over 10 years ago

I got a chance to try a download and here's the results.

Updated by Dan Smith over 10 years ago

Hmm, this was a UV6? It behaves differently than Stefano's apparently, in that it returns a radio model code (like the UV1,2,3 do), although it's not enough to do a download. It appears that when I ask for the first block of data, I get only a few bytes instead of the full block I'm expecting. This is why developing without the hardware in hand is very difficult.

We'll have to wait for David to maybe comment on more differences in the behavior.

Updated by Richard Shaw over 10 years ago

Yes, it's the regular KG-UV6D. Are you sure Stefano's didn't output it as well? I looked at his last attachment and it's identical to mine:

000: 4b 47 36 36 39 56 f8 00 KG669V..

Updated by Richard Shaw over 10 years ago

Dan,

I just wanted to check in and see if there's any more information I can provide.

Updated by David Behar over 10 years ago

Regarding the login protocol, maybe this will be helpful:

000038: Write Request (DOWN), 15.11.2011 13:51:34.326 +0.0
Buffer size: 0x8 bytes
48 69 57 58 55 56 44 31 HiWXUVD1

000041: Read Request (UP), 15.11.2011 13:51:34.326 +0.0
Buffer size: 0x1 bytes
Status: 0x00000000
06 .

000042: Write Request (DOWN), 15.11.2011 13:51:34.326 +0.0
Buffer size: 0x1 bytes
02 .

000045: Read Request (UP), 15.11.2011 13:51:34.342 +0.015
Buffer size: 0x8 bytes
Status: 0x00000000
06 4B 47 36 36 39 56 F8 .KG669Vø

000046: Write Request (DOWN), 15.11.2011 13:51:34.342 +0.0
Buffer size: 0x1 bytes
06 .

000049: Read Request (UP), 15.11.2011 13:51:34.342 +0.0
Buffer size: 0x1 bytes
Status: 0x00000000
06 .

Updated by Filippi Marco over 10 years ago

  • Chirp Version changed from 0.2.0 to 0.2.2

Next monday a friend will lend me a KG-UV6D for a week or two, my plan is to give a big step forward to the support of this model.

Dan - please confirm wouxun6_r4.patch is actually the state of the art
Stefano - be ready for beta testing ;)
@ all - please update me with any info that can help

Updated by Dan Smith over 10 years ago

  • Assignee set to Filippi Marco
  • Target version set to 0.3.0

Marco,

Yes, that's my latest. However, remember that I never actually tested any of it myself, so it may be completely wrong when you get the radio :)

Thanks very much for doing this!

Updated by Tom Hayward over 10 years ago

  • Status changed from Blocked to In Progress

Updated by Ed Santiago over 10 years ago

Hi. I just (10 minutes ago) received a new KG-UV6X (I don't know how/if it differs from a UV6D). Have tried chirp-0.2.2 and hg e7cbbe3465f1 (2012-05-23). Both crash as follows:

User selected Wouxun KG-UV6D on port /dev/ttyUSB0
Clone thread started
000: 4b 47 36 36 39 56 f8 00   KG669V..

-- Exception: --
Traceback (most recent call last):
  File "/home/esm/src/net/wouxun/chirp/chirp.hg/chirpui/clone.py", line 223, in run
    self.__radio.sync_in()
  File "/home/esm/src/net/wouxun/chirp/chirp.hg/chirp/wouxun.py", line 409, in sync_in
    self._mmap = wouxun6_download(self)
  File "/home/esm/src/net/wouxun/chirp/chirp.hg/chirp/wouxun.py", line 167, in wouxun6_download
    return do_download(radio, 0x0000, 0x2000, 0x0040)
  File "/home/esm/src/net/wouxun/chirp/chirp.hg/chirp/wouxun.py", line 104, in do_download
    len(cmd) + blocksize))
Exception: Failed to read full block (7!=68)
------
Clone failed: Failed to read full block (7!=68)
Clone thread ended
--- Exception Dialog: Failed to read full block (7!=68) ---
None
----------------------------

I'll help any way I can: I'm highly motivated, because I have no access to Windoze (Linux only)... and I can't use my radio, because (this was not clear when I ordered it) it comes from the factory with the keyboard locked. Argh.

Updated by Ed Santiago over 10 years ago

Okay ... got a little farther. I'm able to Alt-D download from radio by making the following changes to the patch:

+    return _wouxun_identify(radio, "HiWXUVD1")
+    return _wouxun_identify(radio, "HiWXUVD1\x02")

(that is, append \x02 just like the other radios. This seems to make the radio respond with KG669V instead of a 1-char response.)

Also need to patch:

+    _model = "KG????" 
+    _model = "KG669V" 

(that is: the _model string is exactly the same as the other radios).

Unfortunately, I don't see any way for Chirp to unlock my radio.

Updated by Dan Smith over 10 years ago

Marco's patch will probably enable cloning with your radio, if you can stand by for it. He or I can also add support for the keypad lock fairly easily once we see if the patch allows cloning.

Updated by Ed Santiago over 10 years ago

It doesn't seem to be a keypad lock: from the brief note included with the radio, and the symptoms, it appears to be the Menu key that's locked. And I can't find any way to unlock it without their (Windows) software. Will "cloning", whatever that is, allow a way to see that value and change it?

One more data point: I (gulp) was able to make some changes using Chirp, upload to the radio, and I'm now able to transmit/receive on my SAR frequencies.

And, duh, I neglected to mention that my tests above all included the wouxun6_r4 patch (with manual tweaking when applied against hg tip).

Updated by Dan Smith over 10 years ago

Right, we'll just find the bit that restricts the menu key and add a switch in chirp that lets you flip that.

Dunno about the transmit thing. Were you able to do that before? I thought you had no way to program things into it.. maybe you were just in VFO mode? Maybe there's a band split setting somewhere?

Updated by Ed Santiago over 10 years ago

Dan Smith wrote:

Right, we'll just find the bit that restricts the menu key and add a switch in chirp that lets you flip that.

Oh please oh please oh please! :-)

Dunno about the transmit thing. Were you able to do that before? I thought you had no way to program things into it.. maybe you were just in VFO mode? Maybe there's a band split setting somewhere?

Sorry; I haven't communicated clearly. What I meant to say was that I have successfully used Chirp to download from my new radio, program in two local frequencies, and upload them back to the radio. Brief chronology:

  • 1650 UPS delivers radio
  • 1655 I read the prominent "your radio is locked" warning sheet, which indicates that I need Windows to unlock the Menu key
  • 1700 Decide to try Chirp anyway. Eventually get download working, using wouxun6_r4.patch + the edits in comment #34
  • 1830 Decide (gulp) to upload to radio despite risk of bricking. It worked. Menu key is still disabled, and the only thing I can do is switch between frequencies (i.e. I can't disable the annoying voice or use VFO mode), but I can transmit and receive on the frequencies I need for tomorrow's SAR practice. That's good enough for the time being.

I hope that clarifies. My apologies for not being more clear. And my thanks for Chirp and for your prompt replies.

Updated by Dan Smith over 10 years ago

Ah, I thought you said "can't transmit". Well, that's good news. I think we'll see a patch from Marco soon that makes chirp able to program both the old and new models. I'll take a look at the lock thing real quick and see if it's trivial.

Updated by Dan Smith over 10 years ago

Here's a patch. Applied on top of the current tree, it adds a RadioSetting (settings tab on the left, under Memories) that lets me toggle it on my UV2.

Updated by Ed Santiago over 10 years ago

Promising! But it doesn't seem to do anything: I can toggle it, but uploading to radio makes no difference. Menu key still has no effect. It's bedtime over here so I'm done playing for the evening.

Incidentally, I downloaded Marco's first image and diff'ed (using hexdump -C) against the original dump I saved from my unit when it arrived (pristine, untouched). They differ in some possibly-interesting fields, so I'm attaching Wouxun*pristine.img in case it's of use. Again, my model is UV6X instead of 6D.

Thanks again for all your quick work,
Ed

Updated by Dan Smith over 10 years ago

Hrm, yeah, your image doesn't have similar-looking stuff around the bit that my UV2 uses for the lock. Hopefully Marco can confirm that my lock bit patch doesn't work for his UV6, and similarly find where the lock bit is on hi UV6, which hopefully will be the same as yours. I think all the UV6* radios use the same programming software, so I'm sure we'll work it out.

Thanks!

Updated by Filippi Marco over 10 years ago

  • Chirp Version changed from 0.2.2 to daily

Patch has been sent to developer list.

Please test it!!!!

Updated by Filippi Marco over 10 years ago

  • Status changed from In Progress to Closed

Patch in daily build and no bug report

Also available in: Atom PDF