[gpsd-dev] New 0.5 draft of the SemPiTernal HOWTO

Mike bellyacres at gmail.com
Wed May 11 00:34:35 UTC 2016


On 05/10/2016 03:09 PM, Gary E. Miller wrote:
> Yo Mike!
>
> On Tue, 10 May 2016 14:40:56 -0400
> Mike <bellyacres at gmail.com> wrote:
>
>> Currently I'm running gpsd from my home directory as I've been
>> experimenting with some build options as a learning adventure.
>>
>> cat /usr/lib/systemd/system/gpsd.service
> Cool.  If you can figure it out, and document it, send it to gpsd-dev
> and we'll get it added to the main gpsd tarball.
>
> Then the systemd distros have something to start with.
I will preface this with I am not using a hat.  My Rpi is a model B.  
The gps module is attached to tx, rtx, and gpio18.

mike at ticker:~/gpsd $ ./gpsd -V
./gpsd: 3.17~dev (revision release-3.16-313-g7f02d3e)
mike at ticker:~/gpsd $ ./gpsd -l
NMEA0183
PPS
# n: mode switch, b: speed switch, c: rate switch, *: non-NMEA packet type.
# Time service features enabled.
# PPS enabled.
mike at ticker:~/gpsd $

The above was built as follows.
scons timeservice=yes nmea0183=yes fixed_port_speed=9600 fixed_stop_bits=1

The systemd.service file(s) I based mine on are already in the gpsd git.

Actually, with the timeservice build the default port isn't used, no 
need to include gpsd.socket in systemd.

mike at ticker:~/ $ cat /lib/systemd/system/gpsd.service
[Unit]
Description=GPS (Global Positioning System) Daemon

[Service]
EnvironmentFile=-/etc/default/gpsd
ExecStart=/home/mike/gpsd/gpsd -N $DEVICES
Restart=on-failure

[Install]
WantedBy=multi-user.target

mike at ticker:~/ $ cat /etc/default/gpsd
# Default settings for the gpsd init script and the hotplug wrapper.

# Start the gpsd daemon automatically at boot time
START_DAEMON="true"

# Use USB hotplugging to add new USB devices automatically to the daemon
USBAUTO="false"

# Devices gpsd should collect to at boot time.
# They need to be read/writeable, either by user gpsd or the group dialout.
DEVICES="/dev/ttyAMA0 /dev/pps0"

# Other options you want to pass to gpsd
GPSD_OPTIONS=""

Those are the only two files required to run with systemd. 
/etc/default/gpsd can probably be removed if one is using a hat. That 
would also then remove a line from the gpsd.service file.

Copy the above gpsd.service file to /lib/systemd/system/

Adjust /etc/default/gpsd if needed.

#systemctl daemon-reload --  Make systemd aware that we've added a new 
service.

Only a couple of other notes.

Obviously /home/mike/gpsd/ is the wrong path for a normal install.

#systemctl enable gpsd.service -- This will tell systemd to run on bootup.

#systemctl [start|stop] gpsd.service  -- The usage is obvious or implied...

systemctl status gpsd.service  -- Give us a bit of info, enabled, 
running, etc. etc.

Mike



More information about the devel mailing list