1

I am connected to a processor with GPS attached through a USB-serial port. What I've been trying to do is read the GPS data by doing:

gpscat /dev/ttyS2 | gpsdecode

However, it's very slow and after a long time it outputs this:

130 root@gw-0317STLG0067 ~ # gpscat /dev/ttyS2 | gpsdecode            
:(
{"class":"SKY","device":"stdin","vdop":1.20,"hdop":1.20,"pdop":1.80,"satellites":[{"PRN":29,"el":28,"az":79,"ss":39,"used":false},{"PRN":31,"el":18,"az":204,"ss":18,"used":false}]}

When I kill the process, this is what it outputs:

close failed in file object destructor: 
sys.excepthook is missing 
lost sys.stderr

Is this the right command to use? If so, what's the problem?

Edit ---- New

Output{"class":"TPV","device":"stdin","mode":2,"lat":50.782431667,"lon":6.076753333} {"class":"SKY","device":"stdin","satellites":[{"PRN":27,"el":86,"az":124,"ss":30,"used":false}]} {"class":"TPV","device":"stdin","mode":2,"lat":50.782431667,"lon":6.076753333} {"class":"TPV","device":"stdin","mode":2,"lat":50.782431667,"lon":6.076753333} {"class":"TPV","device":"stdin","mode":2,"lat":50.782431667,"lon":6.076753333} {"class":"TPV","device":"stdin","mode":2,"time":"2017-07-17T14:52:13.000Z","ept":0.005,"lat":50.782431667,"lon":6.076753333,"track":206.8000,"speed":0.000} {"class":"SKY","device":"stdin","vdop":1.60,"hdop":1.00,"pdop":2.00,"satellites":[{"PRN":7,"el":10,"az":289,"ss":19,"used":false},{"PRN":8,"el":54,"az":296,"ss":19,"used":false},{"PRN":10,"el":59,"az":122,"ss":43,"used":false},{"PRN":15,"el":11,"az":38,"ss":43,"used":false},{"PRN":27,"el":84,"az":126,"ss":34,"used":false}]} {"class":"SKY","device":"stdin","vdop":1.60,"hdop":1.00,"pdop":2.00,"satellites":[{"PRN":7,"el":10,"az":289,"ss":19,"used":false},{"PRN":8,"el":54,"az":296,"ss":19,"used":false},{"PRN":10,"el":59,"az":122,"ss":43,"used":false},{"PRN":15,"el":11,"az":38,"ss":43,"used":false},{"PRN":27,"el":84,"az":126,"ss":34,"used":false},{"PRN":27,"el":84,"az":126,"ss":34,"used":false}]} {"class":"SKY","device":"stdin","vdop":1.60,"hdop":1.00,"pdop":2.00,"satellites":[{"PRN":7,"el":10,"az":288,"ss":17,"used":false},{"PRN":8,"el":55,"az":296,"ss":22,"used":false},{"PRN":10,"el":60,"az":120,"ss":41,"used":false},{"PRN":15,"el":10,"az":37,"ss":45,"used":false},{"PRN":16,"el":35,"az":188,"ss":25,"used":false},{"PRN":18,"el":46,"az":70,"ss":40,"used":false},{"PRN":21,"el":23,"az":71,"ss":38,"used":false},{"PRN":26,"el":10,"az":175,"ss":24,"used":false},{"PRN":27,"el":84,"az":126,"ss":33,"used":false}]} {"class":"SKY","device":"stdin","vdop":1.60,"hdop":1.00,"pdop":2.00,"satellites":[{"PRN":7,"el":10,"az":288,"ss":17,"used":false},{"PRN":8,"el":55,"az":296,"ss":22,"used":false},{"PRN":10,"el":60,"az":120,"ss":41,"used":false},{"PRN":15,"el":10,"az":37,"ss":45,"used":false},{"PRN":16,"el":35,"az":188,"ss":25,"used":false},{"PRN":18,"el":46,"az":70,"ss":40,"used":false},{"PRN":21,"el":23,"az":71,"ss":38,"used":false},{"PRN":26,"el":10,"az":175,"ss":24,"used":false},{"PRN":27,"el":84,"az":126,"ss":33,"used":false},{"PRN":70,"el":14,"az":23,"ss":25,"used":false},{"PRN":86,"el":39,"az":82,"ss":32,"used":true},{"PRN":65,"el":0,"az":174,"ss":19,"used":false},{"PRN":71,"el":47,"az":70,"ss":29,"used":true},{"PRN":72,"el":35,"az":142,"ss":29,"used":true}]}

0
1

If so, what's the problem?

It appears as though you're killing the gpsdecode process, which was reading gpscat's output. When it stopped reading, the output buffer for gpscat filled up. When the kill signal got to the gpscat process, python tried to close the non-empty output handle, it failed with that message, as seen in the linked Stack Overflow Q&A.

To avoid this particular error, you could try killing the gpscat process instead of the gpsdecode process.

5
  • But for the output before I killed the process, it's not outputting anything readable for me. Is this what's supposed to happen? – JobHunter69 Jul 17 '17 at 14:38
  • It says it outputs json, which seems to be what happened; what did you expect? – Jeff Schaller Jul 17 '17 at 14:43
  • Ok I just retried and got some new output which I updated in my question. However it seems very inconsistent. Sometimes there's TPV, other times there's SKY. If I want coordinates, I'll use TPV right? But why does TPV and SKY each come randomly? – JobHunter69 Jul 17 '17 at 14:57
  • Ok I just retried and got some new output which I updated in my question. However it seems very inconsistent. Sometimes there's TPV, other times there's SKY. If I want coordinates, I'll use TPV right? But why does TPV and SKY each come randomly? – JobHunter69 Jul 17 '17 at 14:57
  • I don't know anything about gpsdecode; maybe try one of their mailing lists ? – Jeff Schaller Jul 17 '17 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.