OpenWrt Forum Archive

Topic: AA 12.09 & GPSD wireless clients cannot connect to socket

The content of this topic has been archived on 31 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi

I have a problem trying to get gpsd operating with A.A. 12.09; clients cannot connect to the gpsd socket it appears. I would really appreciate help with this if anyone can spare some time.

Details

A.A. 12.09, TP-Link WDR3600
GPS = Globalsat BU SIRF iV puck
Installed USB module PL2303.

Set Baud rate 4800, CS8, -parenb

With the GPS connected I can see the NMEA sentences on /dev/ttyUSB0

These look separated by more than one carriage return.

gpsd -N -D3 - reports all is OK with GPSD.

It can then be run as a daemon
a netstat shows the process and default port against localhost.

BUT

The wireless test client (Mac) cannot connect to the gpsd socket - so I cannot use nc (say) and neither can I connect to the data stream using navigation software (MacENC or iNavX) that has the capability to read TCP encapsulated data via host/port numbers.

I am stumped and cannot fathom what I must have overlooked or done incorrectly. As I said, all help would be great

Below is a ssh capture if that is of use. The XXX, YYY & ZZ subsitutions are mine after the cut from ssh for obvious reasons :-)

root@OpenWrt:~# stty 4800 cs8 -parenb -F /dev/ttyUSB0
root@OpenWrt:~#
root@OpenWrt:~# cat </dev/ttyUSB0
$GPGGA,074835.884,XXXX.XXXX,N,000YY.YYYY,E,1,03,3.2,45.6,M,47.0,M,0000*ZZ

$GPGLL,XXXX.YYYY,N,000YY.YYYY,E,074835.884,A,A*5B

$GPRMC,074835.884,A,XXXX.XXXX,N,000YY.YYYY,E,1.71,36.81,310513,,,A*ZZ

$GPVTG,36.81,T,,M,1.71,N,3.2,K,N*38

$GPGGA,074836.884,XXXX.XXXX,N,000YY.YYYY,E,1,03,3.2,45.6,M,47.0,M,0000*ZZ


^C
root@OpenWrt:~#
root@OpenWrt:~# gpsd -N -D3 /dev/ttyUSB0
gpsd:INFO: launching (Version 3.7)
gpsd:ERROR: can't create IPv6 socket
gpsd:INFO: listening on port gpsd
gpsd:INFO: NTPD ntpd_link_activate: 1
gpsd:INFO: stashing device /dev/ttyUSB0 at slot 0
gpsd:INFO: running with effective group ID 0
gpsd:INFO: running with effective user ID 65534
gpsd:INFO: startup at 2011-09-08T16:30:20.000Z (1315499420)
^Cgpsd:WARN: received terminating signal 2.
gpsd:WARN: exiting.
root@OpenWrt:~#
root@OpenWrt:~# gpsd /dev/ttyUSB0
root@OpenWrt:~#
root@OpenWrt:~# netstat -ln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       
tcp        0      0 127.0.0.1:2947          0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
netstat: /proc/net/tcp6: No such file or directory
udp        0      0 0.0.0.0:12574           0.0.0.0:*                           
udp        0      0 0.0.0.0:31285           0.0.0.0:*                           
udp        0      0 0.0.0.0:53              0.0.0.0:*                           
udp        0      0 0.0.0.0:67              0.0.0.0:*                           
udp        0   1408 0.0.0.0:14148           0.0.0.0:*                           
udp        0      0 0.0.0.0:5444            0.0.0.0:*                           
udp        0      0 0.0.0.0:25926           0.0.0.0:*                           
udp        0      0 0.0.0.0:47434           0.0.0.0:*                           
udp        0      0 0.0.0.0:4968            0.0.0.0:*                           
udp        0      0 0.0.0.0:45740           0.0.0.0:*                           
netstat: /proc/net/udp6: No such file or directory
netstat: /proc/net/raw6: No such file or directory
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node Path
unix  2      [ ACC ]     STREAM     LISTENING        849 /var/run/ubus.sock
root@OpenWrt:~#

(Last edited by Aleksandr on 31 May 2013, 09:32)

Hi Rob

Thanks - yes I have seen this too. Still stumped.

Rob the brew - it's either tea or beer! And on a Friday at appx 1800 I think that it may well be the latter for me!

A

Definitely beer. Have a look here:
http://h-wrt.com/en/doc/gps
Is there anything in there different to what you did?

Rob

Broadly the same bar the stuff re the LCD bit that does not apply.

What is getting me is that I see the NMEA sentences on /dev/ttyUSB0
gpsd as a process with debug is OK and also it runs as a daemon.

The Mac is on the same network and all of that is correct as ssh etc. works.

I have to say that it is driving me mad.

A

what is the output of gpsd with full debug messages (-D8)

Morning Rob.

Here is the output from gpsd -N -D8 /dev/ttyUSB0
It seems to say it's OK.

How was the beer?

root@OpenWrt:~# gpsd -N -D8 /dev/ttyUSB0
gpsd:INFO: launching (Version 3.7)
gpsd:IO: opening IPv4 socket
gpsd:SPIN: passivesock_af() -> 3
gpsd:IO: opening IPv6 socket
gpsd:ERROR: can't create IPv6 socket
gpsd:INFO: listening on port gpsd
gpsd:PROG: NTPD shmat(32769,0,0) succeeded, segment 0
gpsd:PROG: NTPD shmat(65538,0,0) succeeded, segment 1
gpsd:PROG: NTPD shmat(98307,0,0) succeeded, segment 2
gpsd:PROG: NTPD shmat(131076,0,0) succeeded, segment 3
gpsd:PROG: shmat() succeeded, segment 163845
gpsd:PROG: shared-segment creation succeeded,
gpsd:INFO: NTPD ntpd_link_activate: 1
gpsd:INFO: stashing device /dev/ttyUSB0 at slot 0
gpsd:INFO: running with effective group ID 0
gpsd:INFO: running with effective user ID 65534
gpsd:INFO: startup at 2011-09-08T16:53:13.000Z (1315500793)
^Cgpsd:WARN: received terminating signal 2.
gpsd:WARN: exiting.
root@OpenWrt:~#

Rob

OK also:

I ran gpsd in debug (this is first lot of output below) then a separate term session to the TP-Link I ran telnet to the port and issued a 'watch' - see the second output capture.
If I run another telnet session from the mac directly to the TP-Link (IP and port) - still nothing! Zippo!

So! Is there something wrong with incoming connections on my openwrt?

Outputs:

1) gpsd side


root@OpenWrt:~#  gpsd -N -D3 /dev/ttyUSB0
gpsd:INFO: launching (Version 3.7)
gpsd:ERROR: can't create IPv6 socket
gpsd:INFO: listening on port gpsd
gpsd:INFO: NTPD ntpd_link_activate: 1
gpsd:INFO: stashing device /dev/ttyUSB0 at slot 0
gpsd:INFO: running with effective group ID 0
gpsd:INFO: running with effective user ID 65534
gpsd:INFO: startup at 2011-09-08T17:08:57.000Z (1315501737)
gpsd:INFO: opening GPS data source type 3 at '/dev/ttyUSB0'
gpsd:INFO: speed 4800, 8N1
gpsd:INFO: attempting USB device enumeration.
gpsd:INFO: 1d6b:0002 (bus 1, device 1)
gpsd:INFO: 05e3:0608 (bus 1, device 2)
gpsd:INFO: 067b:2303 (bus 1, device 3)
gpsd:SHOUT: vendor/product match with 091e:0003 not found
gpsd:INFO: gpsd_activate(): activated GPS (fd 5)
gpsd:INFO: /dev/ttyUSB0 identified as type Generic NMEA (0.094054 sec @ 4800bps)
gpsd:DATA: packet type 1 from /dev/ttyUSB0 with {ONLINE|PACKET|DRIVER}
gpsd:DATA: GPGGA: registers fractional time 85326.00
gpsd:WARN: can't use GGA time until after ZDA or RMC has supplied a year.
gpsd:DATA: GGA: hhmmss=085326.000 lat=XX.23 lon=0.YY alt=44.10 mode=3 status=1
gpsd:DATA: packet type 1 from /dev/ttyUSB0 with {ONLINE|LATLON|ALTITUDE|STATUS|MODE|PACKET|CLEAR}
gpsd:DATA: GPGLL: registers fractional time 85326.00
gpsd:WARN: can't use GLL time until after ZDA or RMC has supplied a year.
gpsd:DATA: GLL: hhmmss=085326.000 lat=XX.23 lon=0.YY mode=2 status=1
gpsd:DATA: packet type 1 from /dev/ttyUSB0 with {ONLINE|LATLON|STATUS|PACKET}
gpsd:DATA: merge_ddmmyy(010613) sets year 2013
gpsd:DATA: GPRMC: registers fractional time 85326.00
gpsd:DATA: RMC: ddmmyy=010613 hhmmss=085326.000 lat=XX.23 lon=0.YY speed=0.41 track=246.21 mode=2 status=1
gpsd:DATA: GPRMC time is 1370076806.000000 = 2013-06-01T08:53:26.00Z
gpsd:WARN: date more than a year in the future!
gpsd:DATA: packet type 1 from /dev/ttyUSB0 with {ONLINE|TIME|LATLON|SPEED|TRACK|PACKET}
gpsd:DATA: packet type 1 from /dev/ttyUSB0 with {ONLINE|PACKET}
gpsd:WARN: SiRF: Unknown packet id 64 length 67
gpsd:DATA: packet type 4 from /dev/ttyUSB0 with {ONLINE|PACKET|DRIVER}
gpsd:WARN: SiRF: Unknown packet id 64 length 67
gpsd:DATA: packet type 4 from /dev/ttyUSB0 with {ONLINE|PACKET}
gpsd:WARN: SiRF: Unknown packet id 64 length 67




2) on the TP-Link - the telnet session that corresponds with the above




root@OpenWrt:~# telnet localhost:2947
{"class":"VERSION","release":"3.7","rev":"3.7","proto_major":3,"proto_minor":7}
?WATCH={"enable":true,"json":true}
{"class":"DEVICES","devices":[{"class":"DEVICE","path":"/dev/ttyUSB0","activated":"2011-09-08T17:09:50.185Z","native":0,"bps":4800,"parity":"N","stopbits":1,"cycle":1.00}]}
{"class":"WATCH","enable":true,"json":true,"nmea":false,"raw":0,"scaled":false,"timing":false}
{"class":"DEVICE","path":"/dev/ttyUSB0","activated":"2011-09-08T17:09:50.280Z","driver":"Generic NMEA","native":0,"bps":4800,"parity":"N","stopbits":1,"cycle":1.00}
{"class":"TPV","tag":"GGA","device":"/dev/ttyUSB0","mode":3,"lat":XX.233431667,"lon":0.YY8898333,"alt":44.100}
{"class":"TPV","tag":"GLL","device":"/dev/ttyUSB0","mode":3,"lat":XX.233431667,"lon":0.YY8898333,"alt":44.100}
{"class":"TPV","tag":"RMC","device":"/dev/ttyUSB0","mode":3,"time":"2013-06-01T08:53:26.000Z","ept":0.005,"lat":XX.233431667,"lon":0.YY8898333,"alt":44.100,"track":246.2100,"speed":0.406}
{"class":"DEVICE","path":"/dev/ttyUSB0","activated":"2011-09-08T17:09:51.882Z","flags":1,"driver":"SiRF binary","native":1,"bps":4800,"parity":"N","stopbits":1,"cycle":1.00}
{"class":"SKY","tag":"MID4","device":"/dev/ttyUSB0","time":"2013-06-01T08:53:27.000Z","satellites":[{"PRN":5,"el":61,"az":204,"ss":19,"used":false},{"PRN":10,"el":19,"az":157,"ss":22,"used":false},{"PRN":26,"el":66,"az":288,"ss":8,"used":false},{"PRN":8,"el":63,"az":64,"ss":13,"used":false},{"PRN":7,"el":31,"az":57,"ss":25,"used":false},{"PRN":28,"el":37,"az":130,"ss":25,"used":false},{"PRN":19,"el":3,"az":42,"ss":17,"used":false},{"PRN":3,"el":5,"az":21,"ss":12,"used":false},{"PRN":15,"el":23,"az":283,"ss":24,"used":false},{"PRN":21,"el":12,"az":322,"ss":0,"used":false},{"PRN":9,"el":75,"az":210,"ss":29,"used":false},{"PRN":6,"el":2,"az":4,"ss":11,"used":false}]}
{"class":"TPV","tag":"MID2","device":"/dev/ttyUSB0","mode":3,"time":"2013-06-01T08:53:27.000Z","ept":0.005,"lat":XX.233435459,"lon":0.YY8900422,"alt":44.174,"track":0.9220,"speed":0.099,"climb":-0.077}

(Last edited by Aleksandr on 1 Jun 2013, 10:22)

At this point I have no idea (apart from maybe fixing the time problem: nntp I'd guess).
Did read this:

Note that gpsd doesn't try to activate the receiver until it has a client, and the client asks for data with a ?WATCH request. It also shuts down its connection to the receiver when it has no clients. This is a power saving feature.

Don't know if that is relevant.
From here:
http://www.catb.org/gpsd/troubleshooting.html
And yes, the beer was good! In fact it is a lovely sunny Day, and I think I'm going to sit in the garden with another one!

Also have a look at stevep's post here:
http://www.raspberrypi.org/phpBB3/viewt … p;p=101757

You'll need gpsd-clients

(Last edited by robthebrew on 1 Jun 2013, 11:02)

Beer in the garden! It's cloudy here! Where are you then?

The problem is that a telnet (say) from a wireless client does not connect and therefore I cannot even send the ?Watch.
Same with the navigation software that cannot connect to the socket on OpenWrt router I am guessing.

If you look at the last screed of stuff from the 'internal' telnet - i.e. on the openwrt box to gpsd on the same box you'll see that I can issue the ?Watch and hence get the data between the gpsd server and telnet acting at the client.

Grrr! I am missing something here and I just cannot think what it is.

Beer - I think that is in order now!

(Last edited by Aleksandr on 1 Jun 2013, 13:41)

Beer, mmmmm.
Am I missing something? Don't you need a client to serve the data out? I know it sounds odd, your router is serving data it gets to others.
I am somehow not understanding where the client/server bit is.
Too much sun, not enough beer, and far too much fun throwing knives and spikes!
Only reason I am here is it got too hot outside. I'm in the UK BTW.

UK too!

Just been out and located a beer.

The gpsd is the server - i.e. it reads data from the /tty/USB0 via which the GPS is attached. It reads in NMEA sentences from that device and encapsulates them withing a TCP packet and transmites these to connected clients on a designated port (default 2947.)

A client that runs on another system (or the same) connects to the port (2947) on the device that gpsd is running on.

Server side = OpenWrt; with say an IP addr = 192.168.1.1 and gpsd is the gps server daemon, registers its service on port 2947. It reads NMEA sentences from a connected device on /dev/ttyUSB0 and these are 'served' when a client connects and requests the data.

Client side = another system (say the Mac etc.) and it runs a software client that connects using TCP/IP to the software server running on the router. Rough testing; telnet is OK. So it looks like this:


Server:   gpsd (port 2947) <-------------> Client: some client software (e.g. navigation/telnet etc.)

Well - This text editor is what it is - so I cannot draw the proper interchange of data but:

The server sets up the socket, binds and listens for incoming connections. When it gets one, it accepts that connection and thus establishes a 'link' between the two systems and indeed the two lumps of software on either side. Data can then be sent/received between them.

But in my case. Not much happens! gpsd seems to be fine, so does the gps raw NMEA data on the /dev/ttyUSB0. Also if you run up a client on the same router as the gpsd runs on, well - it seems to work as it should. It's the other clients (wireless) that arn't.

Something is amiss and I don't quite see it at the moment.

Now I have to go to town to get some stuff to cook. :-(

'( don't know mate. It doesn't help that pretty much every exit code seems to be 2.
Maybe exit code 2 is success? And then you need to attach a client?

I'm going to continue to ponder this issue. MAybe someone else will come across the post too and have an idea?
It's been good chatting. You N or S England?

s

RtB

I'm going to re-do some of the configuration and packages - if I solve it I will post up here of course. I'll keep checking here to see if there are other ideas too.

I'm S. Eng too.

Thanks for the link
The GPS unit is a Globalsat BU353 SIRF IV and not a Garmin unit.

It think there is something not quite right when the GPS client on another machine tries to make a connection. It does not get that far. Running gpsd in debug shows no response as the client tries to make a connection. Zippo.

On the other hand - if you run up a client within OpenWrt then, as we've seen, a fd is assigned and the socket interface works.

That is odd, from your logs above:

gpsd:SHOUT: vendor/product match with 091e:0003 not found

Googling the vendor/product leads to links (including mine above) about Garmin.
Is it a re-badge?
It doesn't seem to be working to me. You have longs/lats with placeholders (XX, YY) in the decimals

Not a re-badge.

http://www.globalsat.com.tw

the XX YY is me changing the lat/long when I cut-n-pasted as I dod not want location placed on the net for all to see.

Ah! I still don't understand the vendor/product thing when googling: "091e:0003"

Hi all,

If you want to access to the gpsd stream outside of localhost you must use de '-G' option.
Below is instructions from man of gpsd:

------------
-G   This flag causes gpsd to listen on all addresses (INADDR_ANY) rather than just the loop back (INADDR_LOOPBACK) address. For the sake of privacy and security,TPV information is now private to the local machine until the user makes an effort to expose this to the world.
------------

Have a nice Hack and Enjoy wink

Gael

Hi guys,

I think I suffered with the same problem as you do. Did you already solve it? I think I did.
What's the case:
Installing gpsd in a current version of openwrt (AA 12.09) needs hardly no additional configuration. Unlike most of the descriptions on the net you won't have to start gpsd manually or through rc.local.
In fact, it's already started after you installed it. See /etc/init.d/gpsd . And it is using the uci-style config in /etc/config/gpsd

In my case the gps-receiver seemed to work fine. I simply could not access it from LAN or WAN, despite of opening port 2947. Yes, I did start it using the -G option but doing
root@OpenWrt:/# ps |grep gpsd
did not show me this -G . Just because it was already started at boottime using the default config-file. Logread tells you if you read it well.

Now, solving is quite easy. Just edit  /etc/config/gpsd and change
option listen_globally    "false"
to  true
Then restart gpsd by:
root@OpenWrt:/# /etc/init.d/gpsd restart

Now you can check if you can reach it by
telnet <routeraddress> 2947
and see if you get a header such as {"class":"VERSION","release":"3.7","rev":"3.7","proto_major":3,"proto_minor":7}

After that, try running a simple gps-client like xgps or cgps on a pc

That's it for me. I hope it will help someone.

Cheers,

– Erik –

Hi guys!

could anybody consult me - in gpsd 3.7, option -n, as I understand must start translation without ?WHATCH request from client, but it not affected. or I not correct understand this option.

I saw correct NMEA data over telnet if I put request by hand, but any programs like OpenCPN nothing receive and I can see - USB device in sleep mode.

Thanks a lot, Vlad

The discussion might have continued from here.