diff options
Diffstat (limited to 'drivers.c')
-rw-r--r-- | drivers.c | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -287,10 +287,15 @@ const struct gps_type_t driver_nmea0183 = { static void garmin_mode_switch(struct gps_device_t *session, int mode) /* only does anything in one direction, going to Garmin binary driver */ { + struct timespec delay; + if (mode == MODE_BINARY) { (void)nmea_send(session, "$PGRMC1,1,2,1,,,,2,W,N"); (void)nmea_send(session, "$PGRMI,,,,,,,R"); - (void)usleep(333); /* standard Garmin settling time */ + /* wait 333 uSec, standard Garmin settling time */ + delay.tv_sec = 0; + delay.tv_nsec = 333000L; + nanosleep(&delay, NULL); } } #endif /* RECONFIGURE_ENABLE */ @@ -603,11 +608,17 @@ static const struct gps_type_t driver_tripmate = { static void earthmate_event_hook(struct gps_device_t *session, event_t event) { + struct timespec delay; + if (session->context->readonly) return; if (event == event_triggermatch) { (void)gpsd_write(session, "EARTHA\r\n", 8); - (void)usleep(10000); + /* wait 10,000 uSec */ + delay.tv_sec = 0; + delay.tv_nsec = 10000000L; + nanosleep(&delay, NULL); + (void)gpsd_switch_driver(session, "Zodiac"); } } |