PDA

View Full Version : GPS and Suspend


Baffles
23rd March 2008, 09:00 AM
I'm working on my code to keep GPS alive (today screen plugin, dunno if anyone ever posted it here but it's over at ppcgeeks). Turns out the qualcomm driver for the GPS in the Mogul crashes if the device goes to sleep when there is an open handle to the GPS device.

I did some quick hacking with SetPowerRequirement and it turns out the driver ignores power requirements.

At this point, my conclusions lead me to be pretty upset with HTC for once again passing shitty drivers on to us. So I go to my last resort option, using RequestPowerNotifications. Spent a few hours debugging and getting the message loop working correctly, only to find out the PBT_TRANSITION message for suspension doesn't always come through before the device goes down.

Does anyone have any ideas on how to handle GPS and Sleep? I'd hate to do something to totally change the functioning of the device (like holding the whole device alive), but I can't really think of anything else to do.

mligor
18th April 2008, 10:34 PM
Hi, did you already found solution ?

TalynOne
19th April 2008, 12:32 AM
Hi Baffles, I haven't documented this yet, I will soon...

In GpsGate v2.6.0.308, they added an "WM GPS" option for the "Input" source. When this is done then GpsGate primes the GPS on the Titan. Also when used in conjunction with the "Close input when idle" option in the "Advanced" section of the "Input" tab in GpsGate, then GpsGate only turns on the GPS when a GPS application request GPS data from the GpsGate output port. This behavior seems to survive suspend/wakeup just fine too. Maybe you can study how they handle it as a clue for your application.

dannyboy78
29th April 2008, 02:48 PM
Hi

I am having exactly the same problem myself, especially with the TyTnII, have you had any luck?

Thanks
Dan

mligor
29th April 2008, 03:58 PM
It took me a while, but on the end I got it to work...

Point is that you have to use Unattended mode

here is what you have to do:

1) call PowerPolicyNotify(PPN_UNATTENDEDMODE, TRUE)

this will tell to PowerManager that your application wants to do something before device go to sleep :) - will activate Unattended mode

2) SetPowerRequirement(L"GPS0:", D0, POWER_NAME|POWER_FORCE, NULL, NULL);

not sure if this is needed, but because we need GPS to stay alive it is ok to call it (if you use GPS over COM port, instead of GPS0: should be COMx:)


3) use RequestPowerNotifications(m_hMsgQueue, PBT_TRANSITION)

and create MessageQueue to get info when mode is changed... (look e.g. POWER_BROADCAST structure for more info).

4) you have to have one WaitForSingle/MultipleObjects with timeout, where you will wait for handle on MessageQueue you created for PBT_TRANSITION

5) when PBT_TRANSITION comes, and if device is changed in Unattended mode (simple string comparing POWER_BROADCAST.SystemPowerState=="unattended") you are responsible to keep device alive.. which mean you have to call periodically SystemIdleTimerReset() - if you do not do that, your device will go to sleep mode

do not call SystemIdleTimerReset() if you are not in unattended mode, because that will prevent device to switch off backlight and screen.

6) in case of timeout on WaitForXXObjects you can read GPS port and process your data

.. in general Unattended mode needs more power then sleep mode, but that is only way (at least on my HTC Artemis).

From documentation point of view simple call SetPowerRequirement(L"GPS0:", D0, POWER_NAME|POWER_FORCE, NULL, NULL) should be enough, but it is not so :(


I hope that will help you... my application works fine now and I'm happy :D

regards,
Igor

dannyboy78
2nd May 2008, 03:06 PM
Thanks for that Igor, that all works for me as well. Tested on HTC P3300 and HTC P3600. I have also tried this on the HTC TyTnII but that deviceas always doesn't want to play nicely, as Baffles pointed out it does indeed seem to ignore calls to SetPowerRequirement.
If anyone has come across a way getting round the problems of the TyTnII, it would be great to hear it.

Thanks
Dan

negerzoen
24th June 2008, 02:20 PM
Unfortunately, I'm not able to keep the GPS signal alive on my HTC P3600 (Orange SPV M700). Unattended mode works; a timer remains active and a simpel counters counts through. However, the GPS signal disappears after pressing the power button.

I call PowerPolicyNotify and SystemIdleTimerReset on each timer tick. Then, I read all data from the serial port (COM9). This works fine. After I press the power button, there is no more data to read from the serial port.

I also tried the code Igor mentiones about the power notification. I had to use platform invokes because I'm using the .NET Compact Framework. This works; I receive a signal and I can read a message from the message queue. However, I don't see the entire point of creating a message queue en registering for power notifications. Is there anything you need to do on the transition event besides calling SystemIdleTimerReset periodically?

Please help me out!

luleyp
16th July 2008, 11:52 AM
Hi there,

I have the same problem on the HTC Polaris (P3650). I want to run my application in unattended mode with an open gps connection.... and I haven'T found a solution yet.

Could anyone who managed to do that pleas post a code example for that.

Thanks a lot.

Patrick

mligor
17th July 2008, 12:20 AM
Unfortunately, I'm not able to keep the GPS signal alive on my HTC P3600 (Orange SPV M700). Unattended mode works; a timer remains active and a simpel counters counts through. However, the GPS signal disappears after pressing the power button.

I call PowerPolicyNotify and SystemIdleTimerReset on each timer tick. Then, I read all data from the serial port (COM9). This works fine. After I press the power button, there is no more data to read from the serial port.

I also tried the code Igor mentiones about the power notification. I had to use platform invokes because I'm using the .NET Compact Framework. This works; I receive a signal and I can read a message from the message queue. However, I don't see the entire point of creating a message queue en registering for power notifications. Is there anything you need to do on the transition event besides calling SystemIdleTimerReset periodically?

Please help me out!

Hi, sorry for late answer....

In transition event you just need SystemIdleTimerReset.. basically that is what unattended mode is:

In Unattended mode.. you get transition event PBT_TRANSITION, where SystemPowerState is "unattended", and application can decide if will allow device to go to sleep or to call SystemIdleTimerReset...

I'm not sure how long "unattended" PowerState stays... but if you call often SysteIdleTimerReset, your app could work without MessageQueue (anyway I use message queue for monitoring power state, and if power is to low, I switch off GPS device).

mligor
17th July 2008, 12:27 AM
here is my code snippet - it is not guaranteed that is compilable, because I took parts from my application.... but should be enough to get overview what you have to do to make it to work.

About managed code.. I didn't try it.. somehow for me is still easier to write C++ code :p






static const DWORD maxMsgQueueMsgSize = sizeof(POWER_BROADCAST_POWER_INFO) + sizeof(POWER_BROADCAST) + MAX_PATH;

// create stop event
HANDLE hStopEvent = CreateEvent(NULL, FALSE, FALSE, NULL);

// create event for GPS change
HANDLE hDeviceStateChanged = CreateEvent(NULL, FALSE, FALSE, NULL);

// Create message queue
MSGQUEUEOPTIONS msgQueueOptions;
ZeroMemory(&msgQueueOptions, sizeof(msgQueueOptions));
msgQueueOptions.dwSize = sizeof(msgQueueOptions);
msgQueueOptions.dwFlags = MSGQUEUE_NOPRECOMMIT ;
msgQueueOptions.cbMaxMessage = maxMsgQueueMsgSize;
msgQueueOptions.bReadAccess = TRUE;

HANDLE hMsgQueue = ::CreateMsgQueue(NULL, &msgQueueOptions);
HANDLE hPowerNotification = ::RequestPowerNotifications(hMsgQueue, PBT_POWERINFOCHANGE | PBT_TRANSITION);

// opening GPS device
HANDLE hGPSDevice = ::GPSOpenDevice( 0, hDeviceStateChanged, NULL, 0);

bool bRun = true; // run loop
bool bHasSignal = false;

// change power requirement for GPS device and SD card
HANDLE hGPSPowerReq = ::SetPowerRequirement(L"GPS0:", D0, POWER_NAME|POWER_FORCE, NULL, NULL);
HANDLE hPowerReq = ::SetPowerRequirement(L"DSK1:", D0, POWER_NAME|POWER_FORCE, NULL, NULL);

// change to Unattended mode
::PowerPolicyNotify(PPN_UNATTENDEDMODE, TRUE);

// LOOOP
HANDLE events[3] = {hDeviceStateChanged, hStopEvent, hMsgQueue} ;
while (bRun)
{
DWORD dwWaitRes = ::WaitForMultipleObjects(3, events, FALSE, 1000 ); // read every 1. sec.
switch (dwWaitRes)
{
case WAIT_OBJECT_0:
// device status changed
{
GPS_DEVICE dev;
ZeroMemory(&dev, sizeof(dev));
dev.dwVersion = GPS_VERSION_1;
if (ERROR_SUCCESS == ::GPSGetDeviceState(&dev))
{
// do something...
}
}
break;
case WAIT_OBJECT_0+1:
// exit requested from exit event.. this is done from other thread by calling SetEvent(hExitEvent)
bRun = false;
break;
case WAIT_OBJECT_0+2:
// if we are on low power, stop monitoring
{
// there is a message in EventQueue.. read queue
BYTE buffer[maxMsgQueueMsgSize];
DWORD NumberOfBytesRead = 0;
ZeroMemory(buffer, maxMsgQueueMsgSize);

DWORD dwFlags;
if (::ReadMsgQueue(m_hMsgQueue, buffer, maxMsgQueueMsgSize,&NumberOfBytesRead, 0, &dwFlags ) && NumberOfBytesRead>=sizeof(POWER_BROADCAST))
{
POWER_BROADCAST* pPwrBrodcast = (POWER_BROADCAST*)(buffer);
switch(pPwrBrodcast->Message)
{
case PBT_POWERINFOCHANGE:
{
// if battery level is to low, finish with GPS reading
POWER_BROADCAST_POWER_INFO* pPowerInfo = (POWER_BROADCAST_POWER_INFO*)pPwrBrodcast->SystemPowerState;
if ((pPowerInfo->bBatteryFlag==2 || pPowerInfo->bBatteryFlag==4) && (pPowerInfo->bACLineStatus==0))
bRun = false;
}
break;
case PBT_TRANSITION:
{
std::wstring powerState = pPwrBrodcast->SystemPowerState;
// handle power states
if (powerState==L"resuming")
::PowerPolicyNotify(PPN_UNATTENDEDMODE, TRUE); // basicaly should never happen, because we do not allow to go in
if (powerState==L"unattended")
SystemIdleTimerReset();
}
break;
default:
ASSERT(!"Unknown message");
}

}
break;
case WAIT_TIMEOUT:
// new location
break;
}
// DO SOMETHING... e.g. Read position from GPS PORT
}
// ENDLOOP

::PowerPolicyNotify(PPN_UNATTENDEDMODE, FALSE); // Leave unattended mode
::ReleasePowerRequirement(hGPSPowerReq); // allow GPS device to go in sleep
::ReleasePowerRequirement(hPowerReq);

::GPSCloseDevice(hGPSDevice); // close GPS device

StopPowerNotifications(hPowerNotification);
CloseMsgQueue(hMsgQueue);
CloseHandle(hPowerNotification);
CloseHandle(hMsgQueue);

mligor
17th July 2008, 12:51 AM
Unfortunately, I'm not able to keep the GPS signal alive on my HTC P3600 (Orange SPV M700). Unattended mode works; a timer remains active and a simpel counters counts through. However, the GPS signal disappears after pressing the power button.

I call PowerPolicyNotify and SystemIdleTimerReset on each timer tick. Then, I read all data from the serial port (COM9). This works fine. After I press the power button, there is no more data to read from the serial port.

I also tried the code Igor mentiones about the power notification. I had to use platform invokes because I'm using the .NET Compact Framework. This works; I receive a signal and I can read a message from the message queue. However, I don't see the entire point of creating a message queue en registering for power notifications. Is there anything you need to do on the transition event besides calling SystemIdleTimerReset periodically?

Please help me out!

Just one more thing (or two)...

you read from COM9.. maybe you should try to call
SetPowerRequirement(L"COM9:", D0, POWER_NAME|POWER_FORCE, NULL, NULL);


in case that you press Power button.. device is going immediately into Unattended mode, and there is chance to miss that mode in case that you do not have MessageQueue, or maybe there is some kind of Windows optimization that if no applications are registered for PBT_TRANSITION, Unattended mode is skipped and device going immediately into Sleep.

You wrote that "there are no more data to read from COM port".. are you sure that your code is running?

in case that your code is still running, then you prevented Sleep mode, and you have to find correct call to SetPowerRequrement. But; if your code is stopped, then your device is sleeping, and you have missed Unattended mode.

I hope that will help a bit....

fredcatsmommy
17th July 2008, 05:52 PM
for those of us that don't know anything about code, is this something that can be cabbed?

mligor
17th July 2008, 08:41 PM
for those of us that don't know anything about code, is this something that can be cabbed?

:) not really.. except that you want to have application which prevents your device to go into sleep mode...

Unfortunately I have not so much time to finish my application, but when that is finished.. I will post here link (and .cab) for sure...

graememk
7th October 2008, 04:50 PM
Hi, been a member for a while and don't remember if i posted yet or not, I was coming up against this problem when developing a GPS application on a HTC TYTN2,

I wanted to constanty record the gps position, but not keep the screen on all the time,

I got around the sleep function of the device by not letting it into the suspend mode and keeping it in the unattended mode. this was done by calling:

PowerPolicyNotify(PPN_UNATTENDEDMODE, TRUE)
This put the lowest state the PPc could go into is the unattended mode but when it went into this mode the gps still turened off,

From reading an article on the code Project, : http://www.codeproject.com/KB/mobile/WiMoPower1.aspx i seen that different power levels ( i mean suspend etc here cant remember the poper term), turn off different applications and these are controlled via registry entries found here for the unatteneded mode :
HKEY_LOCAL_MACHINE\System\\CurrentControlSet\\Cont rol\\Power\\State\\Unattended
the values that controls the GPS Intermediate Driver is "gpd0:" you change this to a 0 to keep GPS on in unatteneded mode, and 4 for it to be off in unattended mode,
I change it when my application starts and change it back when it finishes,

6ITdtvFQqY
3rd February 2009, 02:40 PM
The GPS is kept alive using the "gpd0:" name, not "gps0:".

So, when your application starts call (C#):

public const int PPN_UNATTENDEDMODE = 0x0003;
public const int POWER_NAME = 0x00000001;
public const int POWER_FORCE = 0x00001000;

PowerPolicyNotify( PPN_UNATTENDEDMODE, 1 ); // For app.
IntPtr GpsPowerHandle = SetPowerRequirement( "gpd0:", PowerState.FULL /* 0 */, POWER_NAME | POWER_FORCE, IntPtr.Zero, 0 ); // For GPS.


When your application stops call:

ReleasePowerRequirement( GpsPowerHandle );
PowerPolicyNotify( PPN_UNATTENDEDMODE, 0 );



Nothing else is necessary. Works on my Polaris.

In the attached app, you need to set "MainForm.KeepGpsAlive = true"and "MainForm.LogGps = true" to see this logged in "\Application Data\GpsLoc".

(You can use the compiled exe but without keep alive and logging. It can be used to send the position through SMS and sync the time.)


George

6ITdtvFQqY
24th February 2009, 07:35 AM
This is an update of the code. The previous one was crashing sometimes because the GPS reported a (cached) solution but there were no satellites in the solution.

(The GPS stays alive so long as the application is running.)

mligor
22nd March 2009, 10:16 AM
it is possible that GPD0: works better then GPS0:

GPD is basically GPSID (GPS Intermediate Driver) - the one that use virtual COM port to connect to GPS driver and allow multiple applications to use GPS signal.

Also GPSOpenDevice open GPD not GPS, therefor it make sense to keep that driver alive, and it will (probably) keep real GPS driver ON.

Maybe that is a reason why my application didn't work 100% on my HTC diamond.... I'm going to try that :)

NuShrike
23rd March 2009, 11:27 AM
it is possible that GPD0: works better then GPS0:CamerAware Buddy uses GPD0 and works 100% on FUZE.

I use D1(one) state to keep power-drain at lowest possible. I don't use SystemIdleTimerReset(), yet.

For lowest possible power drain, it's best to go with a SiRFIII (or MK) chip-based external bluetooth puck. The Qualcomm GPSone is a huge, inefficient, power-drainer compared to BT+SiRFIII.

mligor
23rd March 2009, 11:55 AM
I have tried and using GPSID works great.

basically to keep GPS signal alive there are two possibilities (depends what you need):

1) in case that you want to keep LCD ON

- inform OS that you need always D0 state for GPD0: (SetPowerRequirement)
- inform OS that your application needs Unattended mode (PowerPolicyNotify)
- register for PowerState notifications (RequestPowerNotifications)
- call SystemIdleTimerReset() often enough that LCD will not go OFF and/or device to go to sleep.

in this case when user Press Power button, your will get notification that device is going in Unattended mode, and you have to keep device alive with SystemIdleTimerReset() and to prevent never going in Sleep mode.

in this case user will be able to "switch off" device, but your application will continue running. You can also optimize application that in Unattended mode, nothing is updated on the screen, and less CPU to use (to save a bit battery)

2) in case that you do not want to keep LCD On all the time

- inform OS that you need always D0 state for GPD0: (SetPowerRequirement)
- inform OS that your application needs Unattended mode (PowerPolicyNotify)
- register for PowerState notifications (RequestPowerNotifications)
- but DO NOT call SystemIdleTimerReset() unless device is in Unattended mode

when user press Power button or device automatically switch off LCD after timeout, you will get notification about it and THEN call SystemIdleTimerReset to keep device alive. When device is again in ON mode, SystemIdleTimerReset should not be called.

This will ensure your application to work transparent, and it is perfect for some kind of GPS logger etc...


---
all this is very nice, and my GPS logger works perfect, BUT (arghhh!!) when I keep GPSID alive, power consumption is going to be very high (~150mA), and that is for my 900mAh battery a lot of power (max 6h)

What are your experience about power consumption of GPS? Can be that something else on my phone eat so much power or that is GPS chip?

6ITdtvFQqY
7th July 2009, 07:53 PM
GpsLoc has been updated into a full application.

See "Astrolabe - SMS your GPS position" at http://forum.xda-developers.com/showthread.php?p=4037827

Tests showed that in auto power saving mode the battery (of a HTC Polaris, 1350 mAh) would be depleted in about 16 hours, if no GPS signal is available; if there is a GPS signal, the autonomy should be greatly increased (an informal test indicates more than twice the autonomy). Without power saving, the battery would be depleted in about 6 hours.


(Using GPS0 didn't keep the GPS on when my PDA was in standby mode. GPD0 did.)

smuppy
9th July 2009, 11:44 AM
:) not really.. except that you want to have application which prevents your device to go into sleep mode...

Unfortunately I have not so much time to finish my application, but when that is finished.. I will post here link (and .cab) for sure...

Mind telling us a litte more about that app, what is it? You got me all curious here ;)

richardsoffice
24th July 2009, 10:21 PM
Keep GPS connected with LCD power off on HTC Diamond . . . will it ever be possible, and to have a CAB file to make it an easy install job? There is a great many owners out there who wish for just that you only have to look around other site forums.

jirka25
3rd January 2010, 06:31 PM
Yes Cab will be cool! :)

My problem is with the aplication OziExplorer.
Same problem as described here...

But on Samsung Omnia (WM 6.1) Oziexplorer keep gps always on, even if screen is lock. But now on my HTC HD2 (WM 6.5) gps off in standby :(


I think it is something else set in wm 6.1 vs wm 6.5... BUT WHAT IS IT?:(

vphk
4th January 2010, 01:48 PM
The GPS Cycle computer(from the page about HTC Diamond) can read GPS data even you have Diamond in suspend mode. It is done by ticking "read data directly from the port" (or something similar).

knox203
6th January 2010, 06:44 PM
I'm not sure if anyone has posted this but here we go anyways.

I had issues keeping GPS enabled when I'd put my Kaiser into suspend mode and found a fix. Just change the value for each of these registry keys to "1". Or just download the CAB I whipped up.
HKLM\System\CurrentControlSet\Control\State\Resumi ng\gpd0:
HKLM\System\CurrentControlSet\Control\State\Unatte nded\gpd0:
HKLM\System\CurrentControlSet\Control\State\Suspen d\gpd0:
I believe this is a universal Windows Mobile fix and should work on any phone with a GPS chip. Don't quote me on that!!

wg5566
6th January 2010, 11:18 PM
I'm not sure if anyone has posted this but here we go anyways.

I had issues keeping GPS enabled when I'd put my Kaiser into suspend mode and found a fix. Just change the value for each of these registry keys to "1". Or just download the CAB I whipped up.
HKLM\System\CurrentControlSet\Control\State\Resumi ng\gpd0:
HKLM\System\CurrentControlSet\Control\State\Unatte nded\gpd0:
HKLM\System\CurrentControlSet\Control\State\Suspen d\gpd0:
I believe this is a universal Windows Mobile fix and should work on any phone with a GPS chip. Don't quote me on that!!

Thanks for this tip and cab, it works!
I've been doing this in another inconvenient way for years, I always need to use quickmenu or morttool to turn off the screen , when i using garmin que to record some track. otherwise the battery drains very fast. with your cab, just simply press the power button and the gps will keep working until i turn it off.

CreepinJesus
10th January 2010, 06:42 AM
I'm not sure if anyone has posted this but here we go anyways.

I had issues keeping GPS enabled when I'd put my Kaiser into suspend mode and found a fix. Just change the value for each of these registry keys to "1". Or just download the CAB I whipped up.
HKLM\System\CurrentControlSet\Control\State\Resumi ng\gpd0:
HKLM\System\CurrentControlSet\Control\State\Unatte nded\gpd0:
HKLM\System\CurrentControlSet\Control\State\Suspen d\gpd0:
I believe this is a universal Windows Mobile fix and should work on any phone with a GPS chip. Don't quote me on that!!

I've been looking around for ages for this fix.. though I'm not sure if it works just yet...

I applied the registry changes and rebooted the device (Blackstone). Using 'Trackr', I got a GPS signal and my position was fixed using 5-7 satellites. I turned off my device using the power button for about 10s, but when I turned it back on, Track went through "connecting to device", "gps ok", and finally "fix". However, it did do this very quickly, so did it actually disconnect?

CreepinJesus
11th January 2010, 03:30 AM
I've been looking around for ages for this fix.. though I'm not sure if it works just yet...

I applied the registry changes and rebooted the device (Blackstone). Using 'Trackr', I got a GPS signal and my position was fixed using 5-7 satellites. I turned off my device using the power button for about 10s, but when I turned it back on, Track went through "connecting to device", "gps ok", and finally "fix". However, it did do this very quickly, so did it actually disconnect?

It does actually work :) GPS Cycle Computer managed to keep tracking the route after I'd put the phone in standby.

bluenote73
25th January 2010, 08:50 AM
This doesn't seem to work on my diamond, at least that I've been able to get working.

I had a slightly different reg key there, Power/state/etc,
and I tried gps0 gpd0 and NAV1 and none of them gave me the results I was expecting. Google Maps didn't update my location while the phone was off, and tomtom would seem to go through re-aquiring my location when it was turned on as well.

Any hints? Anyone using this on the diamond?

CreepinJesus
25th January 2010, 08:52 AM
This doesn't seem to work on my diamond, at least that I've been able to get working.

I had a slightly different reg key there, Power/state/etc,
and I tried gps0 gpd0 and NAV1 and none of them gave me the results I was expecting. Google Maps didn't update my location while the phone was off, and tomtom would seem to go through re-aquiring my location when it was turned on as well.

Any hints? Anyone using this on the diamond?

Have you definitely included the colon ':' after gpd0 etc?

bluenote73
25th January 2010, 09:25 PM
Yep. I actually wrote a mort script to apply the settings (so I could make changes easily) and these were the values (which I checked manually as well).


RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\State\Resum ing", "gpd0:", "1")
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\Unatt ended", "gpd0:", "1")
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\Suspe nd", "gpd0:", "1")
RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\State\Resum ing", "gps0:", "1")
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\Unatt ended", "gps0:", "1")
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\Suspe nd", "gps0:", "1")
RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\State\Resum ing", "NAV1:", "1")
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\Unatt ended", "NAV1:", "1")
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\Suspe nd", "NAV1:", "1")

JANJANJAN
9th February 2010, 10:31 AM
Hi

For me (HTC HD2) it's working with the following parameters:


[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Contro l\Power\State\Resuming]
"gps0:"=dword:00000001
"gpd0:"=dword:00000001
"com4:"=dword:00000001


[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Contro l\Power\State\Unattended]
"gps0:"=dword:00000001
"gpd0:"=dword:00000001
"com4:"=dword:00000001

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Contro l\Power\State\Suspend]
"gps0:"=dword:00000001
"gpd0:"=dword:00000001
"com4:"=dword:00000001

Regards JANJANJAN

bluenote73
12th February 2010, 02:10 AM
Hi

For me (HTC HD2) it's working with the following parameters:


[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Contro l\Power\State\Resuming]
"gps0:"=dword:00000001
"gpd0:"=dword:00000001
"com4:"=dword:00000001


[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Contro l\Power\State\Unattended]
"gps0:"=dword:00000001
"gpd0:"=dword:00000001
"com4:"=dword:00000001

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Contro l\Power\State\Suspend]
"gps0:"=dword:00000001
"gpd0:"=dword:00000001
"com4:"=dword:00000001

Regards JANJANJAN

Janjan,

I tried your settings but , disappointingly, they didn't seem to work for me.

Could you educate me a little bit, on your test method for this? And also how you decided to use com4?

My test was to load google maps, get a fix, suspend phone, wait, see if google maps latitude updates went through, and when phone turned on, to see if fix needed to be started again (it did). Then I repeated similar test with tom tom.

Any light you can shed would be great ..

thanks

Cory

JANJANJAN
12th February 2010, 08:39 AM
Hi

you may be right with Google Maps. It seems to drop communication with GPS after you turn off the phone. But i guess this is a behavior of Google Maps and has nothing to do with the GPS itself. This even happens with power plugged in...

I am using OziExplorer for GPS-tracking. There you have an option to leave GPS activated even if the phone is turned off. However, without the described modifications, Ozi always lost communication with the GPS after turning off the phone. Now, GPS remains connected and the track is logged correctly...

BTW: Com4 is the port for communication with the GPS. You have to set this port in your Navigation apps (Google Maps has no such setting, maybe automatically or direct comm with the hardware?)

Regards
JANJANJAN

knox203
25th February 2010, 01:06 AM
A good neutral way for you guys to test if this works is to use VisualGPS. Download it @ http://www.visualgps.net/VisualGPSce/Download/VisualGPSceInstall.CAB.

I've got this fix running on 250 devices including the AT&T Tilt, Fuze and Tilt 2. All are working great!

flopyro
18th June 2010, 10:26 AM
these settings don't work on Samsung Omnia II, any ideeas how to solve the problem ?
i'm using IGO8...
Thank you !

OASwan
4th July 2010, 10:44 PM
I wrote an app which collects GPS data and send them to a web server. It just spys for the device owner. The working loop is simple. Using CeSetUserNotificationEx I schedule setting named event at some time and wait using WaitForMultipleObjects. When the event is set I collect data using soft COM port and parsing NMEA strings. Before collecting I call PowerPolicyNotify(PPN_UNATTENDEMODE,0xFFFFFFFF), in collecting periodically call SystemIdleTimerReset(), on collecting call PowerPolicyNotify(PPN_UNATTENDEMODE,0). I don't call SetDevicePowerState, nevertheless everything functions OK ... for some time (about 10-20 hours). After that the loop stops. An event is scheduled but not set if a device sleep. If a device is turned on the loop is working again and after sleeping it fires several times and stops.

It looks like some resource leak occures in the app and/or OS. I tried to restart the app after several hours of work but it gave me no effect.

What could be the reason?

bluenote73
5th August 2010, 02:17 AM
Someone posted an additional reg setting that ended up working for me, its applied to my phone (diamond) , but now I'm trying to find out what it was! Can anyone help?

thanks

webabar
2nd September 2010, 03:50 PM
Hi

For me (HTC HD2) it's working with the following parameters:


[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Contro l\Power\State\Resuming]
"gps0:"=dword:00000001
"gpd0:"=dword:00000001
"com4:"=dword:00000001


[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Contro l\Power\State\Unattended]
"gps0:"=dword:00000001
"gpd0:"=dword:00000001
"com4:"=dword:00000001

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Contro l\Power\State\Suspend]
"gps0:"=dword:00000001
"gpd0:"=dword:00000001
"com4:"=dword:00000001

Regards JANJANJAN

HTC HD2 Rom Orange : works for me ! Thanx !!!

JohnVanDeWaeter
1st November 2010, 12:59 PM
Hi all,

If these values are set in the registry, the gps-device is actually always ON I guess, no matter if it is used or not. Wouldn't that drain the battery?

Would it be better to set these values when needed and reset them (to zero I guess) when no longer needed?

tia!
John

gadgetuk437
2nd November 2010, 06:17 PM
If these values are set in the registry, the gps-device is actually always ON I guessYou guess wrongWould it be better to set these values when needed and reset them (to zero I guess) when no longer needed?That IS what it does, try it.
HTH

JVogler
1st January 2011, 03:02 AM
I'm not sure if anyone has posted this but here we go anyways.

I had issues keeping GPS enabled when I'd put my Kaiser into suspend mode and found a fix. Just change the value for each of these registry keys to "1". Or just download the CAB I whipped up.
HKLM\System\CurrentControlSet\Control\State\Resumi ng\gpd0:
HKLM\System\CurrentControlSet\Control\State\Unatte nded\gpd0:
HKLM\System\CurrentControlSet\Control\State\Suspen d\gpd0:
I believe this is a universal Windows Mobile fix and should work on any phone with a GPS chip. Don't quote me on that!!

I have an old Kaiser I'm trying to accomplish the same thing on, but my registry doesn't not have the same 'tree' as this...are you using a custom ROM? I'm running WM6.1 official AT&T ROM. Everything is the same up until I get to the 'Control', then I have no option of 'State', just Keyboard Layout, Layouts, and Power. But, inside the 'Power' directory, there is a 'State' folder.

So if anyone runs into the same spot after 'Control' on their Kaiser, just choose 'Power' and continue on as posted. I'm sure if you've gotten that far into it, most would figure it out...just thought it could help out anyone getting stuck there.

I haven't gotten to try it out yet, but hopefully all is good, and I can actually suspend my phone while I'm logging my run tomorrow! Nothing is more irritating then when you finish your workout only to find out your GPS tracking program closed in your pocket 5 minutes in, because you couldn't turn off the screen or lock the keys! Thanks for posting your findings on this issue, I'm sure its an annoyance of a lot of people out there! XDA-Developers helps me out just about every day!

JVogler
2nd January 2011, 06:36 AM
Update: Worked just as I wanted, went from 90%-36% battery in about 3 hours though. You definitely couldn't use it to track your whole day. I'm going to try my 2800 mAh battery next weekend....hopefully will get about 7-8 hours out of it. Anyone know of any other registry settings I could adjust to save on battery? Maybe disable things that aren't absolutely necessary to running the GPS?

guppiebugs
1st February 2011, 02:07 AM
I would guess this should work on my P3600 but the GPD0 is nowhere to be found in the registry. Anybody? Thanks for checking anyway.