diff options
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | TODO | 23 | ||||
-rw-r--r-- | gps.h | 52 | ||||
-rwxr-xr-x | gps.py | 48 | ||||
-rw-r--r-- | gpsd.c | 36 | ||||
-rw-r--r-- | gpsd.h | 1 | ||||
-rwxr-xr-x | gpsd.hotplug | 37 | ||||
-rw-r--r-- | gpsd.xml | 31 | ||||
-rwxr-xr-x | gpsfake | 6 | ||||
-rw-r--r-- | libgps.c | 86 | ||||
-rw-r--r-- | libgpsd_core.c | 4 | ||||
-rw-r--r-- | serial.c | 4 |
12 files changed, 206 insertions, 126 deletions
diff --git a/Makefile.am b/Makefile.am index fa49ead8..89bac778 100644 --- a/Makefile.am +++ b/Makefile.am @@ -47,7 +47,7 @@ sirfmon_LDADD = $(LIBM) -lncurses libgps.la -lm # # Build shared library # -libgps_la_LDFLAGS = -version-number 10:0:0 +libgps_la_LDFLAGS = -version-number 11:0:0 lib_LTLIBRARIES = libgps.la libgps_la_SOURCES = \ @@ -83,7 +83,7 @@ man_MANS = \ gpsd.8: gpsd.xml -$(XMLTO) man gpsd.xml -xgps.1 xgpsspeed.1: gpsd.xml +xgps.1 xgpsspeed.1: xgps.xml -$(XMLTO) man xgps.xml libgps.3: libgps.xml @@ -1,12 +1,6 @@ This is the gpsd to-do list. If you're viewing it with Emacs, try doing Ctl-C Ctl-t and browsing through the outline headers. -** Finish and test the control-socket implementation - -1) gpsfake needs to set the socket location to something reasonable. -2) gpsd.hotplug needs to send remove messages -3) libgps/gps.py need to read F and K responses - ** In the SiRF driver, get leap seconds from almanac data Currently we're using a fixed 13-leap-second offset to convert GPS @@ -130,23 +124,6 @@ This area needs some attention from somebody who cares a lot about GPS accuracy and is willing to do research on error budgets to pin down the numbers and confidence levels. -** Multisession code needs to be tested. - -Each client is at any given time listening to a channel attached to a -specified device. It does not see messages from other devices. - -The F command now has the semantics "add a GPS to gpsd's -internal search list (and switch this client to use that GPS)". - -The new 'K' command lists available devices. Soon, it will remove a -GPS from the GPS list (hotplug scripts can use it to cue gpsd on a -remove event). - -Tentative answers: - -(1) The default GPS is the last one plugged in. -(2) Nothing. It should just get an offline indication. - ** Subsecond polling gpsd relies on the GPS to periodically send PVT reports to it. @@ -68,27 +68,30 @@ struct gps_fix_t { struct gps_data_t { unsigned long valid; /* validity mask */ -#define ONLINE_SET 0x000001 -#define TIME_SET 0x000002 -#define TIMERR_SET 0x000004 -#define LATLON_SET 0x000008 -#define ALTITUDE_SET 0x000010 -#define SPEED_SET 0x000020 -#define TRACK_SET 0x000040 -#define CLIMB_SET 0x000080 -#define STATUS_SET 0x000100 -#define MODE_SET 0x000200 -#define HDOP_SET 0x000400 -#define VDOP_SET 0x000800 -#define PDOP_SET 0x001000 -#define HERR_SET 0x002000 -#define VERR_SET 0x004000 -#define PERR_SET 0x008000 -#define SATELLITE_SET 0x010000 -#define SPEEDERR_SET 0x020000 -#define TRACKERR_SET 0x040000 -#define CLIMBERR_SET 0x080000 -#define ERROR_SET 0x100000 +#define ONLINE_SET 0x00000001 +#define TIME_SET 0x00000002 +#define TIMERR_SET 0x00000004 +#define LATLON_SET 0x00000008 +#define ALTITUDE_SET 0x00000010 +#define SPEED_SET 0x00000020 +#define TRACK_SET 0x00000040 +#define CLIMB_SET 0x00000080 +#define STATUS_SET 0x00000100 +#define MODE_SET 0x00000200 +#define HDOP_SET 0x00000400 +#define VDOP_SET 0x00000800 +#define PDOP_SET 0x00001000 +#define HERR_SET 0x00002000 +#define VERR_SET 0x00004000 +#define PERR_SET 0x00008000 +#define SATELLITE_SET 0x00010000 +#define SPEEDERR_SET 0x00020000 +#define TRACKERR_SET 0x00040000 +#define CLIMBERR_SET 0x00080000 +#define DEVICE_SET 0x00100000 +#define DEVICELIST_SET 0x00200000 +#define DEVICEID_SET 0x00400000 +#define ERROR_SET 0x00800000 double online; /* NZ if GPS is on line, 0 if not. * * Note: gpsd clears this flag when sentences @@ -123,11 +126,16 @@ struct gps_data_t { int ss[MAXCHANNELS]; /* signal strength */ int part, await; /* for tracking GSV parts */ - /* what type gpsd thinks the device is */ + /* where and what gpsd thinks the device is */ + char *gps_device; /* only valid if non-null. */ char *gps_id; /* only valid if non-null. */ unsigned int baudrate, stopbits; /* RS232 link paramters */ unsigned int driver_mode; /* whether driver is in native mode or not */ + /* device list */ + int ndevices; /* count of available devices */ + char **devicelist; /* list of pathnames */ + /* profiling data for last sentence */ int profiling; /* profiling enabled? */ char tag[MAXTAGLEN+1]; /* tag of last sentence processed */ @@ -135,6 +135,8 @@ class gpsdata: self.baudrate = 0 self.stopbits = 0 self.cycle = 0 + self.device = None + self.devices = [] def __repr__(self): st = "" @@ -229,11 +231,19 @@ class gps(gpsdata): self.fix.altitude = float(data) self.valid |= ALTITUDE_SET elif cmd in ('B', 'b'): - (f1, f2, f3, f4) = data.split() - self.baudrate = int(f1) - self.stopbits = int(f4) + if data == '?': + self.baudrate = self.stopbits = 0 + self.device = None + else: + (f1, f2, f3, f4) = data.split() + self.baudrate = int(f1) + self.stopbits = int(f4) elif cmd in ('C', 'c'): - self.cycle = int(data) + if data == '?': + self.cycle = -1 + self.device = None + else: + self.cycle = int(data) elif cmd in ('D', 'd'): self.utc = data self.gps_time = isotime(self.utc) @@ -242,13 +252,31 @@ class gps(gpsdata): parts = data.split() (self.epe, self.fix.eph, self.fix.epv) = map(float, parts) self.valid |= HERR_SET | VERR_SET | PERR_SET + elif cmd in ('F', 'f'): + if data == '?': + self.device = None + else: + self.device = data elif cmd in ('I', 'i'): - self.gps_id = data + if data == '?': + self.cycle = -1 + self.gps_id = None + else: + self.gps_id = data + elif cmd in ('K', 'K'): + if data == '?': + self.devices = None + else: + self.devices = data[1:].split() elif cmd in ('M', 'm'): self.fix.mode = int(data) self.valid |= MODE_SET elif cmd in ('N', 'n'): - self.driver_mode = int(data) + if data == '?': + self.driver_mode = -1 + self.device = None + else: + self.driver_mode = int(data) elif cmd in ('O', 'o'): fields = data.split() if fields[0] == '?': @@ -310,8 +338,12 @@ class gps(gpsdata): self.fix.speed = float(data) self.valid |= SPEED_SET elif cmd in ('X', 'x'): - self.online = (data[0] == '1') - self.valid |= ONLINE_SET + if data == '?': + self.online = -1 + self.device = None + else: + self.online = float(data) + self.valid |= ONLINE_SET elif cmd in ('Y', 'y'): satellites = data.split(":") self.timings.sentence_time = float(satellites.pop(0)) @@ -33,7 +33,6 @@ #include "gpsd.h" #define DEFAULT_DEVICE_NAME "/dev/gps" -#define CONTROL_SOCKET "/var/run/gpsd.sock" #define QLEN 5 @@ -289,7 +288,7 @@ static struct channel_t *find_device(char *device_name) struct channel_t *chp; for (chp = channels; chp < channels + MAXDEVICES; chp++) - if (chp->device && !strcmp(chp->device->gpsd_device, device_name)) + if (chp->device && !strcmp(chp->device->gpsdata.gps_device, device_name)) return chp; return NULL; } @@ -423,7 +422,7 @@ static int handle_request(int cfd, char *buf, int buflen) free(stash); } if (device) - snprintf(phrase, sizeof(phrase), ",F=%s", device->gpsd_device); + snprintf(phrase, sizeof(phrase), ",F=%s", device->gpsdata.gps_device); else strcpy(phrase, ".F=?"); break; @@ -434,11 +433,14 @@ static int handle_request(int cfd, char *buf, int buflen) strcpy(phrase, ".B=?"); break; case 'K': - strcpy(phrase, ",K="); + for (j = i = 0; i < MAXDEVICES; i++) + if (channels[i].device) + j++; + sprintf(phrase, ",K=%d ", j); for (i = 0; i < MAXDEVICES; i++) { device = channels[i].device; - if (device && strlen(phrase)+strlen(device->gpsd_device)+1 < sizeof(phrase)) { - strcat(phrase, device->gpsd_device); + if (device && strlen(phrase)+strlen(device->gpsdata.gps_device)+1 < sizeof(phrase)) { + strcat(phrase, device->gpsdata.gps_device); strcat(phrase, " "); } } @@ -709,21 +711,21 @@ static void handle_control(int sfd, char *buf) int main(int argc, char *argv[]) { static char *pid_file = NULL; - static int st, dsock = -1, changed, nowait = 0; + static int st, changed, dsock = -1, csock = -1, nowait = 0; static char *dgpsserver = NULL; static char *service = NULL; static char *device_name = DEFAULT_DEVICE_NAME; - static char *control_socket = CONTROL_SOCKET; + static char *control_socket = NULL; static struct channel_t *channel; struct gps_device_t *device; int dfd; struct sockaddr_in fsin; fd_set rfds, control_fds; - int option, csock, msock, cfd, go_background = 1; + int option, msock, cfd, go_background = 1; extern char *optarg; debuglevel = 0; - while ((option = getopt(argc, argv, "D:S:d:f:hNnp:P:v")) != -1) { + while ((option = getopt(argc, argv, "F:D:S:d:f:hNnp:P:v")) != -1) { switch (option) { case 'D': debuglevel = (int) strtol(optarg, 0, 0); @@ -805,10 +807,13 @@ int main(int argc, char *argv[]) exit(2); } gpsd_report(1, "listening on port %s\n", service); - unlink(control_socket); - if ((csock = filesock(control_socket)) < 0) { - gpsd_report(0,"control socket create failed, netlib error %d\n",msock); - exit(2); + if (control_socket) { + unlink(control_socket); + if ((csock = filesock(control_socket)) < 0) { + gpsd_report(0,"control socket create failed, netlib error %d\n",msock); + exit(2); + } + FD_SET(csock, &all_fds); } if (dgpsserver) { @@ -820,7 +825,6 @@ int main(int argc, char *argv[]) } FD_SET(msock, &all_fds); - FD_SET(csock, &all_fds); FD_ZERO(&control_fds); channel = open_device(device_name, nowait); @@ -882,7 +886,7 @@ int main(int argc, char *argv[]) } /* also be open to new control-socket connections */ - if (FD_ISSET(csock, &rfds)) { + if (csock > -1 && FD_ISSET(csock, &rfds)) { socklen_t alen = sizeof(fsin); int ssock = accept(csock, (struct sockaddr *) &fsin, &alen); @@ -95,7 +95,6 @@ struct gps_device_t { /* session object, encapsulates all global state */ struct gps_data_t gpsdata; struct gps_type_t *device_type; - char *gpsd_device; /* where to find the GPS */ int dsock; /* socket to DGPS server */ int sentdgps; /* have we sent a DGPS correction? */ int fixcnt; /* count of good fixes seen */ diff --git a/gpsd.hotplug b/gpsd.hotplug index 220853f3..27876875 100755 --- a/gpsd.hotplug +++ b/gpsd.hotplug @@ -1,13 +1,16 @@ #!/usr/bin/python # Hotplug script for gpsd by Eric S. Raymond, March 2005 # This script is part of the gpsd distribution: see http://gpsd.berlios.de +# Can be called like "gpsd.hotplug [+-]/dev/ttyUSB0" for test purposes. import sys, os, syslog, glob, socket +CONTROL_SOCKET = "/var/run/gpsd.sock" + def gpsd_control_connect(): "Acquire a connection to the GPSD control socket." try: sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM, 0) - sock.connect("/var/run/gpsd.sock") + sock.connect(CONTROL_SOCKET) sockfile = sock.makefile() except socket.error, msg: if sock: @@ -20,7 +23,7 @@ def gpsd_control_connect(): else: return sockfile -def wake_up_gpsd(devpath): +def wake_up_gpsd(devpath, action): subnodes = glob.glob("/sys" + devpath + "/*") subnodes = map(os.path.basename, subnodes) subnodes = filter(lambda s: s.startswith("ttyUSB"), subnodes) @@ -38,38 +41,38 @@ def wake_up_gpsd(devpath): connect = gpsd_connect() if connect: syslog.syslog("reached a running gpsd") - else: + elif action == 'add': syslog.syslog("attempting to launch gpsd") - os.system("gpsd") + os.system("gpsd -F " + CONTROL_SOCKET) connect = gpsd_control_connect() if not connect: return - # We've got a live connection to the gpsd control socket. - # No response, because gpsd will lock on to the device - # if it's really a GPS and ignore it if it's not. - connect.write("+%s\r\n" % tty) + # We've got a live connection to the gpsd control socket. No + # need to parse response, because gpsd will lock on to the + # device if it's really a GPS and ignore it if it's not. + if action == 'add': + connect.write("+%s\r\n" % tty) + elif action == 'remove': + connect.write("-%s\r\n" % tty) connect.close() return -def hotplug(): +def hotplug(action, devpath): syslog.openlog('gpsdplug', 0, syslog.LOG_DAEMON) - syslog.syslog("gpsdplug begins with action: %s" % os.getenv("ACTION")) - devpath = os.getenv("DEVPATH") + syslog.syslog("gpsdplug begins with action: %s" % action) if not devpath: - syslog.syslog("No DEVPATH") + syslog.syslog("No device") else: - # First, discover the device - #syslog.syslog("DEVPATH = %s" % devpath) - wake_up_gpsd(devpath) + wake_up_gpsd(devpath, action) syslog.syslog("gpsdplug ends") syslog.closelog() if __name__ == '__main__': if len(sys.argv) == 1: # Called as hotplug script - hotplug() + hotplug(os.getenv("ACTION"), os.getenv("DEVPATH")) else: # Called by hand for testing fp = gpsd_control_connect() - fp.write(sys.argv[1]) + fp.write(sys.argv[1]+"\n") fp.close() @@ -67,8 +67,7 @@ See <xref linkend='accuracy'/> for discussion.</para> <varlistentry> <term>-F</term> <listitem> -<para>Set the name of the control socket for device addition and -removal commands (default is <filename>&gpsdsock;</filename>).</para> +<para>Create a control socket for device addition and removal commands.</para> </listitem> </varlistentry> <varlistentry> @@ -138,7 +137,7 @@ daemon's internal search list. This search list is initialized with <filename>/dev/gps</filename> or the path given in the -f command-line option if that was specified. For security reasons, ordinary clients cannot change this search list; instead, this must be done via the -daemon's local control socket.</para> +daemon's local control socket declared with the -F option.</para> <para>The request protocol for <application>gpsd</application> clients is very simple. Each request normally consists of a single ASCII @@ -219,13 +218,14 @@ may contain spaces and is terminated by CR-LF.</para></listitem> <varlistentry> <term>k</term> -<listitem><para>Returns a line consisting of "K=" followed by a -space-separated list of all GPS devices known to -<application>gpsd</application> (that is, devices it has been pointed -at by the command-line -f argument or an F command and has -successfully recognized as GPSes). Note that the fact that a -devicename appears in this list does not guarantee that a GPS is -connected to it and active.</para> +<listitem><para>Returns a line consisting of "K=" followed by an +integer count of of all GPS devices known to +<application>gpsd</application>, followed by a space, followed by a +space-separated list of the device names. This command lists devices +the daemon has been pointed at by the command-line -f argument or an +add command via its control socket, and has successfully recognized as +GPSes). Because GPSes might be unplugged at any time, the presence of +a name in this list does not guarantee that the device is available.</para> <para>(At protocol level 1, there was no K command.)</para> </listitem> @@ -483,8 +483,9 @@ should require no configuration or user action to find devices.</para> daemon's internal search list cannot be sent over the socket from a client. Instead, they must be written to a local Unix-domain socket which will be accessible only to programs running as root. This -control socket will be located at <filename>&gpsdsock;</filename>, -where the -F option specifies.</para> +control socket will be located wherever the -F option specifies it; if +that option was not given at startup, <application>gpsd</application> +is restricted to monitoring its default device.</para> <para>To point <application>gpsd</application> at a device that may be a GPS, write to the control socket a plus sign ('+') followed by the @@ -635,12 +636,6 @@ after the second sentence has arrived.</para> <para>Default path to a GPS device.</para> </listitem> </varlistentry> -<varlistentry> -<term><filename>&gpsdsock;</filename></term> -<listitem> -<para>Default location of the control socket for device add/remove commands.</para> -</listitem> -</varlistentry> </variablelist> </refsect1> @@ -35,9 +35,11 @@ except: sys.exit(1) slave = os.ttyname(slave_fd) -spawncmd = "gpsd -N -P /tmp/gpsfake%d -f %s %s" % (os.getpid(),slave,doptions) +spawncmd = "gpsd -N -P %s -f %s %s" % (pidfile, slave, doptions) spawncmd = spawncmd.strip() +pidfile = "/tmp/gpsfake_pid-%s" % os.getpid() + if not spawn: raw_input("gpsfake: launch '%s' and press enter..." % spawncmd) elif os.system(spawncmd + " &"): @@ -46,7 +48,7 @@ elif os.system(spawncmd + " &"): else: sys.stderr.write("gpsfake: '%s' launch OK.\n" % spawncmd) - fp = open("/tmp/gpsfake%s" % os.getpid()) + fp = open(pidfile) pid = int(fp.read()) fp.close() os.remove("/tmp/gpsfake%s" % os.getpid()) @@ -39,6 +39,19 @@ int gps_close(struct gps_data_t *gpsdata) int retval = close(gpsdata->gps_fd); if (gpsdata->gps_id) free(gpsdata->gps_id); + gpsdata->gps_id = NULL; + if (gpsdata->gps_device) { + free(gpsdata->gps_device); + gpsdata->gps_device = NULL; + } + if (gpsdata->devicelist) { + int i; + for (i = 0; i < gpsdata->ndevices; i++) + free(gpsdata->devicelist[i]); + free(gpsdata->devicelist); + gpsdata->devicelist = NULL; + gpsdata->ndevices = -1; + } free(gpsdata); return retval; } @@ -52,14 +65,14 @@ static void gps_unpack(char *buf, struct gps_data_t *gpsdata) /* unpack a daemon response into a status structure */ { char *ns, *sp, *tp; + int i; gpsdata->valid = 0; for (ns = buf; ns; ns = strstr(ns+1, "GPSD")) { if (!strncmp(ns, "GPSD", 4)) { - for (sp = ns + 5; ; sp = tp+1) { - if (!(tp = strchr(sp, ','))) - tp = strchr(sp, '\r'); - if (!tp) break; + for (sp = ns + 5; ; sp = tp) { + tp = sp + strcspn(sp, ".\r\n"); + if (!*tp) break; *tp = '\0'; if (sp[2] == '?') @@ -94,14 +107,46 @@ static void gps_unpack(char *buf, struct gps_data_t *gpsdata) &gpsdata->epe,&gpsdata->fix.eph,&gpsdata->fix.epv); gpsdata->valid |= HERR_SET| VERR_SET | PERR_SET; break; + case 'F': + if (sp[2] == '?') + gpsdata->gps_device = NULL; + else { + if (gpsdata->gps_device) + free(gpsdata->gps_id); + gpsdata->gps_device = strdup(sp+2); + gpsdata->valid |= DEVICE_SET; + } + break; case 'I': if (sp[2] == '?') gpsdata->gps_id = NULL; else { if (gpsdata->gps_id) - free(gpsdata->gps_id); + free(gpsdata->gps_id); gpsdata->gps_id = strdup(sp+2); + gpsdata->valid |= DEVICEID_SET; } + break; + case 'K': + if (gpsdata->devicelist) { + for (i = 0; i < gpsdata->ndevices; i++) + free(gpsdata->devicelist[i]); + free(gpsdata->devicelist); + gpsdata->devicelist = NULL; + gpsdata->ndevices = -1; + gpsdata->valid |= DEVICELIST_SET; + } + if (sp[2] != '?') { + gpsdata->ndevices = strtol(sp+2, &sp, 10); + gpsdata->devicelist = (char **)calloc( + gpsdata->ndevices, + sizeof(char **)); + gpsdata->devicelist[i=0] = strtok_r(sp+2, " \r\n", &ns); + while ((sp = strtok_r(NULL, " \r\n", &ns))) + gpsdata->devicelist[++i] = strdup(sp); + gpsdata->valid |= DEVICELIST_SET; + } + break; case 'M': gpsdata->fix.mode = atoi(sp+2); gpsdata->valid |= MODE_SET; @@ -309,21 +354,24 @@ void data_dump(struct gps_data_t *collect, time_t now) char *status_values[] = {"NO_FIX", "FIX", "DGPS_FIX"}; char *mode_values[] = {"", "NO_FIX", "MODE_2D", "MODE_3D"}; - printf("online: %lf\n", collect->online); - printf("P: lat/lon: %lf %lf\n", collect->fix.latitude, collect->fix.longitude); - if (collect->valid | ALTITUDE_SET) + if (collect->valid & ONLINE_SET) + printf("online: %lf\n", collect->online); + if (collect->valid & LATLON_SET) + printf("P: lat/lon: %lf %lf\n", collect->fix.latitude, collect->fix.longitude); + if (collect->valid & ALTITUDE_SET) printf("A: altitude: %lf U: climb: %lf\n", collect->fix.altitude, collect->fix.climb); if (collect->fix.track != TRACK_NOT_VALID) printf("T: track: %lf V: speed: %lf\n", collect->fix.track, collect->fix.speed); - if (collect->valid | STATUS_SET) + if (collect->valid & STATUS_SET) printf("S: status: %d (%s)\n", collect->status, status_values[collect->status]); - if (collect->fix.mode | MODE_SET) + if (collect->fix.mode & MODE_SET) printf("M: mode: %d (%s)\n", collect->fix.mode, mode_values[collect->fix.mode]); - printf("Q: satellites %d, pdop=%lf, hdop=%lf, vdop=%lf\n", + if (collect->fix.mode & (HDOP_SET | VDOP_SET | PDOP_SET)) + printf("Q: satellites %d, pdop=%lf, hdop=%lf, vdop=%lf\n", collect->satellites_used, collect->pdop, collect->hdop, collect->vdop); @@ -335,6 +383,18 @@ void data_dump(struct gps_data_t *collect, time_t now) printf(" %2.2d: %2.2d %3.3d %3.3d %c\n", collect->PRN[i], collect->elevation[i], collect->azimuth[i], collect->ss[i], collect->used[i]? 'Y' : 'N'); } } + if (collect->valid & DEVICE_SET) + printf("Device is %s\n", collect->gps_device); + if (collect->valid & DEVICEID_SET) + printf("GPSD ID is %s\n", collect->gps_id); + if (collect->valid & DEVICELIST_SET) { + int i; + printf("%d devices:\n", collect->ndevices); + for (i = 0; i < collect->ndevices; i++) { + printf("%d: %s\n", collect->ndevices, collect->devicelist[i]); + } + } + } static void dumpline(struct gps_data_t *ud UNUSED, char *buf) @@ -370,8 +430,8 @@ main(int argc, char *argv[]) putchar('\n'); break; } - if (!gps_query(collect, buf)) - fputs("No changes.\n", stdout); + collect->valid = 0; + gps_query(collect, buf); data_dump(collect, time(NULL)); } } diff --git a/libgpsd_core.c b/libgpsd_core.c index e28af3f6..1e3bdd47 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -61,7 +61,7 @@ struct gps_device_t *gpsd_init(char *device) if (!session) return NULL; - session->gpsd_device = strdup(device); + session->gpsdata.gps_device = strdup(device); session->device_type = gpsd_drivers[0]; session->dsock = -1; @@ -78,7 +78,7 @@ struct gps_device_t *gpsd_init(char *device) void gpsd_deactivate(struct gps_device_t *session) /* temporarily release the GPS device */ { - gpsd_report(1, "closing GPS=%s\n", session->gpsd_device); + gpsd_report(1, "closing GPS=%s\n", session->gpsdata.gps_device); gpsd_close(session); session->gpsdata.gps_fd = -1; if (session->device_type->wrapup) @@ -84,8 +84,8 @@ int gpsd_open(struct gps_device_t *session) /* every rate we're likely to see on a GPS */ static unsigned int rates[] = {4800, 9600, 19200, 38400, 57600}; - gpsd_report(1, "opening GPS data source at '%s'\n", session->gpsd_device); - if ((session->gpsdata.gps_fd = open(session->gpsd_device, O_RDWR|O_NOCTTY)) < 0) { + gpsd_report(1, "opening GPS data source at '%s'\n", session->gpsdata.gps_device); + if ((session->gpsdata.gps_fd = open(session->gpsdata.gps_device, O_RDWR|O_NOCTTY)) < 0) { gpsd_report(1, "device open failed: %s\n", strerror(errno)); return -1; } |