summaryrefslogtreecommitdiff
path: root/gpsd.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2010-03-24 18:36:22 -0400
committerEric S. Raymond <esr@thyrsus.com>2010-03-24 18:36:22 -0400
commit85453a3967a4c2d2337bb5ecc8f84a341f61dca5 (patch)
tree2937d9487f3d1d701b8c8676550486c7d42ddcd3 /gpsd.c
parente4c54e75b8c915797234e1eae01a0ba4d5785b78 (diff)
downloadgpsd-85453a3967a4c2d2337bb5ecc8f84a341f61dca5.tar.gz
Finally get the device open where we want it, in the awaken() function.
All regression tests pass.
Diffstat (limited to 'gpsd.c')
-rw-r--r--gpsd.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/gpsd.c b/gpsd.c
index 065a5346..8c577bd2 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -710,7 +710,15 @@ static bool add_device(char *device_name)
static bool awaken(struct subscriber_t *user, struct gps_device_t *device)
/* awaken a device and notify all watchers*/
{
- /* and open that device */
+ /* open that device */
+ if (!initialized_device(device)) {
+ if (!open_device(device->gpsdata.dev.path)) {
+ gpsd_report(LOG_PROG, "allocation_filter: open failed\n");
+ free_device(device);
+ return false;
+ }
+ }
+
if (device->gpsdata.gps_fd != -1) {
gpsd_report(LOG_PROG,"client(%d): device %d (fd=%d, path %s) already active.\n",
sub_index(user),
@@ -816,14 +824,6 @@ static /*@null@*/struct channel_t *assign_channel(struct subscriber_t *user,
}
}
- if (!initialized_device(channel->device)) {
- if (!open_device(channel->device->gpsdata.dev.path)) {
- gpsd_report(LOG_PROG, "allocation_filter: open failed\n");
- free_device(channel->device);
- return false;
- }
- }
-
if (channel->device == NULL) {
return NULL;
}