Primo power management or auto shutdown?   

Primo power management or auto shutdown?

Postby SpEc_OpS » Mon Jun 04, 2012 11:56 am

Ok first off please dont flame me i have searched and searched and everything i found did not work so here goes.

I have a navman MY65T and a navman MY50T both are running primo im trying to get some sort of power option that will switch it off when the external power disconnects. I have tried the shutdown_time option in sys.txt and all the corresponding system files i could find but as soon as it switches off it comes back on.

I was wondering if anyone can tell me if i can write a script or a program that i can include in the autorun.mscr file that will put the device into suspend mode when external power is disconnect and restart it when i reconnect it or something like this?

Both devices have a 3 way rocker switch going on-off-reset i noticed that when i switch it to the off position with the external power in it will stay on and the shutdown_time command works but putting external power back into it wont restart it.

I work as a courier so constantly switching on and off is extremely annoying especially because i have to go through the reset process and wait a couple of minutes for it to start up each time.
SpEc_OpS offline


Junior Member



 
Joined: Thu May 31, 2012 4:02 pm
Posts: 11
Has thanked: 0 time
Been thanked: 0 time

Postby Fatboyfun » Mon Jun 04, 2012 12:31 pm

I find the mio/navmans with the three position switch can be picky about suspending while the switch is on, sometimes it works, sometimes it just comes straight back on again, if the switch is not working when set to off there is a fix available

Once the device is in suspend it cannot be woken up by software.
Fatboyfun offline


User avatar Ex Moderator



 
Joined: Mon May 17, 2010 5:34 pm
Posts: 5782
Has thanked: 2 times
Been thanked: 408 times

Postby SpEc_OpS » Mon Jun 04, 2012 1:03 pm

Yeh i downloaded the power button fix and that works but its extremely annoying surely there would be something that could be done from what i have read on the microsoft page about the power management in windows ce it can be done i just dont have the knowledge to write the program.

Heres one page explaining power management in windows ce
[Please Register or Login to download file]
SpEc_OpS offline


Junior Member



 
Joined: Thu May 31, 2012 4:02 pm
Posts: 11
Has thanked: 0 time
Been thanked: 0 time

Postby chas521 » Mon Jun 04, 2012 1:09 pm

SpEc_OpS wrote:Ok first off please dont flame me i have searched and searched and everything i found did not work so here goes.

I have a navman MY65T and a navman MY50T both are running primo im trying to get some sort of power option that will switch it off when the external power disconnects. I have tried the shutdown_time option in sys.txt and all the corresponding system files i could find but as soon as it switches off it comes back on.

I was wondering if anyone can tell me if i can write a script or a program that i can include in the autorun.mscr file that will put the device into suspend mode when external power is disconnect and restart it when i reconnect it or something like this?

Both devices have a 3 way rocker switch going on-off-reset i noticed that when i switch it to the off position with the external power in it will stay on and the shutdown_time command works but putting external power back into it wont restart it.

I work as a courier so constantly switching on and off is extremely annoying especially because i have to go through the reset process and wait a couple of minutes for it to start up each time.


I've been doing this GPS modding for quite a while now so I've seen and heard things that a lot of you don't know about. When GPS first came out and was made available to the public, portable devices were being bricked in large numbers due to the fact that a lot of people were leaving the cable and device attached to the car after turning off the engine. What was happening is that people then re-started their car with the cable and device already attached. The surge of electricity from starting the car then caused the cable and/or the device to burn-out and brick the device.

This problem was later corrected by the manufacturers. But do you really know if your device is one of them? Even though my Mio C320 was supposedly "fixed", I still ALWAYS remove the device after using it and re-attach it after starting the car.

Just my thoughts and experience here.
If it ain't broke don't fix it!
ALWAYS BACK-UP YOUR FILES/FOLDERS BEFORE MAKING EDITING CHANGES!

Please do NOT post any thanks. Simply press the hand icon with the "thumb up" which is the thank you button.
chas521 offline


User avatar Ex Moderator



 
Joined: Sat May 15, 2010 8:50 pm
Posts: 4549
Location: Long Island, NY
Has thanked: 64 times
Been thanked: 1380 times

Postby SpEc_OpS » Mon Jun 04, 2012 1:27 pm

chas521 wrote:I've been doing this GPS modding for quite a while now so I've seen and heard things that a lot of you don't know about. When GPS first came out and was made available to the public, portable devices were being bricked in large numbers due to the fact that a lot of people were leaving the cable and device attached to the car after turning off the engine. What was happening is that people then re-started their car with the cable and device already attached. The surge of electricity from starting the car then caused the cable and/or the device to burn-out and brick the device.

This problem was later corrected by the manufacturers. But do you really know if your device is one of them? Even though my Mio C320 was supposedly "fixed", I still ALWAYS remove the device after using it and re-attach it after starting the car.

Just my thoughts and experience here.


Appreciate the input and duely noted but i would really like to get this working if not im going to update to a device that will work how i want it to so if i brick this one its not going to be a big loss plus i do have 2 so i already have a spare.
SpEc_OpS offline


Junior Member



 
Joined: Thu May 31, 2012 4:02 pm
Posts: 11
Has thanked: 0 time
Been thanked: 0 time

Postby chas521 » Mon Jun 04, 2012 1:36 pm

SpEc_OpS wrote:Appreciate the input and duely noted but i would really like to get this working if not im going to update to a device that will work how i want it to so if i brick this one its not going to be a big loss plus i do have 2 so i already have a spare.


First of all, I was only putting the possibility of bricking your device out there for informational purposes only. I'm not saying that it will happen to you. Only to keep it in mind. Just so you know, Fatboyfun knows what he's talking about when it comes to scripts and writing them.
If it ain't broke don't fix it!
ALWAYS BACK-UP YOUR FILES/FOLDERS BEFORE MAKING EDITING CHANGES!

Please do NOT post any thanks. Simply press the hand icon with the "thumb up" which is the thank you button.
chas521 offline


User avatar Ex Moderator



 
Joined: Sat May 15, 2010 8:50 pm
Posts: 4549
Location: Long Island, NY
Has thanked: 64 times
Been thanked: 1380 times

Postby SpEc_OpS » Mon Jun 04, 2012 1:36 pm

also i posted a link to a website but it didnt work if you search windows embedded ce 6.0 power management on google there is a way you can create a new system power state heres an extract of what im talking about surely there is a way this can be made to work using this method

Adding New System Power State

[SPOILER=See Details]This is an example of adding new power state for a custom device which needs a low power state for USB charge mode. Since the USB charge current is restricted to 500mA some of the peripherals are needed to be powered off and the device charges the battery with the remaining current. To accomplish this, a new power state is created, which is triggered when the USB cable is inserted. In this state we restrict some of the device driver’s (peripherals) power consumption. Adding new power state is explained step-by-step method with code snippets for easy understanding.


1. Each power state is represented as class in pwstates.cpp, add your new power state by creating a new class structure.

Example: I have created PowerStateUsbCharge class.

class PowerStateUsbCharge : public PowerState
{
public:
PowerStateUsbCharge(PowerStateManager *pPwrStateMgr,
PowerState * pNextPowerState = NULL )
:PowerState(pPwrStateMgr,pNextPowerState)
{
};
};


2. Implement a virtual function “EnterState”; this function will be getting called before the system enters the power state corresponds to this class.

Virtual void EnterState ()
{
PowerState::EnterState();
//Your required codes while entering this power state can be
//added here
}


3. Add an Activity state for the new power state in PLATFORM_ACTIVITY_STATE enum in pwstates.cpp

Example: I have added “Usbcharge” state for my new power state

typedef enum
{
On, // system is running normally with UI enabled
UserIdle, // User Idle state.
SystemIdle,
Resuming, // system is determining what to do after a resume
Suspend, // system suspended, all devices off(or wake-enabled)
ColdReboot,
Reboot,
Usbcharge,
UnknownState = PM_UNKNOWN_POWER_STATE,
} PLATFORM_ACTIVITY_STATE, *PPLATFORM_ACTIVITY_STATE;


4. Implement GetState( ) and GetStateString( ) functions with corresponding return value in the new power state class.

Example: GetState function returns the “Usbcharge” enum value.
GetStateString returns the name of the current power state in wide char.

5. Implement AppsCanRequestState() with return value TRUE or FALSE. This depends on the power state you are creating. If the return value is FALSE, user cannot force fully enter in to this state from the application.


6. Implement WaitForEvent function to wait for the required events for switching to next power state.

Virtual PLATFORM_ACTIVITY_EVENT WaitForEvent()
{
DWORD dwTimeout = INFINITE;
PLATFORM_ACTIVITY_EVENT activeEvent;
//Disable unnecessary timeout events like useridle timeout, etc.
//Wait for the required events using WaitForMultipleObject or by
//calling PowerState::WaitForEvent
return activeEvent;
}


7. After implementing all the required functions we need to add this power state class to the power state list, this can be done by modifying PowerStateManager::CreatePowerStateList function in pwstates.cpp.

Example: I have added PowerStateUsbCharge class to the power state list.

BOOL PowerStateManager::CreatePowerStateList()
{
if (m_pPowerStateList == NULL)
{
m_pPowerStateList = new PowerStateOn(this,
new PowerStateUserIdle(this,
new PowerStateSystemIdle(this,
new PowerStateUsbCharge(this,
new PowerStateResuming(this,
new PowerStateSuspended(this,
new PowerStateSuspended(this,
new PowerStateColdReboot(this))))))));
}
..
..
}

You can just insert the new Power State Class in any position, this is not depending on the actual power state flow, and this is just a list of all power states.

8. Next step is to create an event for entering into the new state, this you have to do in PM\SRC\MDD\pminit.cpp using CreateEvent API. You can create a string event to trigger the event from some other driver.

9. After creating the event for entering the power state we need to add the event created to the event array. This event array is used by each power state’s WaitForEvent function for switching to new power state.


10. For adding the event to event array, increment PM_BASE_TOTAL_EVENT in pwsdef.h by 1 for accompanying the new event and add a definition for this new event.

Example: #define PM_USBCHARGE_EVENT 8


11. In pwstates.cpp GetEventHandle( ) function add a case for the new event created in pminit.cpp.

HANDLE PowerStateManager::GetEventHandle(DWORD dwIndex)
{
switch (dwIndex)
{
..
..
..
case PM_USBCHARGE_EVENT:
return ghUsbPowerMode;
}
return NULL;
}


12. In PowerState Class constructor add a call to GetEventHandle with index as PM_USBCHARGE_EVENT to get the event handle.

PowerState::PowerState(DefaultPowerStateManager *pPwrStateMgr,
PowerState * pNextPowerState)
: m_pPwrStateMgr (pPwrStateMgr)
, m_pNextPowerState (pNextPowerState)
{
m_dwEventArray [ PM_USBCHARGE_EVENT] =
pPwrStateMgr->GetEventHandle(PM_USBCHARGE_EVENT);
m_dwNumOfEvent = PM_BASE_TOTAL_EVENT;
}

13. Now the event created is added to event array which is used by WaitforEvent function for switching to your new power state when the corresponding event is triggered.


14. In WaitforEvent ( ) function of PowerState Class (pwsdef.cpp) add a new case for the custom event, and return the PLATFORM _EVENT specific to the new power state.

Example: In this case I am mapping the event to PowerSourceChange platform event.

case PM_USBCHARGE_EVENT:
platEvent = PowerSourceChange;
break;


15. Now add a new case in WaitforEvent function (in all the required power state class) to handle our new state.

Example: We are assigning the next state as “Usbcharge” based on the activity event.

switch (activeEvent)
{
case UserActivity:
m_LastNewState = On;
break;
..
..
..
case PowerSourceChange:
m_LastNewState = Usbcharge;
break;
}

Now you can enter the new power state by triggering the event created in pminit.cpp. You can also restrict particular device drivers to a defined power state by adding registry key.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\State\usbcharge]
"hcd1:"=dword:3 ; D3


Note: Here “usbcharge” is the string returned by the GetStateString function of PowerStateUsbCharge

Above registry setting sets the USB host device to D3 state when in usbcharge mode is entered.[/spoiler]
SpEc_OpS offline


Junior Member



 
Joined: Thu May 31, 2012 4:02 pm
Posts: 11
Has thanked: 0 time
Been thanked: 0 time

Postby Fatboyfun » Mon Jun 04, 2012 2:13 pm

Makes no difference, on these devices the processor is halted when in suspend.

There is a collection of scripts to turn the screen off and on with external power, the device is still on (and will consume power) but the screen is off, on some devices the touch screen will still react to taps.
Fatboyfun offline


User avatar Ex Moderator



 
Joined: Mon May 17, 2010 5:34 pm
Posts: 5782
Has thanked: 2 times
Been thanked: 408 times

Postby SpEc_OpS » Mon Jun 04, 2012 2:38 pm

Ok so maybe not go into full suspend but close down everything not necessary to save power and then resume when external power comes back on?
SpEc_OpS offline


Junior Member



 
Joined: Thu May 31, 2012 4:02 pm
Posts: 11
Has thanked: 0 time
Been thanked: 0 time

Postby chas521 » Mon Jun 04, 2012 3:04 pm

SpEc_OpS wrote:Ok so maybe not go into full suspend but close down everything not necessary to save power and then resume when external power comes back on?


It's probably not going to happen like you want. Because you're using a SD card, information is lost to the device from the card when the device is put into sleep mode. Then when it gets re-woken, that transference of information to the device from the card has to be re-established again. It doesn't matter if the information is on the internal drive itself. That's just the way these devices work.
If it ain't broke don't fix it!
ALWAYS BACK-UP YOUR FILES/FOLDERS BEFORE MAKING EDITING CHANGES!

Please do NOT post any thanks. Simply press the hand icon with the "thumb up" which is the thank you button.
chas521 offline


User avatar Ex Moderator



 
Joined: Sat May 15, 2010 8:50 pm
Posts: 4549
Location: Long Island, NY
Has thanked: 64 times
Been thanked: 1380 times

Postby Fatboyfun » Mon Jun 04, 2012 3:05 pm

Most devices cannot be woken up with software because the processor has stopped, there needs to be a hardware trigger to wake up the device, some devices have AC power as a hardware trigger. Also some devices do not correctly handle suspend mode.

Cheap Binatone devices and other Chinese devices wake up on external power and can shutdown on loss of power with a script.

I have in the past built a simple electronic circuit to short the button when power is connected, thus waking up the device, and then using a simple script to suspend the device when power is disconnected.
Fatboyfun offline


User avatar Ex Moderator



 
Joined: Mon May 17, 2010 5:34 pm
Posts: 5782
Has thanked: 2 times
Been thanked: 408 times

Postby SpEc_OpS » Mon Jun 04, 2012 3:10 pm

actually im running of internal memory never said i was using a sd there isnt even a sd in my device.

I did find this apparantly it works on ce 5.0 but keeps flickering the screen on and off so i was thinking with this and a combination of another script to turn the display on and off with the ac power would be our solution
[color=#FF0000]
No links to other forums.[/color]
SpEc_OpS offline


Junior Member



 
Joined: Thu May 31, 2012 4:02 pm
Posts: 11
Has thanked: 0 time
Been thanked: 0 time

Postby chas521 » Mon Jun 04, 2012 3:22 pm

SpEc_OpS wrote:actually im running of internal memory never said i was using a sd there isnt even a sd in my device.

I did find this apparantly it works on ce 5.0 but keeps flickering the screen on and off so i was thinking with this and a combination of another script to turn the display on and off with the ac power would be our solution
[color="#FF0000"]
No links to other forums.[/color]


I also said that it can happen with the internal flash drive also. As for the flickering, it sounds like you are on the brink of a memory issue. Reduce the amount of content you are asking the device to load - especially the speedcams [possibly too large an area].
If it ain't broke don't fix it!
ALWAYS BACK-UP YOUR FILES/FOLDERS BEFORE MAKING EDITING CHANGES!

Please do NOT post any thanks. Simply press the hand icon with the "thumb up" which is the thank you button.
chas521 offline


User avatar Ex Moderator



 
Joined: Sat May 15, 2010 8:50 pm
Posts: 4549
Location: Long Island, NY
Has thanked: 64 times
Been thanked: 1380 times

Postby SpEc_OpS » Mon Jun 04, 2012 3:38 pm

since i cant link to another forum heres what i was talking about and thanks again for your input chas521 but if you had looked at that link you would see i was talking about the flickering problem related to what they were saying

[SPOILER=See details]
Many thanks for sharing the package. I have further modified them to make the DAEMON running continuously. The scripts will now perform as follows:

Ask the user whether they want to activate this Auto Power On feature.
If yes
The device goes to Sleep when no external power applies; and
The DAEMON will keep searching until external power detected and
Wake up the device

p.s. to exit from the loop, I use the Power Button to turn off and restart the device.


Code:

# ON_AC_POWER_MENU.mscr
# Implemented on MortScript ([Please Register or Login to download file] )

# 2009-12-07
# Karako
# GNU General Public License (GPL), Version 2, June 1991


ErrorLevel("off")
Local()

Set ON_AC_POWER_DAEMON, "\SDMMC\ON_AC_POWER\ON_AC_POWER_DAEMON.exe"
Set RUN_APP, "\SDMMC\igo8\igo8.exe"
Set LOOP_SECS, 11

options[1] = "Skip Auto On/Off"
options[2] = " "
options[3] = "Engage Auto On/Off"
Sleep 100

SetChoiceEntryFormat(20, 16, "Verdana")

Choice("Auto_On_Off_Option", \
"^NL^AC Power Auto On/Off^NL^Choose whether you want the GPS device to be^NL^automatically fired up when External Power is supplied^NL^^NL^", \
options)

Case( 1 )
# do nothing
#

Case( 2 )
# do nothing
#

Case( 3 )

# kill old notification(s) to prevent overlap
RemoveNotifications( %ON_AC_POWER_DAEMON% )
Sleep 100

# run application
Run( %RUN_APP% )

# Wait for APP finish loading
Sleep 45000

ReRun = TimeStamp() + %LOOP_SECS%
RunAt( ReRun, %ON_AC_POWER_DAEMON% )
Sleep 100
Exit

EndChoice

# kill old notification(s) to disable this function

RemoveNotifications( %ON_AC_POWER_DAEMON% )
Sleep 100
Run( %RUN_APP% )

Exit

# ON_AC_POWER_DAEMON.mscr
# Implemented on MortScript ([Please Register or Login to download file] )

# based on the script from jwoegerbauer 09/04/2009
# GNU General Public License (GPL), Version 2, June 1991

# modified by Karako 2009-12-07

ErrorLevel("off")
Local()

# adjust to your needs (must > 10 seconds !!!!)
Set LOOP_SECS, 11

Set ON_AC_POWER_DAEMON, "\SDMMC\ON_AC_POWER\ON_AC_POWER_DAEMON.exe"
Set ON_AC_POWER_RESUME, "\SDMMC\ON_AC_POWER\ON_AC_POWER_RESUME.exe"
Set TURN_OFF, "\SDMMC\ON_AC_POWER\Sleep.exe"
Sleep 300


# kill old notification(s) to prevent overlap
RemoveNotifications( %ON_AC_POWER_DAEMON% )
Sleep 500


# check AC power line state
If( NOT ExternalPowered() )

# set new notification queue
ReRun = TimeStamp() + %LOOP_SECS%
RunAt( ReRun, %ON_AC_POWER_DAEMON% )
Sleep 100

# turn device again into standby
Run( %TURN_OFF% )


Else

# call resume script
RunWait( %ON_AC_POWER_RESUME% )
Sleep 1500


EndIf

Exit

# ON_AC_POWER_RESUME.mscr
# Implemented on MortScript ([Please Register or Login to download file] )

# based on the script from jwoegerbauer 09/04/2009
# GNU General Public License (GPL), Version 2, June 1991

# modified by Karako 2009-12-07

ErrorLevel("off")
Local()


# adjust to your needs ( must > 10 secs)
Set LOOP_SECS, 11
Set ON_AC_POWER_DAEMON, "\SDMMC\ON_AC_POWER\ON_AC_POWER_DAEMON.exe"

Set PLAY_SOUND, 0
Set WAV_FILE, "\SDMMC\ON_AC_POWER\notify.wav"
Sleep 100


If (ExternalPowered())

If (%PLAY_SOUND% )
PlaySound( %WAV_FILE% )
EndIf

# set new notification queue
ReRun = TimeStamp() + %LOOP_SECS%
RunAt( ReRun, %ON_AC_POWER_DAEMON% )
Sleep 100
#
EndIf

Exit
[/spoiler]

However, I experienced the same problem that the display will turn on and off itself for about 1 to 2 seconds in every cycle (about 10 seconds in my settings) when external power is not attached.

Is it possible to do a Registry tweak to force the display off when the device just wakes up by the Daemon to check for external power please?

I am thinking Registry keys like
HKLM\SYSTEM\CurrentControlSet\Control\Power\State\ BacklightOff
or
HKLM\SYSTEM\CurrentControlSet\Control\Power\State\ ScreenOff

Since I seldom work with Registry, really appreciate for anybody's guidance and hints.


and heres the link to download the package (NOT A LINK TO VIEW ANOTHER FORUM)

[Please Register or Login to download file]
SpEc_OpS offline


Junior Member



 
Joined: Thu May 31, 2012 4:02 pm
Posts: 11
Has thanked: 0 time
Been thanked: 0 time

Postby chas521 » Mon Jun 04, 2012 8:13 pm

@SpEc_OpS

Thanks for the link and understanding.
If it ain't broke don't fix it!
ALWAYS BACK-UP YOUR FILES/FOLDERS BEFORE MAKING EDITING CHANGES!

Please do NOT post any thanks. Simply press the hand icon with the "thumb up" which is the thank you button.
chas521 offline


User avatar Ex Moderator



 
Joined: Sat May 15, 2010 8:50 pm
Posts: 4549
Location: Long Island, NY
Has thanked: 64 times
Been thanked: 1380 times

Next

Return to General Discussions about iGO core

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 6 guests