summaryrefslogtreecommitdiff
path: root/drivers.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-01-28 23:11:38 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-01-28 23:11:38 +0000
commit78f207526bc4de468af299aa5169634c2f621a1d (patch)
tree31882de94d20ea4c723a5ce27290944ec6fe16c6 /drivers.c
parenta1722dd7d397a5aa74b0ccf2d959c4c2b54f3f83 (diff)
downloadgpsd-78f207526bc4de468af299aa5169634c2f621a1d.tar.gz
Make mode-switching to garmin binary work.
Diffstat (limited to 'drivers.c')
-rw-r--r--drivers.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers.c b/drivers.c
index 03025799..ab6dcbb7 100644
--- a/drivers.c
+++ b/drivers.c
@@ -266,6 +266,17 @@ static struct gps_type_t nmea = {
*
**************************************************************************/
+static void garmin_mode_switch(struct gps_device_t *session, int mode)
+/* only does anything iin one direction, going to Garmin binary driver */
+{
+ if (mode == MODE_NMEA) {
+ (void)nmea_send(session, "$PGRMC1,1,2,1,,,,2,W,N");
+ (void)nmea_send(session, "$PGRMI,,,,,,,R");
+ (void)usleep(333); /* standard Garmin settling time */
+ session->gpsdata.driver_mode = MODE_NMEA;
+ }
+}
+
#ifdef ALLOW_RECONFIGURE
static void garmin_nmea_configurator(struct gps_device_t *session, unsigned int seq)
{
@@ -327,7 +338,7 @@ static struct gps_type_t garmin = {
.parse_packet = nmea_parse_input, /* how to interpret a packet */
.rtcm_writer = NULL, /* some do, some don't, skip for now */
.speed_switcher = NULL, /* no speed switcher */
- .mode_switcher = NULL, /* no mode switcher */
+ .mode_switcher = garmin_mode_switch, /* mode switcher */
.rate_switcher = NULL, /* no sample-rate switcher */
.cycle_chars = -1, /* not relevant, no rate switch */
#ifdef ALLOW_RECONFIGURE