|
From: | Hans Kurscheidt |
Subject: | Re: open SHM data only after cgps start |
Date: | Sat, 6 Feb 2021 11:42:42 +0100 |
User-agent: | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 |
Bonjour Gary,
>
What does not look correct to you?
<
As you can see, the unliked systemd starts gpsd w/ or w/out "-n" at boot. 4me therefore, systemd is not the culprit, but obviously I luck deeper understanding of the gpsd internals. However I would guess that gpsd, once started from systemd would wait for an "open" from some application wanting GPS data, in case that there's no "-n" switch given, regardless if it was started by systemd or from command level. I do not believe that something has still to go via systemd. Systemd has done its job and started gpsd and is out of the picture. In case of "-n" given, gpsd shoots GPS data into the blue, SHM is filled if there's an APP to read it or not. In this case, my APP receives data. If there's no "-n", gpsd appears 2b waiting for an incoming data request. It looks to me that there's something wrong, when it comes to SHM. Tracing in my APP the open statement
if ((gps_open(GPSD_SHARED_MEMORY, NULL, &gps_data)) == -1) {
is always returning 0 (OK), but gpsd does not provide data. So my wild ass guess is that "open" opens the SHM, but gpsd behind is not informed that there's is now somebody waiting for data, and this is IMHO independent from systemd. Only if I start cgps, gpsd gets apparently woken up and data is supplied to everybody wanting, as long as cgps runs. When cgps is closed, my app reads the rest from the /dev/ttyACM0 buffer and then no data is anymore available and the fd to /dev/ttyACM0 is closed.
So where I was caught:
There is for what I can manage very difficult to find and sparse documentation, in most cases confused across different versions. You said "don't make assumptions" but the level of documentation forces it.
I assumed
I also asked for a reference manual to better understand
the functions called like open, read ..., what they do,
constraints e.g. when using SHM must use "-n", don't use systemd,
etc., but I found myself scrawling the internet at stackoverflow
etc.
To cut a long story short, the "-n" switch must always be given, or otherwise there are cases where the "open" from app level does not make the gpsd deamon provide GPS data.
Thanks for your help anyway, because otherwise I would still be sitting here, tinkering to find data.
Best Regards
hk
Yo Hans! On Fri, 5 Feb 2021 20:12:39 +0100 Hans Kurscheidt <lve0200@gmail.com> wrote:not so clear:Welcome to my world. :-)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/ttyACM0As I do not know systmed(rizzle), I can't comment intelligently on that.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 gpsdSo gpsd is running.---------------------------- 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 gpsdThat looks right to me.??What does not look correct to you? RGDS GARY --------------------------------------------------------------------------- Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703 gem@rellim.com Tel:+1 541 382 8588 Veritas liberabit vos. -- Quid est veritas? "If you can't measure it, you can't improve it." - Lord Kelvin
[Prev in Thread] | Current Thread | [Next in Thread] |