zeenix / gps-share

Utility to share your GPS device on local network
GNU General Public License v2.0
67 stars 9 forks source link

NaviLock NL 602U not autodetected #4

Closed nineff closed 6 years ago

nineff commented 6 years ago

The device: http://www.navilock.de/produkte/F_778_GPS_61840/merkmale.html?setLanguage=en

The Udev output:

$ udevadm info /dev/ttyACM0
P: /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/tty/ttyACM0
N: ttyACM0
S: gps0
S: serial/by-id/usb-u-blox_AG_-_www.u-blox.com_u-blox_6_-_GPS_Receiver-if00
S: serial/by-path/pci-0000:00:1a.0-usb-0:1.2:1.0
E: DEVLINKS=/dev/serial/by-path/pci-0000:00:1a.0-usb-0:1.2:1.0 /dev/gps0 /dev/serial/by-id/usb-u-blox_AG_-_www.u-blox.com_u-blox_6_-_GPS_Receiver-if00
E: DEVNAME=/dev/ttyACM0
E: DEVPATH=/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/tty/ttyACM0
E: ID_BUS=usb
E: ID_MM_CANDIDATE=1
E: ID_MODEL=u-blox_6_-_GPS_Receiver
E: ID_MODEL_ENC=u-blox\x206\x20\x20-\x20\x20GPS\x20Receiver
E: ID_MODEL_FROM_DATABASE=5 Series/3400 Series Chipset USB2 Enhanced Host Controller
E: ID_MODEL_ID=01a6
E: ID_PATH=pci-0000:00:1a.0-usb-0:1.2:1.0
E: ID_PATH_TAG=pci-0000_00_1a_0-usb-0_1_2_1_0
E: ID_PCI_CLASS_FROM_DATABASE=Serial bus controller
E: ID_PCI_INTERFACE_FROM_DATABASE=EHCI
E: ID_PCI_SUBCLASS_FROM_DATABASE=USB controller
E: ID_REVISION=0602
E: ID_SERIAL=u-blox_AG_-_www.u-blox.com_u-blox_6_-_GPS_Receiver
E: ID_TYPE=generic
E: ID_USB_CLASS_FROM_DATABASE=Communications
E: ID_USB_DRIVER=cdc_acm
E: ID_USB_INTERFACES=:020201:0a00ff:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=u-blox_AG_-_www.u-blox.com
E: ID_VENDOR_ENC=u-blox\x20AG\x20-\x20www.u-blox.com
E: ID_VENDOR_FROM_DATABASE=U-Blox AG
E: ID_VENDOR_ID=1546
E: MAJOR=166
E: MINOR=0
E: SUBSYSTEM=tty
E: SYSTEMD_WANTS=gpsdctl@ttyACM0.service
E: TAGS=:systemd:
E: USEC_INITIALIZED=1311715376

lsusb:

Bus 001 Device 007: ID 1546:01a6 U-Blox AG 

Terminal output:

./gps-share 
Attempting to autodetect GPS device...
Skipping /dev/ttyACM0. Driver cdc_acm
Failed to autodetect GPS device

Specifying the device directly and telnetting into the port:

sudo ./gps-share /dev/ttyACM0
TCP server bound on all interfaces
Port: 41017
group: /Client4/EntryGroup1
Connection from 127.0.0.1
Failed to read from serial port: Operation timed out //these appear about every 3-5 seconds
Failed to read from serial port: Operation timed out 
...

Telnet result:

Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
$GPRMC,131639.00,V,,,,,,,180817,,,N*75
$GPVTG,,,,,,,,,N*30
$GPGGA,131639.00,,,,,0,00,99.99,,,,,,*69
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$GPGSV,4,1,13,01,11,262,,08,68,279,,10,65,100,,11,24,278,*7B
$GPGSV,4,2,13,14,01,147,,15,10,028,,16,16,193,,18,41,063,*76
$GPGSV,4,3,13,21,15,084,,27,67,157,,28,09,332,,30,06,310,*76
$GPGSV,4,4,13,32,13,136,*4C
$GPGLL,,,,,131639.00,V,N*45
$GPTXT,01,01,02,u-blox ag - www.u-blox.com*50
$GPTXT,01,01,02,HW  UBX-G60xx  00040007 *52
$GPTXT,01,01,02,ROM CORE 6.02 (36023) Oct 15 2009 16:52:08*56
$GPTXT,01,01,02,ANTSUPERV=AC SD PDoS SR*20
$GPTXT,01,01,02,ANTSTATUS=OK*3B
$GPRMC,131640.00,V,,,,,,,180817,,,N*7B
$GPVTG,,,,,,,,,N*30
$GPGGA,131640.00,,,,,0,00,99.99,,,,,,*67
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$GPGSV,4,1,13,01,11,262,,08,68,279,,10,65,100,,11,24,278,*7B
$GPGSV,4,2,13,14,01,147,,15,10,028,,16,16,193,,18,41,063,*76
$GPGSV,4,3,13,21,15,084,,27,67,157,,28,09,332,,30,06,310,*76
$GPGSV,4,4,13,32,13,136,*4C
$GPGLL,,,,,131640.00,V,N*4B
$GPRMC,131641.00,V,,,,,,,180817,,,N*7A
$GPVTG,,,,,,,,,N*30
$GPGGA,131641.00,,,,,0,00,99.99,,,,,,*66
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$GPGSV,4,1,13,01,11,262,,08,68,279,,10,65,100,,11,24,278,*7B
$GPGSV,4,2,13,14,01,147,,15,10,028,,16,16,193,,18,41,063,*76
$GPGSV,4,3,13,21,15,084,,27,67,157,,28,09,332,,30,06,310,*76
$GPGSV,4,4,13,32,13,136,*4C
$GPGLL,,,,,131641.00,V,N*4A
$GPRMC,131642.00,V,,,,,,,180817,,,N*79
$GPVTG,,,,,,,,,N*30
$GPGGA,131642.00,,,,,0,00,99.99,,,,,,*65
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$GPGSV,4,1,13,01,11,262,,08,68,279,,10,65,100,,11,24,278,*7B
$GPGSV,4,2,13,14,01,147,,15,10,028,,16,16,193,,18,41,063,*76
$GPGSV,4,3,13,21,15,084,,27,67,157,,28,09,332,,30,06,310,*76
$GPGSV,4,4,13,32,13,136,*4C
$GPGLL,,,,,131642.00,V,N*49
$GPRMC,131643.00,V,,,,,,,180817,,,N*78
$GPVTG,,,,,,,,,N*30
... AND SO ON
zeenix commented 6 years ago

Oh so the second device (that I thought won't work at all) does kinda work! :) We should avoid timeouts of course but hopefully that one is easy to fix.

zeenix commented 6 years ago

I just set the timeout to 10 seconds, could you please check if that helps with timeout errors? Also see if maybe it helps with autodetection too.

nineff commented 6 years ago

Autodetecting is exactly the same: it gets skipped:

sudo ./gps-share 
Attempting to autodetect GPS device...
Skipping /dev/ttyACM0. Driver cdc_acm
Failed to autodetect GPS device

But the increased timeout works nice, I even could decrease it to 1.5 seconds without error messages, but I didn't do extensive testing on that. However 3 s should be more than enough given that the error only appears about once every 5 sec with a timeout of 1 s.

zeenix commented 6 years ago

OK, now this device should just work with my latest changes on test/arch-autodetect branch. Please check and let me know.

nineff commented 6 years ago

looks very promising:

sudo ./gps-share 
Attempting to autodetect GPS device...
/dev/ttyACM1 seems interesting
Needs verification
Reading from port..
Read from port: $GPTXT,01,01,02,u-blox ag - www.u-blox.com*50

Detected /dev/ttyACM1 as a GPS device
TCP server bound on all interfaces
Port: 45757
group: /Client11/EntryGroup1

I can telnet into the port and I'm getting good results, however I'm not sure if geoclue is now actually using this data. Do I need to tell it to connect somehow?

zeenix commented 6 years ago

Cool, thanks. If you get NMEA traces through telnet, that's it already working. :) You shouldn't need to tell geoclue about it but please make sure avahi is working on you machine (i-e firewall isn't blocking ports etc). The easiest way to verify would be to check the accuracy of your location in GNOME Maps (once there is a GPS lock, it should be a few meters at most).

zeenix commented 6 years ago

You can also run geclue binary manually with debug enabled:

G_MESSAGES_DEBUG=Geoclue /usr/libexec/geoclue

and then see if you can spot a message about it using an nmea source with accuracy level 8.