gpsd kplex communication

493 views
Skip to first unread message

Thomas Kleisch

unread,
Oct 27, 2015, 10:42:10 AM10/27/15
to kplex
Hello,
first of all, as a sailing electrical engineer I appreciate your activities very much.
Yet I experience problems in both 0.4.2 and 0.5 releases of Openplotter in getting gpsd data into the kplex output stream. In the NMEA 0183 tap I have an input line named "gpsd" with parameters: TCP, localhost, 2947, none, nothing (filtering). Neither the output window (Show output) TCP localhost:10110 nor OpenCPN NMEA Debug Window show any $GPxxx data although my gpsd seems to work correct which I check in cgps/gpsmon/telnet/OpenCPN manners. Further more kplex seems to "die" away occasionally.
My HW is a Raspberry Pi 2 Modell B - 1GB RAM with a Adafruit Ultimate GPS HAT for Raspberry Pi A+/B+/Pi 2
It would be kind if you got some hints for me ...
Best, Tom

Keith Young

unread,
Oct 27, 2015, 12:59:47 PM10/27/15
to kplex
I'm afraid I don't have openplotter installed and I don't personally run gpsd. I'm assuming that the expected result here is that gpsd feeds kplex.

Can you let me know what the kplex config looks like (/etc/kplex.conf)?

You say you've tried telnet: Does that mean that if you telnet to localhost port 2947 you see $GPxxx sentences rather than output in gpsd format?

Occasionally dying is not good but could be expected behaviour if for some reason all kplex's inputs go away

Thomas Kleisch

unread,
Oct 28, 2015, 7:20:09 AM10/28/15
to kplex
Am Dienstag, 27. Oktober 2015 17:59:47 UTC+1 schrieb Keith Young:
I'm afraid I don't have openplotter installed and I don't personally run gpsd. I'm assuming that the expected result here is that gpsd feeds kplex.
yes (although gpsd also might be a possible data sink as well)

Can you let me know what the kplex config looks like (/etc/kplex.conf)?
see below

You say you've tried telnet: Does that mean that if you telnet to localhost port 2947 you see $GPxxx sentences rather than output in gpsd format?
gpsd knows both json and nmea. After a: "telnet localhost 2947" you chose by simply:
?WATCH={"enable":true,"json":true}
or:
?WATCH={"enable":true,"nmea":true}
see: http://www.catb.org/gpsd/troubleshooting.html
 
Occasionally dying is not good but could be expected behaviour if for some reason all kplex's inputs go away
 shouln'd be the case as openplotter feed in data to kplex every secon.kplex.confd.

here comes my .kplex.conf

# For advanced manual configuration, please visit: http://www.stripydog.com/kplex/configuration.html
# Editing this file by openplotter GUI, can eliminate manual settings.
# You should not modify defaults.

###defaults

[udp]
name=system_input
direction=in
optional=yes
port=10110

[tcp]
name=system_output
direction=out
mode=server
port=10110

###end defaults

[tcp]
name=gpsd
direction=in
optional=yes
mode=client
address=localhost
port=2947
persist=yes
retry=10

# end of .kplex.conf

hope this helps ... Tom

Sailoog

unread,
Oct 28, 2015, 7:37:43 AM10/28/15
to kplex
I have dealt with this issue long time ago too. NMEA data its supposed to be on localhost 2947 when gpsd is running but no way. Gpsd is running ok because OpenCPN is getting data.

I can confirm this behaviour on OpenPlotter (Raspbian), Navigatrix (Ubuntu) and Ubuntu 14.04.

Keith Young

unread,
Oct 28, 2015, 7:54:25 AM10/28/15
to kplex

gpsd knows both json and nmea. After a: "telnet localhost 2947" you chose by simply:
?WATCH={"enable":true,"json":true}
or:
?WATCH={"enable":true,"nmea":true}
see: http://www.catb.org/gpsd/troubleshooting.html

Forgive me if I am misunderstanding this: I haven't used gpsd much. 

Doesn't this mean that when a client (like kplex) connects to gpsd it needs to issue a "?WATCH={"enable":true,"nmea":true}" command before it gets data out in NMEA format?  kplex doesn't do that (but maybe that's a good feature to add).  OpenCPN has specific gpsd support, kplex just multiplexes NMEA-0183.

Have I misinterpreted this?

Thomas Kleisch

unread,
Oct 28, 2015, 9:12:17 AM10/28/15
to kplex
No, you don't. Yet as far as I know telnet into gpsd is the least preferred method to connect to gpsd and should be used for testing purposes only. For more information on how to connect to gpsd's client interface, see How the GPSD wire protocol works in the GPSD Client HOWTO.

Best, Tom

Keith Young

unread,
Oct 28, 2015, 9:58:07 AM10/28/15
to kplex
What I'm saying is that, unless I'm missing something, connecting kplex as a client to gpsd like that wouldn't  work.  I was going to say "there's no way for kplex to do that: I need to add a new option".  But maybe I there might be...

This might not work but...

In your kplex configuration underneath "name=gpsd", remove the "direction=in" directive (which makes the connection bi-directional) and replace it with this line:
preamble=?WATCH={"enable":true,"nmea":true}

Then restart kplex.

That might do something

Thomas Kleisch

unread,
Oct 28, 2015, 11:37:45 AM10/28/15
to kplex

Hi Keith,

indeed it did. I do now getting gpsd's nmea output in kplex output in Openplotter. I will forward this info to sailoog.com cause .kplex.conf might be overwritten by Openplotter.
Thanks for your help,
best Tom

Sailoog

unread,
Oct 28, 2015, 12:04:26 PM10/28/15
to kplex
I got it, thanks Thomas and Keith, I never found a solution for that. I think the best way will be to add a button to create GPSD inputs. It will be included on next OpenPlotter release.
Thanks again.

Keith Young

unread,
Oct 28, 2015, 1:07:51 PM10/28/15
to kplex


I got it, thanks Thomas and Keith, I never found a solution for that. I think the best way will be to add a button to create GPSD inputs. It will be included on next OpenPlotter release.

Actually thanks to you both.  "preamble" was designed for people *sending* data to AIS aggregation sites so it doesn't work for *inputs* (which is why I suggested making that connection bi-directional): I will correct that.

I will also add an easy option to allow a user to connect to gpsd and send this string

Keith Young

unread,
Oct 30, 2015, 3:54:14 PM10/30/15
to kplex
In the develop branch on github are a couple of fixes.  Firstly it should now be possible to send a preamble string when connecting an inbound connection (which is a bit wrong as you're writing down a supposedly read-only connection).  Secondly there's now a shorthand to send the string to gpsd to elicit nmea-format output:
gpsd=yes

I've just noticed that I haven't (but will) updated the README to note that the preamble string must be 1024 characters or less (not an issue here).

This isn't well tested, but if you want to test it and give feedback I'd appreciate it.

Sailoog

unread,
Nov 2, 2015, 6:27:32 AM11/2/15
to kplex
Great! I will test and report.

Sailoog

unread,
Nov 28, 2015, 8:25:14 AM11/28/15
to kplex
FYI gpsd option is working like a charm
Reply all
Reply to author
Forward
0 new messages