summaryrefslogtreecommitdiff
path: root/gpsd.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-09-28 22:48:27 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-09-28 22:48:27 +0000
commit70c15cbab26ede25a46330f2860a046b2da3ddb2 (patch)
treef85d38563303592fb4b9020f2be0e05eb5b837cf /gpsd.c
parentfb8af4b7035f524d724bf729a8c9645f430f45fa (diff)
downloadgpsd-70c15cbab26ede25a46330f2860a046b2da3ddb2.tar.gz
Make sure we get a DEVICE message on assignment.
All regression tests pass. Code spplints clean.
Diffstat (limited to 'gpsd.c')
-rw-r--r--gpsd.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gpsd.c b/gpsd.c
index 6a1c6141..112e322e 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -819,23 +819,28 @@ static /*@null@*/struct channel_t *assign_channel(struct subscriber_t *user,
/*@ +sefparams @*/
}
#endif /* OLDSTYLE_ENABLE */
+ if (newstyle(user) && user->policy.watcher) {
+ char buf[GPS_JSON_RESPONSE_MAX];
+ json_device_dump(channel->device, buf, sizeof(buf));
+ (void)throttled_write(user, buf, strlen(buf));
+ }
}
}
+#ifdef OLDSTYLE_ENABLE
if (was_unassigned) {
char buf[NMEA_MAX];
buf[0] = '\0';
-#ifdef OLDSTYLE_ENABLE
if (!newstyle(user) && user->policy.watcher)
(void)snprintf(buf, sizeof(buf), "GPSD,X=%f,I=%s\r\n",
timestamp(), gpsd_id(channel->device));
-#endif /* OLDSTYLE_ENABLE */
/*@ -sefparams +matchanyintegral @*/
if (buf[0]!='\0')
(void)throttled_write(user, buf, strlen(buf));
/*@ +sefparams -matchanyintegral @*/
}
+#endif /* OLDSTYLE_ENABLE */
channel->subscriber = user;
return channel;