summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL22
-rw-r--r--gpsd.c30
-rwxr-xr-xgpsd.hotplug5
-rw-r--r--gpsd.spec.in8
-rw-r--r--gpsd.xml21
5 files changed, 37 insertions, 49 deletions
diff --git a/INSTALL b/INSTALL
index d956952f..4297c58c 100644
--- a/INSTALL
+++ b/INSTALL
@@ -12,15 +12,7 @@ a short initial burst of binary garbage). If you don't see this, you
may have OS-level problems with your serial support, but more likely
have the wrong device. Look again.
-2. If your system supports Linux hotplug and you're using a USB GPS,
-go to step 4. Otherwise, make a symlink named /dev/gps to your GPS
-port; the command will be
-
- ln -s /dev/ttyXXX /dev/gps
-
-where ttyXXX is as in step 1.
-
-3. Ensure that device permissions will enable gpsd to read GPS devices
+2. Ensure that device permissions will enable gpsd to read GPS devices
even after it drops root privileges. If you are running Fedora you
can skip this step, as the stock configuration has the right properties.
@@ -35,7 +27,7 @@ the permission-setting part; the hotplug scripts will force the
permissions for you. You still have to make sure all the tty devices
are in the same group.
-4. Build gpsd from source (skip this step if you have installed a gpsd
+3. Build gpsd from source (skip this step if you have installed a gpsd
binary package).
You will need to have either Motif or LessTif installed in order for
@@ -52,13 +44,13 @@ Then run make: libgps.so, gpsd, xgps, and xgpsspeed will be
built. Copy the app-defaults files xgps.ad and xgpsspeed.ad to your
home directory or to the system-wide X app-defaults directory.
-5. Start gpsd. It should not need any options.
+4. Start gpsd. It should not need any options.
-6. Once gpsd is running, telnet to port 2947. Type 'f' to see what
+5. Once gpsd is running, telnet to port 2947. Type 'f' to see what
device it will query. If you need to change the device, use 'f='
to do so (see the manual page for details). Now plug in your GPS.
-7. Type "wr" to start raw and watcher modes. You should see NMEA data
+6. Type "wr" to start raw and watcher modes. You should see NMEA data
(text lines beginning with $) spewing out. You will also see lines
with a GPSD prefix; these are sentence translations in GPSD protocol.
@@ -72,12 +64,12 @@ sending data, merely that gpsd has not yet seen any *valid* position data.
You will have to wait for the GPS to acquire satellite lock. If you have
raw or watcher mode on, it should be obvious when you get a lock.
-8. Start the xgps client. Calling it with no arguments should do the right
+7. Start the xgps client. Calling it with no arguments should do the right
thing. You should see a GUI panel with position/velocity-time information,
and a satellite display. The displays won't look very interesting until
the GPS acquires satellite lock.
-9. Check out the list of supported hardware at
+8. Check out the list of supported hardware at
http://gpsd.berlios.de/hardware.html
diff --git a/gpsd.c b/gpsd.c
index 81fb3e3e..16fba47a 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -36,8 +36,6 @@
#include "gpsd.h"
-#define DEFAULT_DEVICE_NAME "/dev/gps"
-
#define QLEN 5
/*
@@ -119,13 +117,13 @@ static void usage(void)
{
printf("usage: gpsd [options] \n\
Options include: \n\
- -f string (default %s) = set GPS device name \n\
+ -f string = set GPS device name \n\
-S integer (default %s) = set port for daemon \n\
-d host[:port] = set DGPS server \n\
-P pidfile = set file to record process ID \n\
-D integer (default 0) = set debug level \n\
-h = help message \n",
- DEFAULT_DEVICE_NAME, DEFAULT_GPSD_PORT);
+ DEFAULT_GPSD_PORT);
}
static int have_fix(struct gps_device_t *device)
@@ -792,9 +790,9 @@ int main(int argc, char *argv[])
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 *device_name = NULL;
static char *control_socket = NULL;
- struct gps_device_t *device, **channel;
+ static struct gps_device_t *device, **channel;
struct sockaddr_in fsin;
fd_set rfds, control_fds;
int option, msock, cfd, dfd, go_background = 1;
@@ -891,7 +889,7 @@ int main(int argc, char *argv[])
#endif /* defined(SHM_H) && defined(IPC_H) */
/* make default device accessible even after we drop privileges */
- if (stat(device_name, &stb) == 0)
+ if (device_name && stat(device_name, &stb) == 0)
chmod(device_name, stb.st_mode|S_IRGRP|S_IWGRP);
/*
@@ -901,7 +899,7 @@ int main(int argc, char *argv[])
* compromises in the code. It requires that all GPS devices have
* their group read/write permissions set.
*/
- if (stat(device_name, &stb) == 0 || stat(PROTO_TTY, &stb) == 0) {
+ if ((device_name && stat(device_name, &stb)==0) || stat(PROTO_TTY, &stb)==0) {
gpsd_report(2, "changing to group %d\n", stb.st_gid);
if (setgid(stb.st_gid))
gpsd_report(0, "setgid() failed, errno %s\n", strerror(errno));
@@ -942,19 +940,21 @@ int main(int argc, char *argv[])
if (time(NULL) < START_SUBFRAME)
context.valid |= LEAP_SECOND_VALID;
- device = open_device(device_name, nowait);
- if (!device) {
- gpsd_report(0, "exiting - GPS device nonexistent or can't be read\n");
- exit(2);
+ if (device_name) {
+ device = open_device(device_name, nowait);
+ if (!device) {
+ gpsd_report(0, "exiting - GPS device nonexistent or can't be read\n");
+ exit(2);
+ }
+ if (dsock >= 0)
+ device->dsock = dsock;
}
- if (dsock >= 0)
- device->dsock = dsock;
for (;;) {
struct timeval tv;
memcpy((char *)&rfds, (char *)&all_fds, sizeof(rfds));
- if (device->dsock > -1)
+ if (device && device->dsock > -1)
FD_CLR(device->dsock, &rfds);
/*
diff --git a/gpsd.hotplug b/gpsd.hotplug
index 2fabcfa5..60b866e8 100755
--- a/gpsd.hotplug
+++ b/gpsd.hotplug
@@ -34,8 +34,9 @@ def gpsd_control(action, argument):
if connect:
syslog.syslog("reached a running gpsd")
elif action == 'add':
- syslog.syslog("attempting to launch gpsd")
- os.system("gpsd -F " + CONTROL_SOCKET)
+ gpsdcmd = "gpsd -D 4 -F " + CONTROL_SOCKET
+ syslog.syslog("launching %s" % gpsdcmd)
+ os.system(gpsdcmd)
connect = gpsd_control_connect()
if not connect:
syslog.syslog("can't reach gpsd")
diff --git a/gpsd.spec.in b/gpsd.spec.in
index c1f70f5f..bbced302 100644
--- a/gpsd.spec.in
+++ b/gpsd.spec.in
@@ -123,11 +123,13 @@ cp gps.py "$RPM_BUILD_ROOT"%{_libdir}/python${PYVERSION}/site-packages
%changelog
* Tue Apr 26 2005 Eric S. Raymond <esr@snark.thyrsus.com> - @VERSION@-1
-- gpsd-clients is now a separate RPM; this is helpful on lean systems
+- For better security, the daemon now drops root privileges after startup.
+ gpsd-clients is now a separate RPM; this is helpful on lean systems
that don't run X. The O command now reports speeds in meters per second
rather than knots, client code has been adjusted so there is no user-visible
- change. The daemon now drops root privileges after startup. We now
- compute the missing components of DOP when using SiRF chips.
+ change. We now compute the missing components of DOP when using SiRF chips.
+ /dev/gps is no longer special; there is no default GPS device unless you
+ specify one.
* Mon Apr 25 2005 Eric S. Raymond <esr@snark.thyrsus.com> - 2.22-1
- SiRF-binary driver can now get leap-second corrections from subframe data.
diff --git a/gpsd.xml b/gpsd.xml
index f2942052..e3cfbddd 100644
--- a/gpsd.xml
+++ b/gpsd.xml
@@ -61,7 +61,7 @@ See <xref linkend='accuracy'/> for discussion.</para>
<varlistentry>
<term>-f</term>
<listitem>
-<para>Set a GPS device name (default is <filename>/dev/gps</filename>).</para>
+<para>Set a GPS device name.</para>
</listitem>
</varlistentry>
<varlistentry>
@@ -199,8 +199,8 @@ the trial device becomes the active device for this client.</para>
<para>The 'F=' command may fail if the specified device name is not on the
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
+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 declared with the -F option.</para>
@@ -632,8 +632,8 @@ make and type of receiver.</para>
to open the NTPD shared-memory segment, open its logfile, and create
its local control socket. Before doing any processing of GPS data, it
tries to drop root privileges by setting its UID to "nobody" and its
-group ID to the group of <filename>/dev/gps</filename> &mdash; or, if
-that device doesn't exist, to the group of
+group ID to the group of the initial GPS passed on the command line
+&mdash; or, if that device doesn't exist, to the group of
<filename>/dev/ttyS0</filename>.</para>
<para>Privilege-dropping is a hedge against the possibility that
@@ -680,19 +680,12 @@ parameters <application>gpsd</application> cannot see.</para>
<variablelist>
<varlistentry>
-<term><filename>/dev/gps</filename></term>
-<listitem>
-<para>Default path to a GPS device. After startup
-<application>gpsd</application> sets its group ID to the owner of this
-device if it exists.</para>
-</listitem>
-</varlistentry>
-<varlistentry>
<term><filename>/dev/ttyS0</filename></term>
<listitem>
<para>Prototype TTY device. After startup,
<application>gpsd</application> sets its group ID to the owner of this
-device if <filename>/dev/gps</filename> does not exist.</para>
+device if no GPS device was specified on the command line does not
+exist.</para>
</listitem>
</varlistentry>
</variablelist>