gpsd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: open SHM data only after cgps start


From: Hans Kurscheidt
Subject: Re: open SHM data only after cgps start
Date: Fri, 5 Feb 2021 20:12:39 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0

Hhm,

not so clear:

Always fresh boot:

w/  "-n"  in /etc/default/gpsd

Welcome to Debian Stretch with Armbian Linux 4.19.62-sunxi
System load:   0.69 0.22 0.08   Up time:       0 min
Memory usage:  16 % of 492MB    IP:            192.168.1.22 192.168.100.1
CPU temp:      53°C
Usage of /:    19% of 29G

[ 0 security updates available, 2 updates total: apt upgrade ]
Last check: 2021-02-05 20:04

[ General system configuration (beta): armbian-config ]

Last login: Fri Feb  5 19:35:38 2021 from 192.168.1.31

hk@orangepizero:~$ systemctl status gpsd
● gpsd.service - GPS (Global Positioning System) Daemon
   Loaded: loaded (/etc/systemd/system/gpsd.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2021-02-05 20:04:03 CET; 53s ago
 Main PID: 718 (gpsd)
    Tasks: 2 (limit: 4915)
   CGroup: /system.slice/gpsd.service
           └─718 /usr/sbin/gpsd -N -n /dev/ttyACM0

Feb 05 20:04:03 orangepizero systemd[1]: Started GPS (Global Positioning System) Daemon.
hk@orangepizero:~$ ps -ef | grep gpsd
nobody     718     1  0 20:04 ?        00:00:00 /usr/sbin/gpsd -N -n /dev/ttyACM0
hk        1673  1619  0 20:05 pts/0    00:00:00 grep gpsd

----------------------------

w/out "-n"  in /etc/default/gpsd

Welcome to Debian Stretch with Armbian Linux 4.19.62-sunxi
System load:   0.90 0.34 0.12   Up time:       1 min
Memory usage:  16 % of 492MB    IP:            192.168.1.22 192.168.100.1
CPU temp:      50°C
Usage of /:    19% of 29G

[ 0 security updates available, 2 updates total: apt upgrade ]
Last check: 2021-02-05 20:07

[ General system configuration (beta): armbian-config ]

Last login: Fri Feb  5 20:04:43 2021 from 192.168.1.31

hk@orangepizero:~$ systemctl status gpsd
● gpsd.service - GPS (Global Positioning System) Daemon
   Loaded: loaded (/etc/systemd/system/gpsd.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2021-02-05 20:07:32 CET; 1min 2s ago
 Main PID: 702 (gpsd)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/gpsd.service
           └─702 /usr/sbin/gpsd -N /dev/ttyACM0

Feb 05 20:07:32 orangepizero systemd[1]: Started GPS (Global Positioning System) Daemon.
hk@orangepizero:~$ ps -ef | grep gpsd
nobody     702     1  0 20:07 ?        00:00:00 /usr/sbin/gpsd -N /dev/ttyACM0
hk        1655  1621  0 20:08 pts/0    00:00:00 grep gpsd

??

RGDS

hk


Am 05.02.2021 um 20:02 schrieb Frank Nicholas:
After a fresh boot, when you’re `systemctl status gpsd` shows running, do a `ps -ax | grep gps`.  Do you find GPSd?

Thanks,
Frank

On Feb 5, 2021, at 1:59 PM, Hans Kurscheidt <lve0200@gmail.com> wrote:

Sorry, not sure, but when I issue systemctl status gpsd after boot, no client pending, it still says running. so the service is running. You probably said it yourself, the SHM is not recognised as Client and the deamon may have decided not yet to start/open the device.

RGDS

hk


Am 05.02.2021 um 19:57 schrieb Frank Nicholas:
I generally “Reply to all”.

SystemD service files generally look for NETWORK connections, not SHM use.  I don’t know if there’s a way for SystemD to monitor SHM…

I’m not an expert on SystemD service files, but I suspect START_DAMEON means, make it available when/if there’s an attempt to connect to it, not run it immediately at boot.  Maybe that’s a different option/setting.

Thanks,
Frank

On Feb 5, 2021, at 1:52 PM, Hans Kurscheidt <lve0200@gmail.com> wrote:

Hi Frank

BINGO, you got it!

unfortunately just your mail ended up in SPAM, don't know why, all the others don't!

1. Dirty system with multiple installations of various versions of GPSd
YES, I cleaned this up.

all your messages are coming individually - not recognized as part of a discussion/thread.

Sorry, I'm new here, don't know any better; there's no "answer" button except for unwanted replies to individuals.

The solution is to add -n into the systemd UNIT file as a GPSD_OPTION

cat /etc/default/gpsd
# Start the gpsd daemon automatically at boot time
START_DAEMON="true"

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

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

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


I did not expect/understand this! I was assuming, if the service is started at boot time, it would also start the GPS com. I have still questions: Why is my app not recognized as client, when opening
if ((gps_open(GPSD_SHARED_MEMORY, NULL, &gps_data)) == -1)
OK, it works,
thanks a lot, from good old Europe
Best Regards
hk

Am 05.02.2021 um 16:40 schrieb Frank Nicholas:
I think you have two issues:
1. Dirty system with multiple installations of various versions of GPSd
2. You are using SystemD, which with the most common service file, only launched GPSd when an app/client attempts to attach.  As long as GPSd is launched, and there is an attached client/consumer, it will continue to run, until there is nothing else using it and the last client closes the connection.

Gary Miller suggested adding the switch to make GPSd run as a daemon all the time (doesn’t exit when there are no clients attached).  This would also require something to change with the SystemD config file - you want SystemD to start GPSd at boot, not wait until there’s a client attempting to access it.  I think Gary even provided a one line command line that could be put in a startup script, anywhere you wanted, depending on the flavor of Linux you are using (this would not use SystemD).

For some reason all your messages are coming individually - not recognized as part of a discussion/thread.  Not sure if you can do something about that, but it makes it difficult to follow - that’s why I couldn’t easily find Gary’s suggestions.

Thanks,
Frank

On Feb 5, 2021, at 8:59 AM, Hans Kurscheidt <lve0200@gmail.com> wrote:

Sorry, if I keep talking to myself here, but I'm crawling forward.

After I got gpsd running as service, I cleaned out all old references to libgps and libgps-dev and cleaned Visual Studio's cache.

Should be OK now.

There's no dpkg -l libgps* output anymore

VisualStudio finds the richgt gps.h under ../gpsd-master/..; there is no other gps.h somewhere.

and the linker points to so.28

ldconfig -p | grep gps
        libgpsdpacket.so.28 (libc6,hard-float) => /usr/local/lib/libgpsdpacket.so.28
        libgpsdpacket.so (libc6,hard-float) => /usr/local/lib/libgpsdpacket.so
        libgps.so.28 (libc6,hard-float) => /usr/local/lib/libgps.so.28
        libgps.so (libc6,hard-float) => /usr/local/lib/libgps.so
        libQgpsmm.so.28 (libc6,hard-float) => /usr/local/lib/libQgpsmm.so.28
        libQgpsmm.so (libc6,hard-float) => /usr/local/lib/libQgpsmm.so

The compilation/linking is OK w/out errors or warnings and the executable is runable

BUT, I still have the old problem. (assume gpsd service running and fix available)

If I run my app after boot, No gps data is available and just once I got an error message, which I cannot reproduce, saying something like:

shared library error cannot ... data: No such file or directory

After running cgps once, data is available and remains 2b supplied to my app, even if I close cgps. This is reproduceable.

RGDS

hk






reply via email to

[Prev in Thread] Current Thread [Next in Thread]