[chirp_devel] binary compare tool, bitdiff.py

Jens J.
Wed Nov 20 12:58:43 PST 2013


Here is bitdiff.py (originally named bincmp.py), a tool for doing byte/bit comparison of two files, with the focus on radio images/savefiles.

I have added an option that will parse .DAT files (i.e., the ones that baofeng/baojie, et al oem software output),
as well as a facility to log to csv file, hopefully making it easier to iterate through oem software changes while mapping out memories.

I'm envisioning even making this a process where a non-developer can help with the task of mapping some of this stuff out, as it's usually just a tedious process with out much in-depth technical work, e.g., make a change and save the file (or download the image); rinse and repeat N-dozen times...

Dan,
don't have a bug number - do you want me to create one for this since it's a developer tool?


hackpro:build jens$ chirp.hg/tools/bitdiff.py -h
usage: bitdiff.py [-h] [-o OFFSET] [-d] [-w] [-c CSV] [-s SETTING] [-v VALUE]
                  file1 file2

byte-/bit- comparison of two files

positional arguments:
  file1                 first (reference) file to parse
  file2                 second file to parse

optional arguments:
  -h, --help            show this help message and exit
  -o OFFSET, --offset OFFSET
                        offset (hex) to start comparison
  -d, --dat             process input files from .DAT format (from 'jujumao'
                        oem programming software for chinese radios)
  -w, --watch           'watch' changes. runs in a loop
  -c CSV, --csv CSV     file to append csv results. format: filename1,
                        filename2, byte_offset, byte1, bits1, byte2, bits2,
                        item_msg, value_msg
  -s SETTING, --setting SETTING
                        user-meaningful field indicating setting/item
                        modified, e.g. 'beep' or 'txtone'
  -v VALUE, --value VALUE
                        user-meaningful field indicating values changed, e.g.
                        'true->false' or '110.9->100.0'
hackpro:build jens$ 
hackpro:build jens$ chirp.hg/tools/bitdiff.py --dat --csv foo.csv --setting "squelch" --value "6->7" 1.dat 2.dat 
1: 1.dat  2: 2.dat
setting: squelch value: 6->7
@0F0Ah
1:06h, 00000110b
2:07h, 00000111b
bytes read: 7936
hackpro:build jens$ 
hackpro:build jens$ cat foo.csv 
filename1, filename2, byte_offset, byte1, bits1, byte2, bits2, item_msg, value_msg
1.dat, 2.dat, 0F0A, 06, 00000110, 07, 00000111, squelch, 6->7
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tools-bitdiff.patch
Type: application/octet-stream
Size: 3745 bytes
Desc: not available
Url : http://intrepid.danplanet.com/pipermail/chirp_devel/attachments/20131120/12345a03/attachment-0001.obj 


More information about the chirp_devel mailing list