diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2009-01-21 06:06:14 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2009-01-21 06:06:14 +0000 |
commit | 3321ac6ff78202fce7bf5bb88e796f1d8de856f4 (patch) | |
tree | 182d3a7cc8de39633a0e9758a0716ddc5bdc810e /gpsctl.c | |
parent | 55d6ba312ce16ae1b926769dc70cc2a7ece3e85f (diff) | |
download | gpsd-3321ac6ff78202fce7bf5bb88e796f1d8de856f4.tar.gz |
Teach gpsctl to ship control strings to a UBX device, and eliminate ubxsend.
Diffstat (limited to 'gpsctl.c')
-rw-r--r-- | gpsctl.c | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -444,7 +444,25 @@ int main(int argc, char **argv) } /*@ -compdef @*/ if (control) { - if (session.device_type->control_send == NULL) { + /* + * First, handle exceptional cases. These are GPS chips + * like the Zodiac and UBX in which the packet payload is + * not contiguous,with class or type fields before the data + * length. This means they don't fit well in the model + * assumed by the driver interface. + */ + extern struct gps_type_t ubx_binary; + if (session.device_type == &ubx_binary) { + if (!ubx_write(session.gpsdata.gps_fd, + (unsigned)cooked[0], (unsigned)cooked[1], + (unsigned char *)cooked + 2, + cookend - cooked - 2)) { + (void)fprintf(stderr, "gpsctl: control transmission failed.\n"); + status = 1; + } + + } + else if (session.device_type->control_send == NULL) { (void)fprintf(stderr, "gpsctl: %s devices have no control sender.\n", session.device_type->type_name); |