[G2 and Desire Z General] kusuriurikun:
I have noticed that there has been an ongoing issue with GPS in a number of stock ROMs deriving their driver code from the main Google branch (rather than HTC's stock drivers); I'll summarise the issue I've found in particular, and hopefully folks can come to a resolution of sorts.

Firstly, a bit of backgrounder--Android actually uses two different methods of reading GPS data and passing it along from satellites to applications. Some apps (notably, Google Navigation) can have "raw" data passed along via an API introduced in Gingerbread; others (including a lot of third-party GPS tools) read via "NMEA sentences", an open standard for GPS-enabled devices to receive and pass along data. (If a third-party GPS tool has been ported to multiple operating systems, it's almost a guarantee it uses NMEA sentences for its GPS data.)

An NMEA sentence starts with the time (in UTC), the satellite number, and then a string beginning with $GP<foo>, a mess of comma-delimited numbers and letters after, and then ending with a number or letter, an asterisk, and another number. This gobbeldygook basycally states "Hey, here's the sat, here's the ephemerides tables so we know where other sats are, here's where I am in the sky" and some other technical data. (If people want the gory details, including what NMEA sentences should look like, http://www.gpsinformation.org/dale/nmea.htm has info and examples.)

Normal stock ROMs (including rooted and de-odexed stock ROMs) WILL show these NMEA sentences with an appropriately intelligent GPS tool; there are two good and free apps on the Android Market that show this (Turbo GPS, ad-supported but free: https://market.android.com/details?id=com.turboirc.tgps.v2 and u-center GPS which is completely free: https://market.android.com/details?id=com.ublox.ucenter); the latter is explicitly designed as a GPS testing tool.

What I discovered with a number of third-party ROMs (that either have issues with some programs picking up a GPS sync at all, or which have issues with wildly varying GPS locks in the range of 10-50m) is that these particular third-party ROMs are NOT passing along NMEA sentences. The one issue these ROMs do have in common is that they are Gingerbread v2.3.5 ROMs apparently using Google's stock driver code.

These cause a number of symptoms including slow lock or failure to lock (occasionally Google Maps fails to lock or locks very slowly, CoPilot Live v8 typically never gets a lock or only does so very slowly, other apps may not get a solid lock and have wildly varying GPS fixes). Troubleshooting with u-center GPS shows no NMEA data is being passed; typically EFS wipe does NOT fix the issue, nor does download of AGPS data (with the Chartcross GPS Test or GPS Status tools).

Another tool (Aspara) along with some weirdness in Turbo GPS (lots and lots of blank NMEA messages) and logcat.txt with CyanogenMod ROMs indicate what's really going on--it is passing along NMEA sentences, but with all the important bits (all the stuff from $GP<foo> onward) redacted--so all GPS programs on Android have to work with is the UTC date and the GPS's own numerical identification. Sometimes they can work with this...sometimes, not so much.

At any rate, something's broken.

I have investigated the issue in the following ROMs (with the use of SuperWipe between ROMs, which wipes system/data/EFS) with the latest radio known to behave reliably on T-Mobile US (Vision_Radio_12.56.60.25_26.10.04.03). Here's what's known to have the issue and what's behaving right...unfortunately, from what I can tell, all v2.3.5 ROMs at the moment are hosed save possibly for Sense-based ROMs...

ROMs KNOWN TO BE AFFECTED:

CYANOGENMOD AND VARIANTS:

CyanogenMod nightlies since at least v.118 and possibly since v.43

XBoarderMod v3.0.0 (AOSP/CyanogenMod hybrid, apparently uses the problematic driver)

ILWT CM7, all known versions (CyanogenMod base with a few customisations, uses the problematic driver)

MeXDroid GhostChili (all versions)

CyanogenMod v7.1.0-RC1 (ROM has known GPS issues in general; as similar issues have been reported this has been reported to the CyanogenMod bug tracker)

Very likely all ROMs based on a release-candidate or nightly build of Cyanogenmod

MIUI AND VARIANTS:

MIUI Bulletproof v1.9.9 (v.2.3.5, apparently uses the problematic driver)

Possibly all versions of MIUI if they use the same driver

ROMS KNOWN NOT TO BE AFFECTED:

Stock T-Mobile G2 ROMs, de-odexed and rooted (all ROMs explicitly "stock" known to work, including G2-Bliss)

Virtuous G-Lite (v2.3.3 ROM, does receive NMEA sentences normally)

Stock HTC-WWE Sense-based ROMs (v.2.3.3 and up, do receive NMEA sentences normally--it's largely the Sense-based ROMs that are the basis for the gps.vision.so swap fix)

ROMS LIKELY UNAFFECTED:

Sense-based ROMs in general that have been customised, unless they use substantial bits of AOSP radio drivers (most are pretty much Sense tweaked for HTC Desire Z; would appreciate reports from people using custom Sense ROMs based on Sense 3.0 or 3.5).

This appears to be a general GPS driver bug with ALL Gingerbread AOSP roms at this point that extends all the way back to the earliest Gingerbread-based builds of CyanogenMod and MIUI; PLEASE star up issue 15500 on the main Android tracker (http://code.google.com/p/android/issues/detail?id=15500) and issue 3346 on the CyanogenMod tracker (http://code.google.com/p/cyanogenmod/issues/detail?id=3346) so that the bug fix is prioritised.

People may also wish to lobby HTC to share their fix with the community (which they're technically SUPPOSED to be doing under GPL; it's fairly obvious they patched the bug with NMEA sentences in their Gingerbread versions).

At least one person on the Cyanogenmod forums has reported the issue is fixed with a replacement of /system/lib/hw/gps.vision.so with the stock library file (available at http://www.multiupload.com/O6ZFH4YR5F and attached below) from the T-Mobile G2 OTA update (http://forum.cyanogenmod.com/topic/...obscure-gps-driver-bug-in-at-least-nightlies/) which STRONGLY indicates a bug in gps.vision.so.

Recommended radios to use this fix with are as follows:

KNOWN WORKING COMBOS:

26.10.04.03 (latest international ROM, is known to work, use 10.04.03 gps.vision.so)

26.10.04.12 (Latest available radio for the Vision from Bell Mobility Canada, this DOES work with 10.04.03 gps.vision.so)

26.13.04.19 (Latest available radio for T-Mobile G2, is known to work, use either 10.04.03 gps.vision.so or (upcoming) 13.04.19 gps.vision.so (already available with ILWT CM7 nightlies))

POSSIBLY WORKING (mostly older radios):

Very likely most HTC-WWE ROMs with internal version 2.42.xx (Sense ROMs)

26.08.04.30 with 10.04.03 gps.vision.so (Multiple reports now this is working; if this fails, try 26.13.04.19 radio which is newer.)

VARIED REPORTS (not recommended at this time):

26.08.04.30 with its own gps.vision.so (some reports this works, others report this breaks GPS particularly if matched with its gps.vision.so; this is an older radio and may not be so compatible with v2.3.5; due to release of a new radio from T-Mobile users of this radio are recommended to use the new 26.13.04.19 radio if this gives issues)

KNOWN NOT WORKING/NOT RECOMMENDED:

26.03.02.06 (this is the old Froyo G2 radio, but is used by quite a lot of folks using the G2 in T-Mobile US territory with CyanogenMod and stock GPS; does not work with either Gingerbread gps.vision.so in CM7 builds and is likely an incompatible radio for modern gps.vision.so/AOSP ROM combos)

ACTIVELY SEEKING REPORTS:

There have been some reports from posters that the newest T-Mobile radio (26.13.04.19) combined with stock CM7 nightlies may have fully functional GPS. I haven't yet tried this, but if folks are willing to do so before applying the "GPS libraries patch" and who are or will be using the new T-Mobile radio--if you could report the following:

a) Which particular CM7 nightly you are using.

b) Results on whether NMEA is being passed with Turbo GPS or u-center Evaluation (both available for free in the Android Market)

If it turns out the latest nightlies + new radio don't need the fix, this would be awesome and win, but again, this is an area where volunteers are needed. :D

INSTRUCTIONS (REVISED 24 OCTOBER 2011):

Special note to ILWT CM7 ROM users: If you are using a version of ILWT CM7 v212b and up, you can now select the option to use the appropriate gps.vision.so instead of stock CM7 gps.vision.so by adding/uncommenting the option "gpslib=htc" in ILWT.txt (the install script will automatch the appropriate gps.vision.so to each radio). If you are changing radios or libs, be sure to EFS wipe first. Thanks to tsubus for being the first to implement this in a third-party ROM.

Support for the new T-Mobile radio (26.13.04.19) begins with ILWT CM7 only from version v238 and up, but (personal verification) works flawlessly. If you're using an older version of ILWT CM7, you'll want to follow the procedure below if you use the new T-Mobile radio or upgrade ILWT CM7.

For non-ILWT CM7 ROM users, the procedure is now less painful.

Of note, following these instructions will be much easier with the new 4EXT recovery but can be done with CWM recovery--it's just easier to do the necessary steps without repetitively rebooting. :D

a) If you have not done so already, flash a known working radio to your phone using the usual instructions for flashing a new radio. (I recommend one of the three above radios UNLESS you are experimenting with a new radio/gps.vision.so combo and reporting the results.)

b) Reboot, rename pc10img.zip, copy one of the update files below AND the Vision EFS Wipe tool (and optionally, the latest RIL automatcher zip) to the root of your SD card, then reboot into recovery.

c) Select "Install from zip", select the Vision EFS Wipe tool, let it run.

d) Do the same thing, only with the updater file you selected.

e) (OPTIONAL) Mount /system if you're running CM7, then select "install from zip", select the RIL automatcher, let it run. (RIL matching is NOT essential with this; I've run with and without, and wouldn't recommend matching JUST to install an alternate gps.vision.so--only if you're having general radio performance issues.)

f) Select "Install from zip", select the Vision EFS Wipe Tool, let it run (probably only REALLY necessary if you're matching RILs at the same time).

g) Reboot. Use your favourite GPS tool (I personally like the free Chartcross GPS Test tool on the Market) to get an initial fix. This will take approximately 45-60 seconds indoors, faster if you're outside and it's sunny.

IF THINGS GO SIDEWAYS AND THIS BREAKS YOUR GPS:

a) Don't panic.

b) Copy the gps.vision.CM7-fallback.zip to your SD card root. Follow the steps from b)-g) in that first section, and that should restore GPS functionality.

c) So we can know which ROM/gps.vision.so/kernel/radio combos are no-go, please submit to this thread the following info:

1) The fact it went sideways.

2) The particular third-party ROM you are using (CM7 nightlies, MIUI.us, etc.).

3) The particular radio you are using (08.04.30, 12.04.03, etc.)

4) If you are NOT using the stock kernel, which kernel you're using (Pershoot, ILWT/Umaro/etc.).

(Yes, kernels CAN cause differences in performance in drivers. For example, most third-party kernels in pure stock ROMs tend to break WIFI because there's JUST enough difference in how the drivers talk to the kernel that things hiccup. There's a non-negligible chance that different radio/gps.vision.so combos may work better for particular third-party kernels.)

Also, if you're using a radio/gps.vision.so combo I've NOT listed here (particularly if you are using a radio from a pre-Gingerbread ROM), let folks know what works and what doesn't.