From e67e4118a0cbb5b5cecc62e7440299d0b5b35a37 Mon Sep 17 00:00:00 2001 From: "Gary E. Miller" Date: Mon, 15 Aug 2016 16:53:40 -0700 Subject: usleep() is removed from POSIX-2008. Replace with nanosleep() I sure hope I did not drop a zero anywhere... --- drivers.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'drivers.c') diff --git a/drivers.c b/drivers.c index 85b12a9a..ad480fa3 100644 --- a/drivers.c +++ b/drivers.c @@ -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"); } } -- cgit v1.2.1