summaryrefslogtreecommitdiff
path: root/drivers.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2016-08-15 16:53:40 -0700
committerGary E. Miller <gem@rellim.com>2016-08-15 16:53:40 -0700
commite67e4118a0cbb5b5cecc62e7440299d0b5b35a37 (patch)
tree9aa35686f7b499ae7afd75e6b8b1f25a2aedfb32 /drivers.c
parent1721d7c431aeb471dcd3e36b09c4a432eb31dc5e (diff)
downloadgpsd-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.c15
1 files changed, 13 insertions, 2 deletions
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");
}
}