Results 1 to 8 of 8

Thread: How to start gpsd with systemd on opensuse 13.2?

  1. #1
    Join Date
    Jan 2013
    Location
    USA
    Posts
    51

    Question How to start gpsd with systemd on opensuse 13.2?

    I am migrating an openSuSE 12.1 level system to 13.2. I have a Garmin 18x gps connected via serial cable to serial port that talks to ntpd via shared memory segment. Works good on 12.1.

    On opensuse 12.1 there exists an
    /etc/init.d/gpsd
    script to start/stop/restart gpsd.

    On opensuse 13.2, no such script exists because of systemd. I would have expected there to be a provided gpsd.service file, but I see none and there is none listed in the list of files provided for gpsd when viewed in Yast. The Fedora and Arch distros provide a gpsd.service file. Is this an error to omit it for opensuse? There does still exist an " /etc/sysconfig/gpsd" file on 13.2.

    A related question is, what is the replacement for the /etc/init.d/setserial script that allowed one to issue setserial commands to serial devices at boot time?

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    27,253
    Blog Entries
    15

    Default Re: How to start gpsd with systemd on opensuse 13.2?

    Quote Originally Posted by eheman View Post
    I am migrating an openSuSE 12.1 level system to 13.2. I have a Garmin 18x gps connected via serial cable to serial port that talks to ntpd via shared memory segment. Works good on 12.1.

    On opensuse 12.1 there exists an
    /etc/init.d/gpsd
    script to start/stop/restart gpsd.

    On opensuse 13.2, no such script exists because of systemd. I would have expected there to be a provided gpsd.service file, but I see none and there is none listed in the list of files provided for gpsd when viewed in Yast. The Fedora and Arch distros provide a gpsd.service file. Is this an error to omit it for opensuse? There does still exist an " /etc/sysconfig/gpsd" file on 13.2.

    A related question is, what is the replacement for the /etc/init.d/setserial script that allowed one to issue setserial commands to serial devices at boot time?
    Hi
    Not systemd, it uses udev, see the rpm description;
    Code:
    After installing this RPM, gpsd will automatically connect to USB GPSes
    when they are plugged in and requires no configuration.
    I would guess that you need to enable the udev option in the sysconfig file for it to start on a reboot if it works when you plug the device in.

    If it doesn't start on plugging in to a usb port, you would need to add your device to the rule.
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  3. #3
    Join Date
    Jan 2013
    Location
    USA
    Posts
    51

    Default Re: How to start gpsd with systemd on opensuse 13.2?

    Quote Originally Posted by malcolmlewis View Post
    Hi
    Not systemd, it uses udev, see the rpm description;
    Code:
    After installing this RPM, gpsd will automatically connect to USB GPSes
    when they are plugged in and requires no configuration.
    I would guess that you need to enable the udev option in the sysconfig file for it to start on a reboot if it works when you plug the device in.

    If it doesn't start on plugging in to a usb port, you would need to add your device to the rule.
    The device is not a USB device, and based upon the description, the sysconfig setting cannot apply. It is a true serial device (DB9 connector) connected always (not hot-plugged) to a serial (aka COM) port of the system. It would seem that udev always sets up a /dev/ttyS0 and /dev/ttyS1 device because they are always present on this motherboard.

    The device (/dev/ttyS1 in this case) already exists whether or not a serial device of any sort (modem, gps, other) is plugged into it. It doesn't make sense to me why udev has to be manipulated for this. But, that's why I am here asking for guidance.

  4. #4
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    27,253
    Blog Entries
    15

    Default Re: How to start gpsd with systemd on opensuse 13.2?

    On Tue 23 Dec 2014 02:56:01 PM CST, eheman wrote:


    malcolmlewis;2684753 Wrote:
    > Hi
    > Not systemd, it uses udev, see the rpm description;
    > >

    Code:
    --------------------
    > >

    > After installing this RPM, gpsd will automatically connect to USB

    GPSes > when they are plugged in and requires no configuration.
    >

    --------------------
    > >

    > I would guess that you need to enable the udev option in the sysconfig
    > file for it to start on a reboot if it works when you plug the device
    > in.
    >
    > If it doesn't start on plugging in to a usb port, you would need to
    > add your device to the rule.


    The device is not a USB device, and based upon the description, the
    sysconfig setting cannot apply. It is a true serial device (DB9
    connector) connected always (not hot-plugged) to a serial (aka COM) port
    of the system. It would seem that udev always sets up a /dev/ttyS0 and
    /dev/ttyS1 device because they are always present on this motherboard.

    The device (/dev/ttyS1 in this case) already exists whether or not a
    serial device of any sort (modem, gps, other) is plugged into it. It
    doesn't make sense to me why udev has to be manipulated for this. But,
    that's why I am here asking for guidance.


    Hi
    Ahh, my bad...

    Still possibly udev related, so if you manually start gpsd pointing at
    the serial port, the device works as expected?

    --
    Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
    SUSE Linux Enterprise Desktop 12 GNOME 3.10.1 Kernel 3.12.28-4-default
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!


  5. #5
    Join Date
    Jan 2013
    Location
    USA
    Posts
    51

    Default Re: How to start gpsd with systemd on opensuse 13.2?

    Quote Originally Posted by malcolmlewis View Post
    Hi
    Ahh, my bad...

    Still possibly udev related, so if you manually start gpsd pointing at
    the serial port, the device works as expected?
    Yes, gpsd starts manually ok.

    Since my last visit, I coded up this partial /usr/lib/systemd/system/gpsd.service file based upon the gpsd.service file I found on the web that is supposedly packaged with the other distributions mentioned earlier:
    Code:
    [Unit]
    Description=GPS (Global Positioning System) Daemon
    #Requires=gpsd.socket
    
    
    [Service]
    EnvironmentFile=-/etc/sysconfig/gpsd
    ExecStartPre=/usr/bin/setserial -b /dev/ttyS1 uart 16550A port 0x02f8 irq 3 baud_base 115200 spd_normal skip_test low_latency
    ExecStart=/usr/sbin/gpsd $GPSD_OPTIONS /dev/ttyS1
    
    [Install]
    WantedBy=multi-user.target
    #Also=gpsd.socket
    Then:
    Code:
    systemctl  --system daemon-reload
    systemctl  start gpsd.service
    systemctl status gpsd.service
    gpsd.service - GPS (Global Positioning System) Daemon
       Loaded: loaded (/usr/lib/systemd/system/gpsd.service; disabled)
       Active: active (running) since Tue 2014-12-23 17:18:51 EST; 6min ago
      Process: 6662 ExecStartPre=/usr/bin/setserial -b /dev/ttyS1 uart 16550A port 0x02f8 irq 3 baud_base 115200 spd_normal skip_test low_latency (code=exited, status=0/SUCCESS)
     Main PID: 6666 (gpsd)
       CGroup: /system.slice/gpsd.service
               └─6666 /usr/sbin/gpsd -N -b -n /dev/ttyS1
    The content of /etc/sysconfig/gpsd
    Code:
    ## Path:        Hardware/GPS
    ## Description: GPS Daemon
    
    ## Type:        yesno
    ## Default:     no
    #
    # Whether or not to start gpsd automatically on plugin event
    #
    GPSD_STARTBYUDEV="yes"
    
    ## Type:        integer
    ## Default:     2947
    #
    # Use different port for the daemon
    #
    GPSD_PORT=""
    
    ## Type:        string
    ## Default:     ""
    #
    # Further options to gpsd
    #
    GPSD_OPTIONS="-N -b -n"
    I further had to perform a
    Code:
    aa-complain /usr/sbin/ntpd
    So that ntpd and gpsd could share the memory segment.

    So, I am closer, but still not complete on getting ntpd and gpsd working together on 13.2.

  6. #6

    Default Re: How to start gpsd with systemd on opensuse 13.2?

    Quote Originally Posted by eheman View Post
    ExecStartPre=/usr/bin/setserial -b /dev/ttyS1 uart 16550A port 0x02f8 irq 3 baud_base 115200 spd_normal skip_test low_latency
    OOC, why do you need the setserial stuff? Won't gpsd find the correct baud rate? Or are you trying to accomplish something else?

  7. #7
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: How to start gpsd with systemd on opensuse 13.2?

    On 2015-01-14 14:36, rogeroberholtzer wrote:

    > OOC, why do you need the setserial stuff? Won't gpsd find the correct
    > baud rate? Or are you trying to accomplish something else?


    As far as I remember, serial ports do not autoconfigure; you have to
    define the speed. I'm unsure if there is more recent/sophisticated
    hardware that autoconfigures.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 13.1 x86_64 "Bottle" at Telcontar)

  8. #8

    Default Re: How to start gpsd with systemd on opensuse 13.2?

    Quote Originally Posted by robin_listas View Post
    On 2015-01-14 14:36, rogeroberholtzer wrote:

    > OOC, why do you need the setserial stuff? Won't gpsd find the correct
    > baud rate? (...)


    As far as I remember, serial ports do not autoconfigure; you have to
    define the speed. I'm unsure if there is more recent/sophisticated
    hardware that autoconfigures.
    gpsd is expressedly capable of figuring out the baud rate unless you have seriously weird hardware hooked up. For me this /usr/lib/systemd/system/gpsd.service seems to do the trick (with many thanks to your crib):

    Code:
    [Unit]
    Description=GPS (Global Positioning System) Daemon
    #Requires=gpsd.socket
    
    [Service]
    EnvironmentFile=-/etc/sysconfig/gpsd
    ExecStart=/usr/sbin/gpsd -N -S $GPSD_PORT $GPSD_OPTIONS
    
    [Install]
    WantedBy=multi-user.target
    And this is my /etc/sysconfig/gpsd:

    Code:
    ## Path:        Hardware/GPS
    ## Description: GPS Daemon
    
    ## Type:        yesno
    ## Default:     no
    #
    # Whether or not to start gpsd automatically on plugin event
    #
    GPSD_STARTBYUDEV="no"
    
    ## Type:        integer
    ## Default:     2947
    #
    # Use different port for the daemon
    #
    GPSD_PORT="2947"
    
    ## Type:        string
    ## Default:     ""
    #
    # Further options to gpsd
    #
    GPSD_OPTIONS="/dev/ttyS0 /dev/ttyS1"
    I hard-coded the -N option, since this is required by systemd if used this way and not really a user option.

    By the way my next stop is to hook this up to ntpd. From the sounds of it you may already have some experience to pass on... ;-)

    Catperson

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •