[Mogul, XV6800 ROM Development] Skywing:
Adapter program to enable assisted GPS on the Verizon xv6800 "MR1" (WM 6.1) ROM

I've written up a program that will enable the use of assisted GPS on the MR1 Verizon ROM. This may be of use to you if you do not want to use a custom ROM, -or- you cannot get GPS working on a custom ROM.

Note: This method does not currently work on dcd's releases. My code has only been verified to work on the Verizion MR1 ROM. I believe this is because the Sprint GPS intermediate driver does not support the DRM/locked down GPS functionality required to talk to gpsOne once the firmware has been programmed for locked down GPS mode.

You can always flash back to MR1 from a custom ROM. If you already have GPS working on your custom ROM, this is probably not necessary, and you should keep your existing ROM.

A cab installer (courtsey of gc14) can be found here: http://xdaforums.com/attachment.php?attachmentid=111774&d=1220913180. Note that due to a bug in the .cab file, you cannot automatically uninstall the cab, but you can just manually delete the files that it installs (see below to discover which files those include).

Otherwise, you can manually install the program, as detailed below.

The installation of my GPS adapter is a bit complicated right now, and this is a fairly beta release. I have only tested it with Google Maps. However, it should work with any GPS-enabled program that can use the standard GPSAPI.dll functions.

Note that your GPS program must be configured to use Windows-managed GPS and not an explicit COM port. My adapter module does not support the NMEA serial interface, only the "cooked" GPSAPI.dll interface. Notably, the HTC GPC Test program uses the NMEA COM port interface, and will not work with the GPS adapter.

The GPS adapter system consists of several parts under the hood:

- gpssrv.exe, a program that I wrote which understands how to decrypt GPS data from the chipset when it is operating in locked down GPS mode. This program acts as an intermediary server, through which all GPS clients can indirectly access location information.

- gpsapi.dll, a replacement for the OS-level gpsapi.dll. The replacement DLL communicates with gpssrv.exe to retrieve positioning information. This model allows multiple programs to receive GPS data at the same time, as the locked down GPS interface only supports one concurrent user.

- oemgpsOne.dll, a modified version of the Verizon oemgpsOne.dll module for communicating with the gpsOne chipset driver.

- stdgps.dll, a copy of the standard OS gpsapi.dll. Due to limitations in Windows CE, this needs to have a different name than the replacement gpsap.dll. It is otherwise identical to the shipping version of gpsapi.dll.

To install the GPS adapter, you should grab the program files at the following URL:

http://www.nynaeve.net/Skywing/xv6800gps/gpsserver.zip

Currently, there's no CAB installer, so all of the installation must be done manually. Sorry. A CAB may come later on, if someone feels like doing the work to build one for me.

After extracting the zip onto your device, follow these instructions:

1. Create a "\Program Files\GPSServer" directory on your device.

2. Copy gpssrv.exe, oemgpsOne.dll, and stdgps.dll to "\Program Files\GPSServer".

3. Copy gpsapi.dll into the directory where your GPS program resides. For example, "\Program Files\GoogleMaps".

Optionally, you can copy gpsapi.dll to your \Windows directory instead of the directory for the main .exe of your chosen GPS application. This may be more reliable, as if something loads the Windows-supplied gpsapi.dll before the custom gpsapi.dll, things will break. Doing this is slightly more complicated.

To (optionally) copy the new gpsapi.dll to your \Windows directory, you may use these steps:

1. Rename gpsapi.dll to something else (e.g. "gpsapix.dll").

2. Copy the renamed gpsapi.dll to \Windows

3. Rename the renamed gpsapi.dll in \Windows back to gpsapi.dll.

The renaming juggling is necessary as File Explorer will otherwise refuse to supersede an XIP ROM file. You can simply delete \Windows\gpsapi.dll after doing these steps to revert back to the standard Windows gpsapi.dll, without having to hard reset your device, although this will again break GPS for you.

After that, you should be able to start your GPS program (e.g. Google Maps) and receive location data. Note that being inside in a shielded location may impede the process of acquiring a GPS fix. Also, to gain the benefit of assisted GPS mode, you need to have an active cell data connection, and you should not be connected to ActiveSync or Wi-Fi.

There are some registry settings that you can create on the device to tweak how the GPS adapter functions:

REG_SZ HKEY_LOCAL_MACHINE\Software\Valhalla Legends\GPSServer\ServerPath = "Path to gpssrv.exe". Defaults to "\Program Files\GPSServer\gpssrv.exe" if not set.

REG_DWORD HKEY_LOCAL_MACHINE\Software\Valhalla Legends\GPSServer\AllowDeviceStateChange = 0/1. Defaults to 0 if not set. If set to 1, then gpsapi.dll will send device state change notifications to your GPS program. Some programs appear to have buggy GPS handling (Google Maps in particular), and will break if this option is set.

REG_DWORD HKEY_LOCAL_MACHINE\Software\Valhalla Legends\GPSServer\PDEAddress = IP address of the PDE to use. Defaults to 0x845FAE42.

REG_DWORD HKEY_LOCAL_MACHINE\Software\Valhalla Legends\GPSServer\PDEPort = Port number for the PDE. Defaults to 8888.

REG_DWORD HKEY_LOCAL_MACHINE\Software\Valhalla Legends\GPSServer\Mode = gpsOne mode to set. Defaults to 2.

REG_DWORD HKEY_LOCAL_MACHINE\Software\Valhalla Legends\GPSServer\QoSAccuracy = Relative fix accuracy requested. Defaults to 64. (Max of 255, higher values request a more accurate fix, but this may increase the time to acquire a fix.)

REG_DWORD HKEY_LOCAL_MACHINE\Software\Valhalla Legends\GPSServer\QoSPerformance = QoS performance flag. Defaults to 10. As to what effect this has on the gpsOne chipset, I'm not entirely certain yet. Debugging reveals that the value internally is called the QoS performance value, hence the name. The meaning of this value is likely buried in some gpsOne technical document that I have not found yet.

REG_DWORD HKEY_LOCAL_MACHINE\Software\Valhalla Legends\GPSServer\FixInterval = Time, in milliseconds, between requests to the gpsOne chipset for an updated GPS fix. Defaults to 1000.

The default values should work fine, so you don't need to bother with the registry values unless you really want to. Most of the defaults were gathered by researching the settings that VZ Navigator uses internally.

---

Program compatibility list:

---

-

Only programs that use GPSAPI.dll and not a COM port will work with the adapter

. Most GPS programs will support using GPSAPI.dll.

- Google Maps will function if you configure it such that the GPS setting is set to "Managed by Windows". This is the default setting. Also, remember to check "Use GPS" in the menu when you start Google Maps, in order to enable GPS inside of Google Maps.

- Live Search will function if you configure it such that the GPS setting is set to "GPS Intermediate Driver". This is the default setting.

- HTC GPS Tool will not work properly, as it can only use a COM port.

- If you want to use VZ Navigator after having installed the GPS adapter, then you need to place oemgpsOne.dll and stdgps.dll in \Windows.

---

Other notes:

- The GPS adater does not enable free use of VZ Navigator. It only allows third party programs that are designed to talk to the standard Windows Mobile GPSAPI.dll interface to operate on the xv6800 MR1 ROM.

- You do not need to manually start gpssrv.exe. When a program loads the custom gpsapi.dll and requests a position fix, gpssrv.exe will be automatically started on demand to power up the gpsOne hardware and start acquiring position data. It will automatically turn off the gpsOne hardware and exit on its own 60 seconds after there are no programs open that are still requesting a GPS fix.

---

Troubleshooting:

Here are some steps that you can take if you are having problems getting things to work.

1) Make sure that you're on the Verizion MR1 ROM and not a third party custom ROM, or the original release Verizion ROM.

2) Make sure that your Location setting is set to "LOCATION ON" and not "911 ONLY" in your Phone > Services > Location settings.

3) Make sure that your GPS program is configured to use Windows-managed GPS or "GPS Intermediate Driver", and not a specific COM port.

4) Give the following test program a try, to verify that GPS is working in general. The test program does not require the GPS adapter to run. If the test program can receive GPS data, then either the GPS adapter program is not installed correctly, or your GPS-enabled application is not configured properly. If the test program cannot receive GPS data, then you have a different problem (perhaps your location option is still set to 911 only?). Test program link: http://www.nynaeve.net/Skywing/xv6800gps/gpstest.zip