Jump to content

  1. 0
  2. 0
  3. 0/5

Rate this Topic

- - - - -

The End-All Be-All Guide to Your GPS

  • Please log in to reply

OP WangChung

WangChung

Member

  • 34 posts

Posted 03 July 2012 - 07:45 AM #1

I'm going to be succinct as I can about this. I've been looking at some of the gps.conf files that some devs are sticking in their ROM releases or as a "BEST GPS FIX!!!11Eleventy" script modification. A lot of the information in these files is just plain WRONG WRONG WRONG! And here's why:

First, here is the most common "tweak" file you'll see, copied from XDA where it originated but has disseminated across the web picking up trash along the way:
DO NOT USE THIS, THIS IS AN EXAMPLE OF THE WRONG SETTINGS:
NTP_SERVER=[u]COUNTRY[/u].pool.ntp.org
NTP_SERVER=0.[u]COUNTRY[/u].pool.ntp.org
NTP_SERVER=1.[u]COUNTRY[/u].pool.ntp.org
NTP_SERVER=2.[u]COUNTRY[/u].pool.ntp.org
NTP_SERVER=3.[u]COUNTRY[/u].pool.ntp.org
NTP_SERVER=0.[u]REGION[/u].pool.ntp.org
NTP_SERVER=1.[u]REGION[/u].pool.ntp.org
NTP_SERVER=2.[u]REGION[/u].pool.ntp.org
NTP_SERVER=3.[u]REGION[/u].pool.ntp.org

XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra.bin
XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra.bin
XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra.bin

# DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info
# 4 - Debug, 5 - Verbose
DEBUG_LEVEL =0

# Intermediate position report, 1=enable, 0=disable
INTERMEDIATE_POS=0

# Accuracy threshold for intermediate positions
# less accurate positions are ignored, 0 for passing all positions
ACCURACY_THRES=0

# Report supl ref location as position, 1=enable, 0=disable
REPORT_POSITION_USE_SUPL_REFLOC=1

# Wiper (wifi positioning), 1=enable, 0=disable
ENABLE_WIPER=1

################################
##### AGPS server settings #####
################################

# FOR SUPL SUPPORT, set the following
SUPL_HOST=supl.google.com
SUPL_PORT=7276
SUPL_NO_SECURE_PORT=3425
SUPL_SECURE_PORT=7275
SUPL_TLS_HOST=FQDN
SUPL_TLS_CERT=/etc/SuplRootCert

# FOR C2K PDE SUPPORT, set the following
C2K_HOST=c2k.pde.com
C2K_PORT=1234

CURRENT_CARRIER=common
DEFAULT_AGPS_ENABLE=TRUE
DEFAULT_SSL_ENABLE=FALSE

# TRUE for "User Plane", FALSE for "Control Plane"
DEFAULT_USER_PLANE=TRUE

HERE'S WHY THIS IS WRONG
Starting from the top, there are too many servers. Some Devs even go as far as to copy basically every NTP server in the US/World (literally) and paste it into their config file. The problem is your phone tries to contact all these servers, and while the "*.pool.ntp.org" will (almost) never be down, there are some hosted by .edu or businesses that go defunct. The phone then waits... and waits... and waits... until it receives a notification that it couldn't connect to the server. Multiply that times fifteen or more and it's a bunch of useless connections hanging your phone. Having JUST the "North America" pool is enough, but if you insist then go to the regional level.
Need proof?
http://gitorious.org...onProvider.java
This is the code for how Android actually uses the gps.conf file. Look down near line 161. "How long to wait if we have a network error in NTP or XTRA downloading, current setting - 5 minutes" Sounds like the amount of time it takes for a "crappy" GPS to sync, right? Hmmm... And keep in mind, that's PER CONNECTION/PER SERVER you listed in the conf file.

Next, the SUPL_HOST. Now in this example it is actually set correct, though there are different values you may enter. Google seems to be the best. but Nokia also has their own (supl.nokia.com), Sony (supl.sonyericcson.com), T-Mobile's (10.176.29.225) and some others, I know Vodafone has one out there. You should also only have ONE SUPL_HOST server. Here is the garbage part; if you EVER see this:
SUPL_HOST=FQDN
Then it is (all together class!) WRONG WRONG WRONG!!! By it saying =FQDN, it's basically saying HOST=YOUR NAME HERE. FQDN stands for Fully Qualified Domain Name, meaning it's looking for a NAME to be actually PUT in that field. Because the code isn't hashed as an explanation line, it runs and tries to connect to "FQDN". So it's flagged to connect, but then fails because it has worse than a blank value in the field. It's like screaming "HEY YOU!" into a crowd of a billion people.
And how about that?? Look at our next field? SUPL_TLS_HOST=HEY YOU! Sigh...

For the SUPL_TLS_HOST, this is where the carrier specifics start coming into play. For T-Mobile, we should see "lbs .geo.t-mobile.com", and the value for the cert location is correct. Again, you should only have ONE server. If you have any problems still connecting, try leaving this line out entirely.

Next is the C2K PDE support. This one is a little tricky because it SEEMS legit (at least it has a name right?), but it's NOT. The first indicator to you that this is bogus is the port number "1234". Hmmm, I have that same number as the lock to my luggage...
Without going into boring detail, this variable is for testing the GPS antenna itself in a laboratory environment, and "c2k .pde.com" is NOT valid, but rather a value for the address for the testing equipment. If you REALLY want to go off on a tangent, go read this whitepaper by the company that makes the equipment in question. It's big, but it has pretty pictures!: https://dl.dropbox.c..._WhitePaper.pdf
Oh, and the owners of the "pde.com" site I'm sure are loving the influx of mobile traffic, but they do nothing with serving up the GenPop with A-GPS data. THIS FIELD SHOULD BE COMPLETELY DELETED OUT OF YOUR CONF FILE. YOU'RE NOT USING IT, YOU'RE NOT GOING TO USE IT. SAVE THE CHARACTERS.

As far as the SUPL_SECURE_PORT and SUPL_NO_SECURE_PORT, these are not in the default conf file, don't know where they came from, and you're better off just omitting them out of the config.

To come: A simple config file (with explanations) that brings quick lock times without all the garbage.
  • 7 Likes

karri0n

karri0n

Average Android

  • 2 posts

Posted 05 July 2012 - 05:50 AM #2

Great guide, thanks!
  • 0 Likes

OP WangChung

WangChung

Member

  • 34 posts

Posted 06 July 2012 - 12:43 AM #3

OK, some explanations of values that are more obscure...

INTERMEDIATE_POS - Intermediate position
Values are 1 for on, 0 for off
This will give a jumpoff location for giving a rough estimate of your location based off cell tower registration. For instance, let's say you live in Dallas and you're driving to Austin. You turn on your GPS mid trip, and the last time you had it on was back home. By default the Dallas location will be loaded, and if this is turned on when you first fire up Maps you should see the map rapidly zoom to an approximate location. This switch is used in conjunction with ACCURACY_THRES.

ACCURACY_THRES - Accuracy threshold
Values are numerical, 0 disables the switch
This value is measured in meters(need confirm?), and for the intermediate location you want a pretty large net. The intermediate position gets you a quick and dirty estimate of where you're at while the AGPS/Satellite location data is syncing, and pulls information off what towers you're registered to. A value of 5000 gives you a larger net than 3000, and while 5000 is less accurate the 3000 value will take longer to get you a position.

SUPL - Secure User Plane Location
- In reference to SUPL_HOST and SUPL_TLS_HOST
The values can either be in FQDN (www .blahblahblah.com) or a direct IP address. They are both ways of retrieving AGPS data, and while both methods are secure to prevent anyone tracking you** the difference lies in the source. SUPL_HOST can be any open server such as Google's or any network your phone can register to, SUPL_TLS requires a security certificate to connect to the site (hence, SUPL_Transport Layer Security). The downside to the SUPL_HOST is that the requests can get flooded or can go down, and with SUPL_TLS the certificates can expire (think expired security certs for webpages). All current information I can find says that only ONE of each SUPL location service is supported by Android.
Furthermore, in the field for SUPL_TLS_CERT you can't just arbitrarily input the value "SuplRootCert." There has to actually be a cert already there for the conf file to call upon. Some SUPL_TLS connections have multiple certificates such as seen in the MyTouch 4G (no slide). [Reference: https://code.google....009ed110a66f135 ]

**(save for state sponsored entities, but they usually use tower triangulation as it's much easier )

C2K_PDE
I'm going to be short on this, because bottom line your phone and 99.99999% of consumers will never use this. The only people that would are test engineers and they don't count as "consumers," so call it 100%. Basically what this is for is for testing the actual GPS antenna inside the phone, and it's a means for making a closed loop system for GPS satellite emulation. The server puts out a signal via its antenna, the phone picks up on the server's signal, then reports back to the server the values received. Using these values helps calculate signal strength, attenuation, and the capabilities of the GPS antenna inside the phone. Flat out - THIS DOES JACK SQUAT TO HELP YOU FIND OUT WHAT PART OF FRESNO YOU ARE IN. This entire field shouldn't be in your conf file at all.

ENABLE_WIPER - Enable WiFi positioning
Values 1 for on, 0 for off
From what I've been able to find, all recent releases of Android don't support this value well or at all (Gingerbread and up). I haven't had any success with it, but your mileage may vary.

SUPL_SECURE/NO_SECURE_PORT - What port the SUPL request goes through
Is actually a set of network ports set aside by IANA for this specific use. There are a couple for either TCP or UDP requests, but the values listed above (3425 for no secure, 7275 for secure) are accurate.

I'll update this as needed or if anyone has any questions on anything else. I'm not a Dev so all of this has been through internet and whitepaper research, if anyone has any corrections to what I have please cite a reference. Thanks!

Edited by WangChung, 06 July 2012 - 12:45 AM.

  • 2 Likes

OP WangChung

WangChung

Member

  • 34 posts

Posted 15 July 2012 - 10:12 PM #4

I've still been working on a good GPS.CONF file, I'm not sure if its the file itself or the GPS in my phone is just garbage. I'm thinking this phone just doesn't like AGPS. I'm going to try a file without any of the AGPS for a week and see how it goes.
  • 0 Likes

OP WangChung

WangChung

Member

  • 34 posts

Posted 20 January 2013 - 09:57 AM #5

**UPDATE**

Turns out the problem was with the version of the ROM I had. I was using one of Undead's ROMs which was based off the first release of the OEM ROM. This had poor firmware for the GPS radio to begin with, which was actually the main root of the issue. After updating to a more stable ROM (MikTouch 0.7) the same problems would still apply if you try to use that convoluted script up above. I moved over to XDA since it seems this place really fell off as far as support, but just came back to update since I saw someone IM me :scared:

Here's what you should have in your gps.conf:

NTP_SERVER=north-america.pool.ntp.org
XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra.bin
XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra.bin
XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra.bin
SUPL_HOST=10.176.29.225
SUPL_PORT=7275
SUPL_TLS_HOST=lbs.geo.t-mobile.com
SUPL_TLS_CERT=/etc/SuplRootCert
PHONE_TYPE=UMTS


You can see that the above script is greatly paired down, and of course you can adjust the parameters as needed. But this is really the basic setting you need.
Additionally now that the Google maps app supports offline/cached maps of large regions
, I get near instantaneous lock. Outside those cached regions it takes about 10 seconds for GPS lock.
You can switch out the proprietary "SUPL_HOST" for Google's if your phone is unlocked, works awesome too.
Moral of the story, don't use the 1st version of the ROM released with the phone or any ROM based on it. The best OEM-ish ROM available now that has at least some support is MikTouch.

/resolved :P

Edited by WangChung, 20 January 2013 - 09:57 AM.

  • 0 Likes

cowsquad

cowsquad

Super User

Posted 09 June 2013 - 07:10 AM #6

Awesome explanation

Sent from my Galaxy Nexus using Tapatalk 2
  • 0 Likes

larusa

larusa

Average Android

  • 1 posts

Posted 24 September 2013 - 06:38 AM #7

Hi there.

 

Just new to the forum, and almost new (to say the least) to Android!

 

Just found this INCREDIBLE thread and MARVELOUS work

 

**UPDATE**

Turns out the problem was with the version of the ROM I had. I was using one of Undead's ROMs which was based off the first release of the OEM ROM. This had poor firmware for the GPS radio to begin with, which was actually the main root of the issue. After updating to a more stable ROM (MikTouch 0.7) the same problems would still apply if you try to use that convoluted script up above. I moved over to XDA since it seems this place really fell off as far as support, but just came back to update since I saw someone IM me :scared:

Here's what you should have in your gps.conf:


You can see that the above script is greatly paired down, and of course you can adjust the parameters as needed. But this is really the basic setting you need.
Additionally now that the Google maps app supports offline/cached maps of large regions
, I get near instantaneous lock. Outside those cached regions it takes about 10 seconds for GPS lock.
You can switch out the proprietary "SUPL_HOST" for Google's if your phone is unlocked, works awesome too.
Moral of the story, don't use the 1st version of the ROM released with the phone or any ROM based on it. The best OEM-ish ROM available now that has at least some support is MikTouch.

/resolved :P

 

However I feel like I'm missing something. I have a THL W8s phone, however I cannot find any /etc/SuplRootCert ... this should be a file, right?

 

I checked http://blog.cryptomi...pl-google-com/

 

and followed those steps in my linux desktop to create the certificate, after which I copied it into /system/etc in the device. So...should that be all for this gps issue?

 

Thanks so much!

 

Edit: forgot to mention that I have no idea what to write for SUPL_TLS_HOST


Edited by larusa, 25 September 2013 - 06:00 AM.

  • 0 Likes

totembulls

totembulls

Average Android

Posted 15 March 2016 - 11:57 AM #8

Hello.

 

I am trying to use my old Galaxy N7000 as a dedicated GPS.

Since it will be offline 100% of the time (that is the idea), what would be the best gps.conf configuration?

Should I leave it blank?

 

I tried the different configs, but the device takes days to find the satellites.

 

Claudiano


  • 0 Likes