sergev / baoclone

A command-line utility for saving, restoring and modifying the configuration of Baofeng handheld radios.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Empty names not handled properly for UV-5R and UV-B5

GoogleCodeExporter opened this issue · comments

What steps will reproduce the problem?

1. Clone the config of a Baofeng UV-5R which has no channel names (as would be 
true if the radio has only previously been programmed from the faceplate), 
generating a device.conf file.
2. Attempt to write that device.conf file (i.e. NOT the .img) back to the radio 
using the -c flag.

What is the expected output? What do you see instead?

The expected result is that the radio be reprogrammed with the contents of the 
generated config file, which should put the radio in its original state (since 
the config was generated off the radio's current state). 

The actual result is that the baoclone utility claims the lines in the "Table 
of programmed channels" section are invalid configuration lines. For example:

    $ baoclone -c /dev/tty.PL2303-00001004 device.conf 
    Connect to /dev/tty.PL2303-00001004.
    Detected Baofeng UV-5R.
    Read device: ################################################## done.
    Radio: Baofeng UV-5R
    Firmware: Ver  BFB297
    Serial: [removed]
    Write image to file 'backup.img'. 
    Read configuration from file 'device.conf'.
    Invalid line: '    1           144.3900  0          -       -    High  Wide   +    -   -     -'

This issue appears to be that I've only ever programmed my radio from the 
faceplate, and thus my memory channels do not have alphanumeric names. The 
generated baoclone .conf file therefore has no text in the second field for 
each memory location. 

When uv-5r.c attempts to parse this generated config file in parse_channel() 
using `sscanf(line, "%s %s ...` on line 1174, it presumably misses the missing 
name field, thus retrieving 11 fields rather than 12. This is my supposition; I 
have not confirmed with a debugger or a careful analysis of the code. 

My workaround is to duplicate the channel number field for use as the channel 
name for channels which do not have specific alphanumeric names assigned. 

I would suggest one or more of the following fixes be implemented:

- That the baoclone config file generator implement the channel-number-as-name 
workaround; 
- or that a more sophisticated parser which can handle missing fields be used 
in parse_channel();
- or that the config syntax be modified to allow for explicit configuration of 
empty field – either with an "empty" symbol (e.g. "-"), or by switching to a 
non-whitespace delimiter, as in a comma separated value (CSV) file. 

However, I am not familiar enough with the code base to make a firm 
recommendation. 

What version of the product are you using? On what operating system?

I'm using git head at 4a399db2b0a39bbf7de7b0fa9bd55280521c7f96 (i.e. baoclone 
v1.2), compiled on Mac OS X 10.6.7 Slow Leopard. 

Please provide any additional information below.

I'm attempting to clone/program a Baofeng UV-5RA (late 2012) radio which has 
never previously been programmed from a computer. The radio's memory channels 
thus do not have alphanumeric name labels.

Original issue reported on code.google.com by caseb...@gmail.com on 23 Sep 2013 at 1:35

This issue was closed by revision 7420904b468d.

Original comment by se...@vak.ru on 27 Sep 2013 at 3:58

  • Changed state: Fixed
Fixed in revision 7420904. Empty names printed and can be configured as "-". 

Original comment by se...@vak.ru on 27 Sep 2013 at 4:04

  • Changed title: Empty names not handled properly for UV-5R and UV-B5