diff options
author | Gary E. Miller <gem@rellim.com> | 2019-04-26 18:13:25 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2019-04-26 18:13:25 -0700 |
commit | 1bdb9bf4f23b2c91b9635361e091a99d79e80e5e (patch) | |
tree | 0bf208188fc81409e26da180bc5000733548ce6c /ubxtool | |
parent | 3de1b8303dab84cb67fa1b4d39ae4dd5b0a055a7 (diff) | |
download | gpsd-1bdb9bf4f23b2c91b9635361e091a99d79e80e5e.tar.gz |
ubxtool: Allow multiple -x on the command line.
u-blox allows up to 64 in one packet.
Diffstat (limited to 'ubxtool')
-rwxr-xr-x | ubxtool | 42 |
1 files changed, 24 insertions, 18 deletions
@@ -72,8 +72,8 @@ VERB_PROG = 5 # program trace opts = { # command to send to GPS, -c 'command': None, - # default -x item - 'del_item': None, + # default -x items, up to 64 per call + 'del_item': [], # command for -d disable 'disable': None, # command for -e enable @@ -82,7 +82,7 @@ opts = { 'help': None, # default input -f file 'input_file_name': None, - # default -g item + # default -g items, up to 64 per call 'get_item': [], # default forced wait? -W 'input_forced_wait': False, @@ -3955,18 +3955,21 @@ class ubx(object): gps_model.gps_send(0x0a, 0x36, m_data) def send_cfg_valdel(self, key): - """UBX-CFG-VALDEL, delete config item""" - m_data = bytearray(8) + """UBX-CFG-VALDEL, delete config items by key""" + m_data = bytearray(4) m_data[0] = 0 # version, 0 = transactionless, 1 = transaction m_data[1] = 2 # 2 = BBR, 4 = flash - m_data[4] = (key) & 0xff - m_data[5] = (key >> 8) & 0xff - m_data[6] = (key >> 16) & 0xff - m_data[7] = (key >> 24) & 0xff + for key in keys: + k_data = bytearray(4) + k_data[0] = (key) & 0xff + k_data[1] = (key >> 8) & 0xff + k_data[2] = (key >> 16) & 0xff + k_data[3] = (key >> 24) & 0xff + m_data.extend(k_data) gps_model.gps_send(0x06, 0x8c, m_data) def send_cfg_valget(self, keys): - """UBX-CFG-VALGET, get config item""" + """UBX-CFG-VALGET, get config items by key""" m_data = bytearray(4) m_data[0] = 0 # version, 0 = request, 1 = answer m_data[1] = 0 # RAM layer @@ -4574,7 +4577,7 @@ for (opt, val) in options: sys.stderr.write('%s: Version %s\n' % (PROG_NAME, gps_version)) sys.exit(0) elif opt == '-x': - opts['del_item'] = val + opts['del_item'].append(val) elif opt == '-z': opts['set_item'] = val @@ -4687,13 +4690,16 @@ try: gps_model.gps_send(cmd_data[0], cmd_data[1], payload) elif opts['del_item'] is not None: - item = gps_model.cfg_by_name(opts['del_item']) - if item: - gps_model.send_cfg_valdel(item[1]) - else: - sys.stderr.write('%s: ERROR: item %s unknown\n' % - (PROG_NAME, opts['del_item'])) - exit(1) + keys = [] + for name in opts['del_item']: + item = gps_model.cfg_by_name(name) + if item: + keys.append(item[1]) + else: + sys.stderr.write('%s: ERROR: item %s unknown\n' % + (PROG_NAME, opts['del_item'])) + exit(1) + gps_model.send_cfg_valdel(keys) elif opts['get_item'] is not None: keys = [] |