diff options
author | Gary E. Miller <gem@rellim.com> | 2016-08-15 16:53:40 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2016-08-15 16:53:40 -0700 |
commit | e67e4118a0cbb5b5cecc62e7440299d0b5b35a37 (patch) | |
tree | 9aa35686f7b499ae7afd75e6b8b1f25a2aedfb32 /drivers.c | |
parent | 1721d7c431aeb471dcd3e36b09c4a432eb31dc5e (diff) | |
download | gpsd-e67e4118a0cbb5b5cecc62e7440299d0b5b35a37.tar.gz |
usleep() is removed from POSIX-2008. Replace with nanosleep()
I sure hope I did not drop a zero anywhere...
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"); } } |