PPCGeeks

PPCGeeks (http://forum.ppcgeeks.com/index.php)
-   Motorola Q (http://forum.ppcgeeks.com/forumdisplay.php?f=32)
-   -   Advanced Guide: Safe Nightly Auto-Backups or Soft Resets (http://forum.ppcgeeks.com/showthread.php?t=3034)

g-funkster 03-04-2007 05:57 PM

Advanced Guide: Safe Nightly Auto-Backups or Soft Resets
 
As we all know, we cannot have our Qs do a nightly soft reset or a scheduled backup because of the stupid charging screen that Motorola continues (I can't believe they didn't fix this in their latest firmware update) to ship with their devices upon it being reset when plugged in (USB or Wall):

http://www.coolsmartphone.com/images...torola-q-2.jpgTo Combat memory leaks, which are plentiful, a nightly soft reset really helps. A scheduled backup (with Sprite at least) requires a reboot so that's an even better solution. But if you require your phone to be working (as I do), you cannot afford it being stuck in the screen above.

You'll Need:
1. Mortscript installed
2. To be charging at night
---- A) with your computer's USB.
---- B) with a wall appliance timer such as this one. (thanks VicReschke0626 at Qusers for the tip :) )

Idea Flow:
1. Power goes off that charges the device (PC's case: USB Port).
2. The device itself checks if it's plugged in
: Yes = Don't do anything.
: No = Ok we can restart the device safely
3. If Not Plugged, Do action (either restart or backup)
4. Power is restored to the device so you're 100% Charged by the time you get up.

Let's Go: Appliance Timer
1. Set timer to turn off power at some point like 3AM.
2. Set timer to turn power back on, say, 30 minutes later.
3. Skip to Section "Q Side of things"

Let's Go: PC Side of Things
Turning off the USB Ports
The way I'm going about this is I'll be showing you how to turn off one specific USB Port. So remember to plug your cable into the same port every night. But remember, it's 'safe' so even if you forget one night, you'll be ok!

1. Install the Microsoft Tool called DevCon (attached, 'devcon.exe' inside) into your C:\Windows\System32 folder.
2. Open the command prompt: XP/2K: Start->Run->type 'cmd' (no Quotes)
3. Type 'devcon listclass USB' (no quotes). You'll see something like this:
Quote:

C:\Documents and Settings\Admin>devcon listclass USB
Listing 8 device(s) for setup class "USB" (Universal Serial Bus controllers).
PCI\VEN_8086&DEV_24C2&SUBSYS_45418086&REV_01\3&61A AA01&0&E8 : Intel(R) 82801DB/D
BM USB Universal Host Controller - 24C2
PCI\VEN_8086&DEV_24C4&SUBSYS_45418086&REV_01\3&61A AA01&0&E9 : Intel(R) 82801DB/D
BM USB Universal Host Controller - 24C4
PCI\VEN_8086&DEV_24C7&SUBSYS_45418086&REV_01\3&61A AA01&0&EA : Intel(R) 82801DB/D
BM USB Universal Host Controller - 24C7
PCI\VEN_8086&DEV_24CD&SUBSYS_011D1028&REV_01\3&61A AA01&0&EF : Intel(R) 82801DB/D
BM USB2 Enhanced Host Controller - 24CD
USB\ROOT_HUB\4&1B96DD0A&0 : USB Root Hub
USB\ROOT_HUB\4&23036E4B&0 : USB Root Hub
USB\ROOT_HUB\4&A2AFF59&0 : USB Root Hub
USB\ROOT_HUB20\4&18075F55&0 : USB Root Hub

We'll focus on those formatted as shown in bold, above. One of those is the USB port we want to disable, so we'll go ahead and disable each one at a time until we find the right one. So make sure your device is connected so we can test it. If your only keyboard is a USB Keyboard, make sure you have other USB ports you can flip to if the keyboard one goes out.
4. One By One disable: In the command prompt enter the commands like this WITH the quotes as shown:

devcon disable "@USB\ROOT_HUB\4&23036E4B&0"
and to enable it again use:
devcon enable "@USB\ROOT_HUB\4&23036E4B&0"

Do this for each until you hit the one that disables the Q's port (hint: you'll hear the device disconnect and activesync will go gray).

5. Set up a scheduled task:
Start->Programs->Accessories->System Tools->Scheduled Tasks
I won't go into scheduled tasks, if you want to know more, go here. You'll want to set up two almost identical tasks, one to disable, one to enable. They should look like this:
http://img406.imageshack.us/img406/619/tasktd0.png
For the Disabler, the run field should be:

c:\windows\system32\devcon.exe disable "@USB\ROOT_HUB\4&BLAHYOURS"
and the Enabler should be:
c:\windows\system32\devcon.exe enable "@USB\ROOT_HUB\4&BLAHYOURS"

And the other difference being the time (above image, left). I run my disable at 3AM, then the Enable at 3:30AM. The softreset should be quick, but the backup only takes about 5 minutes for me. But, better safe I guess.

Q Side of Things!
You'll Need:
1. Scheduled Launching via something like CT Scheduler.
2. Mortscript (install the Cab under the 'cab' folder that ends in 'SP' for smartphone).
Mortscript files are just text files, with extension 'mscr'.

Soft Reset Script:
"reset.mscr" : If not plugged in, Reset
Code:

If (ExternalPowered() = 0)
        Reset
EndIf

Sprite Backup Script

http://img408.imageshack.us/img408/2997/spritesha3.png

"Sprite.mscr" : If Not plugged, run Sprite, wait 15 seconds, then hit left softkey that does the backup. This requires Sprite to be in "Advanced Mode" (see image, square #1) and I have it without the encryption (General Backup Options -> unchecked 'Encrypt Backup').
Without Encryption:
Code:

If (ExternalPowered() = 0)
        Run "\Program Files\Sprite Backup\Sprite Backup.exe"
        Sleep 15000
        SendLeftSoft
Else
        Message "Backup Not Completed: Device Charging!"
EndIf

With Encryption: (Must send another left softkey, see image square #2). If you have run a backup before, then the password will already be filled out (as shown).
Code:

If (ExternalPowered() = 0)
        Run "\Program Files\Sprite Backup\Sprite Backup.exe"
        Sleep 15000
        SendLeftSoft
            Sleep 5000
            SendLeftSoft
Else
        Message "Backup Not Completed: Device Charging!"
EndIf

How will you know it went well? You'll see the Completed message (image, square #4) when you wake up. Nothing will happen if the device was plugged in, the script would only display the message "Backup Not Completed..", (image, square #3).

Schedule the Script
Using CT Scheduler, create a 'Weekly' entry that runs the script on the days you want (I run it everyday) at, hmm say 5 minutes after your disable time on the PC, so in my case, 3:05AM. See highlighted entry:

http://img408.imageshack.us/img408/1838/ctschedig3.png

Whoosh! That's all there is to it ;) Sure stinks to get it all set up, but having backups is very important to me. But getting the soft-reset is probably more important on a day to day basis. In my experience, by the second day of uptime, my memory (with all apps closed) is around 13MB from the 25MB it should be, due to leaks :evil:

Let's hope if Moto has another firmware rev, they fix this charging nonsense, as well as for their future Qs. In the meantime, this has worked very well for me.

[Cross-Posted at WMExperts]

Malatesta 03-05-2007 11:25 AM

Great write-up g-funk! Very impressive.

g-funkster 03-05-2007 03:58 PM

Thank you!

I posted a link to this write up at QUsers, and Q user 8) VicReschke0626 pointed out something I totally failed to realize: if you use an appliance timer such as one like this $7 dollar unit at Amazon, you can bypass the whole PC configuration side of things.

LOL! Well cool now all bases are covered and there should be no excuses for not keeping your Qs backed up ;)


All times are GMT -4. The time now is 04:11 PM.

Powered by vBulletin® ©2000 - 2024, Jelsoft Enterprises Ltd.
©2012 - PPCGeeks.com


Content Relevant URLs by vBSEO 3.6.0