2

I'm using gpsd 3.22 on Ubuntu 22.10

I have a GlobalSat BU-353-S4 USB GPS Receiver device that identifies as Bus 001 Device 008: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port / Mobile Action MA-8910P

It is enumerated as /dev/ttyUSB0 The system is correctly detecting the plug and unplug - I can plug the device in and ls /dev/tty*shows ttyUSB0,. When I unplug it, ttyUSB0 disappears.

If the system is booted with the GPS device plugged in while the system is powered off, it works properly. cgps obtains a lock in a minute or two.

However if the GPS device is unplugged and replugged while the system is running, or the system is rebooted while the GPS device remains plugged in and powered, a lock is never obtained. cgps shows nmea sentences displayed at the bottom, and it shows 10 or more satellites. Of those satellites, maybe one is listed with a "Y" in the "use" column. All the rest have 0 SNR and are unused. I've waited 20 minutes and it never gets a lock.

After unplugging the GPS and restarting the computer, I can get a GPS lock almost immediately.

On the gpsd man page, there are mentions of "hotplug scripts", but no examples or details on what they need to do or how they are used. Do they already exist, or do I need to write them? Maybe that is what is needed to get gpsd to function again without a cold start?

Could anyone point me in the right direction? I have the one GPS receiver that I would like to work with gpsd upon insertion at any time.

tim11g
  • 583

1 Answers1

0

Heres some code I have tested and definitely works under Ubuntu 18.04 with a Globalsat BU-353N5 ( or S4 ) USB GPS device, using python 3.6

Run lsusb on linux to confirm it can see the GPS unit before you run the python code. I just plugged it into my PC and it starts working. I put the USB receiver on the window ledge, and it seemed to work fine.

My GPS output in Australia seems to output GNGGA, I have seen GPGGA output listed in the USA, you will need to adapt the code below what to what the gps unit spits out.

Happy Xmas!

import serial

ser = serial.Serial('/dev/ttyUSB0',4800,timeout=5)

while 1: line = ser.readline().decode() splitline = line.split(',')

if splitline[0] == '$GNGGA':
    latitude = line[18:29]
    longitude =line[31:42]
    print(line)
    print('latitude = ',latitude)
    print('longitude =',longitude)
    print('How to read : 3824.3139  means 38 deg 24.3139 mins')
    break

steve
  • 141
  • 5