Wouxun KG-UV3D Radio Information
I recently received a Wouxun KG-UV3D radio.
This is a dual band (2 meter / 440) radio that is fairly inexpensive.
I wanted to program this with Linux using the USB cable sold with
the radio. I encountered some problems so am documenting the detalis
here in hopes that this may be useful to other Linux users.
I tried 2 software programs written for Linux and 2 for Windows.
The Windows software I tried running on Ubuntu 11.04 under Wine.
I tried the factory software as found on the powerwerx web page under Wine.
This seemed to get in an endless loop of trying to install then uninstall the
driver software for the USB to serial programming cable.
I found another package "KG-UV Commander" and tried that under Wine.
This sofware would read from the radio but it encountered an error trying to
write to the radio giving me an error message indicating some program malfunction.
Some searching indicated that a package called "Open Wouxun" (or "owx") was
run successfully on a lot of Linux systems. I pulled the source from this site:
http://owx.chmurka.net/
and compiled it. This is a c++ program and I downloaded a version with the
following header in the README file:
/* $Id: README 3 2011-03-14 14:05:30Z gophi $ */
The ChangeLog file had this header:
/* $Id: ChangeLog 7 2011-04-15 14:27:20Z gophi $ */
When the downloaded tar file was extracted I ended up with:
owx-20111218
It is interesting to note that the most recent entry in the ChangeLog file indicates
that on 2011-04-15 a hang when using the USB to serial converter was fixed.
This is exactly the problem that I found. I did pick up the most recent version from
the web site but I have to wonder if it did not include that fix.
When trying to run the progam it would hang on an open statement.
I added "O_NONBLOCK" to the open and found that while it did not hang the
open now failed.
I then tried a python program called "chirp" found here:
http://chirp.danplanet.com/
That prorgam was able to read and write to the radio. I ran an strace and found that
the open() call included O_LARGEFILE flag. I added this to the owx code and solved
the hang.
Some summay detals.
My /var/log/messages file reports the following when the USB to serial programming
cable is connected:
kernel: usbcore: registered new interface driver usbserial
kernel: USB Serial support registered for generic
kernel: usbcore: registered new interface driver usbserial_generic
kernel: usbserial: USB Serial Driver core
kernel: USB Serial support registered for pl2303
kernel: pl2303 6-1:1.0: pl2303 converter detected
kernel: usb 6-1: pl2303 converter now attached to ttyUSB0
kernel: usbcore: registered new interface driver pl2303
kernel: pl2303: Prolific PL2303 USB to serial adaptor driver
The "Open Wouxun" software used the following code in comm.cc
void CComm::Open(const std::string &dev, unsigned timeout)
{
m_fd = open(dev.c_str(), O_RDWR | O_NOCTTY);
if (m_fd == -1)
Throw(_("Cannot open dev %s: %s"), dev.c_str(), strerror(errno))
I changed this to the following:
void CComm::Open(const std::string &dev, unsigned timeout)
{
m_fd = open(dev.c_str(), O_RDWR | O_NOCTTY | O_NONBLOCK | O_LARGEFILE);
if (m_fd == -1)
Throw(_("Cannot open dev %s: %s"), dev.c_str(), strerror(errno));
I have compiled and executed this on Red Hat Linux RHEL 6.2 on x86_64 with a 64 bit install
and also on Ubuntu 11.04 i686, a 32 bit install. I have read and written the radio data on both
systems.
I ran the owx software with the -p /dev/ttyUSB0 option to specify /dev/ttyUSB0 as the port.
If you encounter a similar hang try this change in the program.
A big thanks to the authors of the Linux programming software. Publishing the source
was a huge help.
73, Dale