First post to the forum, be gentle.
While trying to get my wrt1900acs working (sigh, troublesome), I messed around with a cheap GPS dongle I had bought.
The dongle is a vk-172, available for $12 on ebay or $15 on amazon. It appears to be a U-blox 7 usb gps (+other gnss) dongle.
I tried a lot of things, basically trial and error to get things working with no luck.
gpsd, ugps, etc. Searching for information didn't help.
Then I found this application note from u-blox that gave me the hint I needed.
https://www2.u-blox.com/images/download … 059%29.pdf
I installed kmod-usb-acm and the device shows up as /dev/ttyACM0
This matches with the config file of the "ugps" app, which references ttyACM0
It even seems to (almost) work.
ugps is simple but does one job very well -- it will read nmea data from a
GPS device and set the clock from the date/time values in the datastream.
However, it didn't work for me. But it ALMOST did, so I continued.
checking the log I got a lot of errors:
RMC datagram has wrong parameter count got 10 but expected 11
VTG datagram has wrong parameter count got 8 but expected 9
GGA datagram has wrong parameter count got 13 but expected 14
So I found my way to the source code and located the problem.
The ublox nmea output leaves out some values, which leads to rows of
commas. The ugps code uses strtok which treats multiple delimiters
as one. (an error in this case)
so ugps/nmea.c should have this routine:
static int
nmea_tokenize(char *msg)
{
int cnt = 0;
char *tok = strtok(msg, ",");
while (tok && cnt < MAX_NMEA_PARAM) {
nmea_params[cnt].str = tok;
nmea_params[cnt].num = atoi(tok);
cnt++;
tok = strtok(NULL, ",");
}
return cnt;
}
look more like this (or something better):
static int
nmea_tokenize(char *msg)
{
int cnt = 0;
char *tok = strchr(msg, ',');
while (tok && cnt < MAX_NMEA_PARAM) {
*tok = '\0';
tok++;
nmea_params[cnt].str = tok;
nmea_params[cnt].num = atoi(tok);
cnt++;
tok = strchr(tok, ',');
}
return cnt;
}
I may figure out how to recompile the ugps openwrt binary, but
until then I thought I'd pass off my findings.
Oh, I also tried getting gpsd + ntpd working. That didn't work
either, but I think requires a lot more configuring.