diff options
author | Fred Wright <fw@fwright.net> | 2019-04-02 14:44:19 -0700 |
---|---|---|
committer | Fred Wright <fw@fwright.net> | 2019-04-02 14:50:58 -0700 |
commit | 9c77d6533750236119d94185987c6b2029fb96a2 (patch) | |
tree | ae4a272f2fd3eccf60ab920f034e48cba2ab70f4 | |
parent | 8797a6ffaff8d224d443882dc0aeb08aecc326ff (diff) | |
download | gpsd-9c77d6533750236119d94185987c6b2029fb96a2.tar.gz |
ubxtool: Allow UART selection for speed setting.
This allows the -i option to specify the port for the -S option. It
currently defaults to port 1, the first or only UART port. It would
be better (as noted in the FIXME) to default to the current port, but
that would require implementing a mechanism to determine that.
TESTED:
On a NEO-M8T, tested various -i values (including none). Proper
behavior was observed, though for some reason this receiver accepts
CFG-PRT for the nonexistent port 2, though it rejects polling port 2.
-rwxr-xr-x | ubxtool | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -2101,15 +2101,17 @@ class ubx(object): def send_set_speed(self, speed): "UBX-CFG-PRT, set port" - - # Note that this is only applicable to the UART port (1), - # so there's no need to pay attention to 'interface'. - # If there's any possibility for a receiver to have multiple - # UART ports, it's not mentioned in the doc. + port = opts['interface'] + # FIXME! Determine and use current port as default + if port is None: + port = 1 # Default to port 1 (UART/UART_1) + if port not in set([1, 2]): + sys.stderr.write('%s: Invalid UART port - %d\n' % (PROG_NAME, port)) + sys.exit(2) # FIXME! Poll current masks, then adjust speed m_data = bytearray(20) - m_data[0] = 1 # port 1, UART + m_data[0] = port m_data[4] = 0xc0 # 8N1 m_data[5] = 0x8 # 8N1 |