yashsingh1/xdaforums huggingface dataset:
[HD2 Android NAND Development] AngelDeath:
memin,

I thought the same way you do but as I said on my inspire 4g under location I do not have an agps setting, but yet I firmly believe the inspire is running as it should, its getting much faster locks then the hd2, and the way gps status acts is different as well as i stated. Since the Inspire is a DesireHD with sense, I'm using Raf's 4. and the menu is exactly the same, so I think the agps setting doesnt exist on sense versions, just in the driver.

I have been doing alot of digging, way too many hours, but I ran across something I have to do some testing on, If I can get gps status to show me the exact same thing or act the same way as it does in the inspire, I think it will work, but until I find that hidden needle in the hay stack, we have to deal with what we got.

I have so far crossed reference alot of the files in the /lib/ folder and so far found 3 references to the gps the same as in raf's rom, but not exactly the same, so still having a test phone still, I'll be fubar-ing that phone all day, going to probe the $h!t out of it :D

Keep you all posted.
[HD2 Android NAND Development] memin1857:
I have found a way to configure/reset gps settings in my samsung phone for testing. Many phones have lbstest.apk gpstest.apk gpstest2.apk but I was unable to launch them since they were hidden applications and trying to launch them from astro/appmanager resulted in "activity not found"

This is the way to launch them:

- Install launcher pro, activate it and go back to your original launcher.

- long press home screen and add a shortcut

- now you will see activities listed tap it.

- find gpssetup2.apk (or the apk you were uanble to run) tap it

- you will see list of activities. tap the first one and a shortcut will be created

- now you can launch gpssetup2.apk and use gps commands reset gps change settings etc.

Now I can make some tests with this samsung phone easier and try to find something for hd2

WARNING:

Putting such apk from another phone to your hd2 /system/app (even with permissions fixed) may make your hd2 unbootable. make sure you always have a cwm backup. If you cannot boot (cyanogen animation loop) then go to cwm, reflash your rom, clean cache and clean dalvik cache. it will boot now.

EDIT: LBStest.apk makes hd2 not boot, gpssetup2.apk won't show in activities list. I will do agps tests with the samsung phone for now.

EDIT 2:

Here is some information and findings with my tests with samsung agps.

GPS modes:

Standalone - GPS only without assistance

MS Based - MS means Mobile Station (your phone) it gets assistance data but calculates itself

MS Assisted - Again assistance but raw gps findings are uploaded to an external server to do calculations. (assuming external server has faster cpu)

There is also selection for User Plane (UP) and Control Plane (CP) for each of the above three modes. Also 2G and 3G settings for a total of 7 settings. (Standalone, UP MS Based, UP MS Assisted, 2G CP MS Based, 2G CP MS Assisted, 3G CP UE Based, 3G CP UE Assisted)

UE is User Equipment BTW, new name for MS

gpsone - qualcomms gps implementation

xtra - qualcomm's way of assisting its gps chipsets.

XTRA is not the same thing as agps it is just one way of doing assistance

XTRA is User Plane assistance for qualcomm gps. (sat data is downloaded using ip data connection)

There is also Control Plane assistance which gets assistance from GSM network (not data connection) 2G and 3G modes are available to select from. Operator/Service Provider may or may not be providing the service.

Cold start - GPS ignores previously learned values starts fresh

Warm start - GPS ignores satellites only but uses last position and almanac

Hot start - GPS uses all previously stored values, will only work within short time of last lock at the same place

So there is more than one way of agps implementation.

XTRA is not mandatory for AGPS to work

. When I tested MS Assisted, everytime gps is enabled, my data arrows worked a lot.
[HD2 Android NAND Development] arne182:
Checked libgps.so

I checked the code in the libgps.so and the xtra data is used when given.

When:

AGPS=http://xtra1.gpsonextra.net/xtra.bin

is added to system/etc/gps.conf. I have tested on HyperDroid-GBX-v11.0 in Germany. Downloads xtra.bin and locks in 10s. If you use a local copy you can get a lock in 5 seconds as it doesn't need to download the data. These are values of cold start/ first lock, outside.

I wanted to look at integrating some code that the satellites show before the lock is done but if the lock is done so fast it might only have its benefits inside where the signal is low.
[HD2 Android NAND Development] memin1857:
gps.conf

I investigated what samsungs gpssetup2.apk does and found out these:

When you change settings it updates secgps.conf file (which says it was generated by gpslocationprovider)

Here are some important codes that I found:

colored words are in the conf file

red words are the default or what I recommend

blue word are other options

Start Mode:

START_MODE=HOT

START_MODE=COLD

Position Mode:

option1 Standalone (no assistance)

POSITION_MODE=1

option2 UP (User Plane, meaning ip based assistance)

POSITION_MODE=7

option3 CP (Control Plane, meaning 2G or 3G based assistance)

POSITION_MODE=121

Session Type:

Latest Position

SESSION_TYPE=0

New Position

SESSION_TYPE=1

Tracking

SESSION_TYPE=2

Download

SESSION_TYPE=3

Operation Mode:

OPERATION_MODE=STANDALONE

OPERATION_MODE=MSBASED

OPERATION_MODE=MSASSISTED

ENABLE_XTRA=true

ENABLE_XTRA=false

I will try adding the lines I marked in red to my gps.conf file

I will also try and see if control plane assistance works or not.

You are welcome to try and post your results

Please also try DEFAULT_USER_PLANE=false (which makes it control plane and it seems agps may be working over gsm but I need more time to confirm it)

DEFAULT_AGPS_ENABLE=TRUE also would be a good try.

These are the other values for the conf file which I though were irrelevant, but not sure of course.

ENABLE_NMEA=false (this is some kind of logging I think)

USE_PCTOOL=0 (no idea)

SSL_TYPE=0 (this is for verisign thawte etc I think)

SSL=1 (enabling of disabling encryption I think)

SUPL_APN=false (I think if apn type in apn settings is set to default,supl it will be used for agps)

OPERATION_TEST_MODE=0 (don't know)

ACCURACY=100 (That means if accuracy is better then 100 meters it will be considered a lock/fix)

SERVER_MODE=0 (might be related to local server setting, or URL/IP selection, not sure)

DYNAMIC_ACCURACY ( maybe enabling a plus or minus value for accuracy)

AGPS_MODE=0 (might be important!)

LON_OFFSET=0.0 (I think it shifts your reported location for longitude)

ENABLE_LOCATION_SHIFT=false (Self explanatory)

ADDRESS_MODE=1 (URL, IPv4/IPv6 selection?)

TIME_BTW_FIX=1000 (this is one second)

USE_DEFAULT=true (don't know)

LAT_OFFSET=0.0 (I think it shifts your reported location for latitude)

DYNAMIC_ACCURACY_VALUE=50 (most likely this makes an accuracy between 51-149 accurate in this config)

SUPL_PORT=7276 (is 3245 when no ssl, and sometimes 7275)

TIMEOUT=255 (time to give up when no fix is made I think)

NUM_OF_FIX=999999999 (we'll never reach this value:) )

SUPL_HOST=supl.google.com (url of supl server, in this case; google)
[HD2 Android NAND Development] jaba_cz:
Hi all,

I'm not able to do deep inspection like you do :-)

Partly I do not know how, partly I have real work to do for my living :-)

But I did experiment with AGPS link in gps.conf.

My cleaned gps.conf is now:

NTP_SERVER=cz.pool.ntp.org
NTP_SERVER=0.cz.pool.ntp.org
NTP_SERVER=1.cz.pool.ntp.org
NTP_SERVER=2.cz.pool.ntp.org
NTP_SERVER=3.cz.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

AGPS=http://xtra1.gpsonextra.net/xtra.bin
AGPS=http://xtra2.gpsonextra.net/xtra.bin
AGPS=http://xtra3.gpsonextra.net/xtra.bin

INTERMEDIATE_POS=1
C2K_HOST=c2k.pde.com
C2K_PORT=1234
SUPL_HOST=FQDN
SUPL_HOST=lbs.geo.t-mobile.com
SUPL_HOST=supl.google.com
SUPL_PORT=7276
SUPL_SECURE_PORT=7275
SUPL_NO_SECURE_PORT=3425
SUPL_TLS_HOST=FQDN
SUPL_TLS_CERT=/etc/SuplRootCert
ACCURACY_THRES=5000
CURRENT_CARRIER=common
DEFAULT_AGPS_ENABLE=TRUE
DEFAULT_USER_PLANE=TRUE
REPORT_POSITION_USE_SUPL_REFLOC=1

I will use terms defined by this

I have no local xtra.bin file. Device was rebooted in the evening.

My device was without GPS from 10pm till 1pm next day, so it was about 15 hours.

First lock was in 1:20 ... assume this as cold start, locked for 15 minutes.

Next the device was without GPS for 1 hour.

Second lock was in 25s. ... maybe warm start? Locked for 10 minutes.

Next few locks were done at random with pause max 3 hours. Every attempt was ready in few seconds, or almost immediately. Hot starts?

So ... I do not know, what this method with xtra.bin linked via HTTP is doing inside the device. But to me it looks like, it works :-)

To be complete, I'm in Europe, Czech republic, HD2 EU version, HyperdroidGBX v11.
[HD2 Android NAND Development] charnsingh_online:
I dont know where this thread went from compiling official libs to GPS configs
[HD2 Android NAND Development] memin1857:
It's because these gps configs might be needed after official libs are properly compiled OR current libs might be looking for different text/value so it might just work without recompiling just with conf file editing.
[HD2 Android NAND Development] memin1857:
Does this work with your second hd2 with typhoon 2.8.x?

Do you think you could add code to let gps status report grey sat bars before lock? (just like my samsung phone does)

Which libgps.so did you checked? This one didn't seem to have it: http://gitorious.org/htc-hd2-android-libraries/libgps
[HD2 Android NAND Development] nick2k:
i'm having a problem: i can't seem to save the gps.conf file. i've used both Root Explorer and ES File Explorer (both free versions). they both give me errors saying it couldn't save the file. :(
[HD2 Android NAND Development] memin1857:
Is your /system mounted RW? (read-write) There should be a button on right right top corner of rootexplorer to mount RW. Note: /etc is actually under /system
[HD2 Android NAND Development] Mafioso:
Something is definitely wrong with the current gps libs, because I don't see any other android phones have a elaborate gps.conf which we have now for the HD2, yet their GPS works much better than HD2's...though I myself hope modifying gps.conf fixes these issues, but I have a feeling, the real fix will only come from fixing gps library besides there is one other issue, that signal bars don't come before the fix, I don't think that can be fixed with gps.conf
[HD2 Android NAND Development] AngelDeath:
That is interesting find, I have a couple fo questions though, 1) Which libgps.so did you test or look through? Meaning for what rom or build, and can you post it here? 2) Does it clearly state in the .so file: AGPS=http://xtra1.gpsonextra.net/xtra.bin? If so, then I am assuming the AGPS=/data/xtra.bin command I posted works just as well.

Some of these are very insteresting commands, but the question is how many of these actually are used in the .so files, adding commands that wont have a call from the .so file is useless, but interesting never the less.

Your 100% absolutely right. By all means, but also take into consideration that if the current .so files do work, but are just missing code lines that we can add to the gps.conf file to compensate for the lack of code, isnt that still development, and wouldnt that encourage the Dev's to use our findings to add the code to the .so file when a proper one is made instead of trying to feel around in the dark so to speak?

Obviously No Dis-Respect to ANY Dev on this forum, but before I decided to do all this, there was not a mention of this in any way, nor was this being looked at to fix or make work, As just as you said in your Request to Dev post, everyone is so focused on OC-ing, or things that are irrelevent that we should be focusing our efforts to make what doesnt work, work properly, and I respect you for that answer, for that is exactly how I feel. Again I am nowhere near your ranks (All Dev's), but even if I cant create a driver or a library, or compile a kernel, I am still doing what we all here are doing, and thats helping one another, finding solutions to make things work, and "developing".

To add to the above post, also you need to make sure your rooted.
[HD2 Android NAND Development] AngelDeath:
Your right, one thing I noticed with the HD2 GPS is that when you run gps status it takes close to 3 seconds for the icon to appear in the notification bar on top, and when you close gps status it takes near another 3 seconds to turn off, Native android phones gps turn on as soon as you hit gps status, and shut off as soon as you back out of it. Also as I said, using the inspire as a base, if you run gps status on the inspire on the right it immediately pops up with 0/4 or 0/8 (etc) shwoing you it knows how many sats from before, as its locking, which shows that it knows and is stored where the sats were. We dont have that in the HD2, another thing I noticed in the Gps Status, which anyone that can look thru the libraries can help, in the inspire when you run the gps status and after it locks to the sats there is another set of lines that appear that I have yet to see and never seen on the HD2 gps status screen.

They are: DOP, VDOP, HDOP this doesnt appear on the HD2 when it locks, and believe its a driver/library issue, I know what the Abbrevation stands for, but the lack of it being on the gps status when run on the HD2 tells me that might be the driver/library we need to look at, that has that info in it.
[HD2 Android NAND Development] lukesan:
I wonder if there is a NMEA logger for Android so we can actually see if data comes out of the receiver before it has a lock.
[HD2 Android NAND Development] Mafioso:
Though I don't have any other Android phone but i recall in WinMo HD2 used to do that..there is application GPSTest in WinMo which show GPS Signal bars. Immediately when it opens it shows numbers like 02 04 12 22 under each bar...each representing a satellite...if there is no signal for like 5-10sec, the entire set of number's change...and it keeps on happening till you start getting a signal...I don't what the number means but i'm guessing could be GPS channels? It has information which set of channel's to listen to and it does an iteration on these set, till it start getting a signal..probably from AGPS data..

But that only happens if you have a fresh QuickGPS download, for old(> 3-4days) or expired data this process doesn't happen...

Also one other thing I noticed with HD2 GPS in Android over WinMo, is hotfix is valid in WinMo for a lot longer. I'm saying like if I get a fix at one place and after travelling 6-7 miles..under winmo it will treat it like a hotfix, it fixes immediately (< 5 sec) while in Android it takes lot of time again to do it...
[HD2 Android NAND Development] AngelDeath:
Dont you mean data going to the chip before the lock? Because the receiver would need the info to make the lock, so it would be more so to see if the information is being read/injected to the chip to reduce lock times.

I'm going to be updating My Thread in the Q&A with the new info, and links to make things easy as to not clutter questions here, so please any questions refer them to the other thread. Thanks.
[HD2 Android NAND Development] AngelDeath:
Well first the numbers that follow the sats could very well be their "ID", which yes does work that way in WinMo and Native Android. The x/x im talking about is the in the inspire as soon as I run it it will tell me 0/8 which means it knows there is 8 sats, but isnt locked to any of them, 3 seconds later they lock, HD2 doesnt even show that info when you turn it on, you dont see anything until a lock.

And the reason why it locks that fast is cause it is doing a hot lock, 5-6miles is really nothing, if you think about it, the sats being that far in space 5-6 miles is like spreading your feet over 3sqft part of the sidewalk, from line to line.
[HD2 Android NAND Development] arne182:
Will test it tomorrow. Initial tests without SIM card was unsuccessful. I know the SIM does play an important roll in telling the approximate location.

1. URL above:

I cloned a copied of our libgps.so

https://gitorious.org/~arne182/htc-hd2-android-libraries/arne182s-libgps/blobs/master/leo-gps-rpc.c

Will see if I can't get it right to add some pre lock sats.

2. Clearly: No. But the calculation for xtra data is in there

int pdsm_client_xtra_reg(struct CLIENT *clnt, int client, int val0, int val1, int val2, int val3, int val4)

Your assumption that /data/xtra.bin works but only if you use the apk and have it download before using the GPS. This is problematic because the apk file doesn't stay open and redownload the xtra.bin. I prefer to have the GPS program download it off the net. It is only 50 odd kb.

Having AGPS=

is the key to getting the AGPS to work.

Will update tomorrow if it works on typhoon's build. Need some sleep now.
[HD2 Android NAND Development] Mafioso:
Ohh got confused thanks for clearing that up..

Yes I was kinda referring to that only, within 5-6 miles should be a hot fix, but in Android it takes as much time as a cold fix for some reason even after using you're modfied gps.conf..
[HD2 Android NAND Development] pyrorob:
heres an interesting thread about getting agps working on the samsung captivate, http://xdaforums.com/showthread.php?t=789383

its fairly interesting at the bottom where he describes the diffrent types of agps.. i know its not for this device but, any info's handy right?
[HD2 Android NAND Development] nick2k:
the /system/etc is showing that it is mounted r/w.

i just checked with a terminal emulator and it says my phone is indeed "rooted" (#).

UPDATE: i got it to work finally. i bought 'Root Explorer' and used that program to edit the gps.conf file.

RESULTS: using AngelDeath's USA South West v1.1 script and editing the gps.conf file to recogize the new xtra.bin file, first cold start GPS lock happened in a minute (indoors). every other lock took 3-5 seconds tops (inside). i can't test it outside while driving because i just killed a 6 pack of guinness. BEFORE the script & file edit, cold start lock would take about 10 minutes or so.

thanks! :D
[HD2 Android NAND Development] memin1857:
That is exactly the case with my samsung android phone. gps icon comes on instantly and goes off instantly. According to http://en.wikipedia.org/wiki/Dilution_of_precision_(GPS) DOP VDOP HDOP are accuracy levels. Mine does not seperately report vertical and horizontal dop but I again instantly see like 0/8 sats on initial start with grey signal bars (which become green after lock)

I agree, it seems hd2 android (or specifically gps lib) seems to always do cold or warm start but no hot start even when possible. My samsung android phone almost fixes immediately everytime.
[HD2 Android NAND Development] D4rk50ul:
Ok folks I have been working on getting our GPS working better and have modified the gps.conf file to hopefully result in better accuracy and faster lock times. If you could help me test I'd appreciate it. I enabled WI-FI locating to speed up the lock, so turning on WIFI will increase lock speeds even further. Remember this is a work in progress and some flags may not be needed.

Instructions

1. Copy my version here GPS.CONF and replace the your current /system/etc/gps.conf text with it. Change "us" to your country of origin such as "europe" in the first 4 lines.

2. Reboot your system.

3. Download GPS Status and Toolbox from the market

4. Open GPS Status and click menu. Goto Tools and Reset GPS then Download AGPS assistance.

5. Check how long it takes to get a cold lock, then go to any gps enabled app and test its locking speed and accuracy.

Please provide feedback.

Thanks to the HyperDroid team for testing this for me to hopefully come to a solution for our less than stellar GPS performance.
[HD2 Android NAND Development] memin1857:
From your conf file

ACCURACY_THRES=2000

SMART_MODE=WARM

Are these typos?

Should they be like this?

ACCURACY_THRESHOLD=2000

START_MODE=WARM

For everyone: You shouldn't use Windows XP/Vista/7 to edit your gps.conf file because linux text files have different special character at the end of every line. A windows edited/saved conf file causes problems in Android. It is best to edit gps.conf right in your phone with rootexplorer
[HD2 Android NAND Development] memin1857:
In my side by side testings I saw that my samsung phone reported a lock when accuracy was below 100 and when first lock happened accuracy in meters in gps status was like 32. Then in some time it drops to 6-4

But when HD2 gets a lock the first accuracy seen in gps status is below 4.

Maybe HD2 is ignoring accuracy threshold values and waits till it gets a very accurate lock and doesn't report a lock when accuracy is 10-20-30?
[HD2 Android NAND Development] D4rk50ul:
Hang on I might have grabbed the wrong file.. so many versions.. it should be START_MODE=WARM

The accuracy seems that the string is correct.

I will update the link thanks for catching that my brain is mushy from trying all these flags.

You should notice the AGPS data being stored and you will also be able to see a lot of satellites. If you quit the GPS status program and go back in, it should have stored the sats so it doesn't cold start every time. This is very experimental and I'm sure someone with more knowledge can fine tune it further.
[HD2 Android NAND Development] memin1857:
OK

BTW when

ACCURACY_THRES=0

all positions are supposed to be reported regardless of accuracy value.

But accuracy_thresh is the threshold for intermediate positions only I think.
[HD2 Android NAND Development] memin1857:
The link has wrong info about agps. It confuses agps with rough location service. jupiter.xml also doesn't exist with my samsung or hd2 phone.

BUT there is the following info that might prove useful (I changed the paths to match hd2)

These commands should be entered to terminal emulator (it doesn't work, read on)

su

cd /data/data/com.android.providers.settings

sqlite3 settings.db

update secure set value="1" where name = "assisted_gps_enabled";

.quit

reboot

I think this is the same thing as setting agps enabled from location menu but that menu option is not available with hd2 android.

It does give an error stating no such table: secure

I looked into settings.db bile with a sqlite editor available from the market and indeed table "secure" was empty. This might be a way to hack enable agps for hd2.
[HD2 Android NAND Development] D4rk50ul:
Tweak it all you can I dont want credit for it I want native gps performance. I posted here so greater minds can improve it. Im trying to figure out the string to enable skyhook..

Possibly something like

SKYHOOK_ENABLE=TRUE
[HD2 Android NAND Development] memin1857:
I got this info from a friend who got it from some forum:

The methods of handling with a-gps, like downloading/clearing agps data is out of the standard android sdk.

Having a look at locationmanager class:

http://gitorious.org/android-eeepc/...id/internal/location/GpsLocationProvider.java

GPS-Status is doing the same for clearing/downloading agps data:

clearing:

boolean bool1 = ((LocationManager)paramContext.getSystemService("l ocation")).sendExtraCommand("gps", "delete_aiding_data", null);

downloading apgs data (xtra.bin): (injecting its data to gps lib)

boolean bool1 = localLocationManager.sendExtraCommand("gps", "force_xtra_injection", localBundle);

boolean bool2 = localLocationManager.sendExtraCommand("gps", "force_time_injection", localBundle);

Since gps status doesn't seem to do anything in gingerbread when I click reset or download there must something missing in our gps lib so that it does not work with the above code that was taken from the gps status apk. With froyo gps status doesn't complain about connection availability but agps still doesn't work.

Maybe the extra commands don't reach the gps chip.