As explained in an earlier post my HTC Wildfire phone is now running Cyanogenmod version 7.2.0 for Wildfire (Buzz). The phone is pretty snappy with this image. I have not even felt the need for "Google Apps" except for those parts that are connected with Google Maps (primarily NetworkLocator and Maps but also some support files for these).
However, after installing Maps, I noticed that it was not able to get a tight fix on my location. (Note that Maps also gets a "loose" fix by getting the co-ordinates of the nearest cell tower using the NetworkLocator.) Searching the web turns up thousands of "GPS fix" therapies from all kinds of places.
In earlier experiments, I had been wary of "brick"ing my phone. Now that it is working so well, I am doubly so! Hence, any solution which seemed to be reversible was acceptable and those which were not, were not. Solutions that involved software changes alone would appear to be reversible. Hence, I tried:
- Making changes to
/system/etc/gps.conf, such as putting in
in.pool.ntp.orgin place of a European NTP server, or removing the SUPL entries etc. (All these changes were made after making a backup of this file and noting its exact permissions of course!)
- Installing the GPSStatus application for Android and using it to reset the GPS internal state and download a-GPS data from the net.
- Re-installing the earlier HTC "stock" version of Android from backup, then reset-ting GPS internal state and finally booting back to Cyanogenmod 7.2.0
- Powering down, removing and re-inserting the battery. Clearing the cache from recovery.
All of these resulted in the following experience:
- Immediately after cold-start (power-off, battery removal and re-insert and reboot), the GPS fix would be done in seconds.
- About a minute or so later this GPS fix would be lost.
- In a completely un-predictable way, the GPS fix would be re-gained at different times and places only to be lost in a minute or so again!
One solution suggested in various places was to re-flash the radio. However, given the equally large number of warnings about "brick"ed phones due to radio flashing, I was unwilling to give it a go. Moreover, the current radio on the phone is "18.104.22.168H_22.214.171.124" which appears to be the latest (and last!) version for this model.
Finally, I came across
a suggestion (see the fourth entry under Modifications to the
System) that the file
/system/lib/libgps.so from an
earlier build (Froyo?) would fix the problem. Now, the file
/system/lib/libgps.so on Cyanogenmod 7.2.0 is actually the same
as that on the HTC stock image that was backed-up from my phone.
So, I was a bit disbelieving, but the change was easy and
reversible, so why not?
So I downloaded the
Wild Ginger ROM by following a link on the same page and
extracted the 96Kb file (from a 70Mb download ;-)). I then installed
this file in place of the default
/system/lib/libgps.so. Reboot the phone and GPS is
working stably for 10 minutes! Go indoors for 5 minutes come back
out and its back again!
Now a hacker cannot just let this go! So what would happen if
I put back the CM-7.2.0 version of
/system/lib/libgps.so? Surprisingly, the GPS
continued to be stable! Perhaps there was something in the
volatile memory, so do a cold-restart (power-off, re-insert
battery and boot). Still stable! Wipe out the "Dalvik cache", the
GPS loses its compass and pitch-roll settings. However, the
wonderful GPSStatus can be used to fix that. Sure enough, once
those are fixed, GPS is back to being stable again!
This feels like blackmagic! The software running on the phone is the same as before, but GPS which was not working earlier is working now. The indication seems to be that the older (HTC Froyo) library managed to "kickstart" the GPS somehow. Perhaps the downloading and injection of aGPS data into the GPS sensor was not working with the newer library. Perhaps there was some flag that needed to be reset.
So a lot of questions remain and at this point it just looks like blackmagic. In summary, I am now running the same software that I was running earlier --- even the firmware has not (as far as I can see) been changed. By some sort of "blackmagic" GPS is now working!