I'm new to Mortscript and trying to work out how to code a small script to turn the power on when I connect my Kaiser to my Brodit car kit. The power & backlight come on when I power from USB or the mains charger but not when in the Brodit, even though the red charging light is on.
I'm hoping a Mortscript that detects (ExternalPowered() could be used to power on the device. Any assistance would be greatly appreciated as having to find the power button on the Kaiser every time I'm in the car is a pain.
Tytn II running Laurentius26_WM_6.1_PRO.V6a
Bad chance. No program is executed while in standby, so it's a classical recursion problem: You'd need to power on to execute a program that powers on. Only some basic system routines (like clock, phone, and a scheduler for alarm clock, appointments, etc.) are running in standby, and there's no way to add own ones.
While it's possible to power on your device with RunAt (which uses the scheduler mentioned above, WM calls this "Notifications"), this wouldn't be much good - it would also turn on your device if it's in your pocket, and a PowerOff if not externally powered might cause it's done while you were doing something else...
Related
Before I begin, yes I'm probably a relative newbie, yes I've searched the forum, and yes I've read the wiki.
I've got an 8525 running WM6 (thanks vp3G). I always use my phone in vibrate mode when I'm carrying it around, but I need to switch to audio when it is recharging (obviously I can't feel it when its plugged into the wall and sitting on the shelf). An old StarTAC phone of mine had a setting to toggle between vibrate and sound automatically when plugging in to power.
Is there anything like this for Windows Mobile, and specifically for the 8525? If there isn't, I may have to try to see if I can code this myself, but I thought I'd ask first...
Thanks for any help,
- ncdave
Try a search for Kyphur's Hold Comm Button Toggle program (or just "Kyphur", or other derivatives); it allows you to turn on/off the vibrate function by holding the comm button in once (to turn vibe on), then again to turn vibe off. Small pgm, works well, very little memory use. I know the search mechanism isn't perfect but even searching through the threads will work, which is how I found the program
Hope this helps
It sounds like your solution would be a profile switcher. There are programs out there that know to automatically switch profiles when you connect to the car/headset/usb/power...
I've been busy reworking my 8125 as a dedicated GPS unit for use in my car. I've been using WM5SE from dferreira as a lightweight and stable ROM with much success. I do however have two slight issues that I would think should be easy to overcome.
First - I want a one-button click-an-icon way to shutdown the phone. And by shutdown, I mean totally off. I've run across a number of different options and every single one of them winds up doing the same thing - the phone goes into suspend, but is not actually off. Any ideas as to what I can do to just get the damn thing to turn off without trying to hold down the power button?
Second - when I turn the phone back on, the WiFi connection defaults to being powered off. Is there a way to make the WiFi hardware turn on by default?
I'm building a simple G1 based solution to track my car using the phone's GPS capabilities.
Basically, the desired solution is that the G1 is wired to the car's accessory power system, and when the car is either started or the key is in the accessory position, the phone will be turned on and report its GPS coordinates occasionally.
I have most of the pieces put together for this... A G1 running cyanogenmod 6.1, a hacked up car charger that I can wire directly to car power, and some preliminary test software.
My problem, is that the phone doesn't automatically power up when plugged in. The problem scenario will be something like:
1) Car turns off
2) Phone goes on battery power.
3) I go on vacation and don't drive the car for two weeks.
4) Phone battery dies at some point.
5) Restart the car.
6) Battery starts charging. Phone never turns on. GPS tracking does not resume.
Any ideas on how to work around number 6? I don't supposed there's a firmware mod or something that changes the power-on behavior?
All ideas (even crazy mechanical ones) are welcome.
-Paul B. Davis
This is just an idea, so don't read too far into this...
How willing are you to modify the phone?
Here's why:
Ok...When you push the power button, it completes a circuit, causing the phone to power on.
1. Mod the phone, with a relay. This relay would switch one time per power cycle. Allowing for a quick one time completion of the power circuit, forcing the phone to power on when the car does. ...Turn the car off, the relay clicks again, turning the phone off. (Set the power button to turn off when pressed instead of sleep.) ..You could also go as far as to use a software mod to have the phone start a macro when the power button is pushed. This macro saves current state of whatever is running, then powers off. there are paid apps to do this BTW.
2. Set this program you will be using to autostart with the phone.
Viola... Problem solved. ...Easier said than done, I know. Just a thought though. Great idea BTW.
G1 Car Phone Power
Easer said than done.
Is a bit of an understatement.
even takeing off the case and seting up a relay onto the on/off button would not be a very neat solution. As a ciruit connected simply to the on/off button would not know the current state of the phone .
Is it off yet? is it on yet.
And simply checking the charging current would not reliably tell you if the phone is on or off . So you would need to find a power pin on the processor tracks that is held to vcc when the phone is on.
Hope this gives you some ideas.
This turned out to be an interesting project (and a PITA). I'll post pics at some point before I permanently deploy.
What I ended up doing was sort of splitting the difference on the relay issue.
As you suggested, I ultimately could not find anything approaching a software/firmware based solution for power-up on charger connect. To solve this problem, I took the phone apart until I got to the front button panel, and soldered small leads to the two sides of the power switch.
This was a particularly harrowing solder job, because the power switch conductors are actually tiny copper plates sealed into a flexible film. To get at them you have to partially dissect the film, remove the top half of the power's membrane switch, and then solder to the tiny plates without melting the film.
Anyway, once the leads were in place, I reassembled the phone. This was also a slight PITA because the front panel is engineered with no free space and now has to accommodate the new leads coming off the power switch.
After reassembly, I found a cheap timed relay circuit board that trips its relay for a variable length of seconds or minutes, and then goes dormant until being de-energized and then re-energized. I wired the relay to the power leads in parallel with a momentary power switch, wired the relay circuit to car power, set the circuit to 10 seconds, and it worked perfectly. Phone turns on every time.
It's not entirely deterministic, but I'm OK with it. Realistically, when has your phone ever NOT turned on when you held down the power button for 10 seconds?
The other half of the project was to catch the charger disconnect (car turning off) and power down. This was far simpler to implement, as the phone is rooted and I have access to everything I need to shut off.
I created a simple BroadcastReceiver that catches ACTION_POWER_DISCONNECTED and runs this little block of code to turn off the device:
Code:
Process proc = Runtime.getRuntime().exec("su -");
java.io.OutputStream os = proc.getOutputStream();
os.write("reboot -p\n".getBytes());
os.flush();
os.close();
I haven't tested it extensively, but it seems to work as expected every time.
I could make this a little more deterministic by creating a service that watches the charger connected state and initiates a shutdown when it notices a state change to "disconnected," but it's not clear to me that a BroadcastReceiver is any more unreliable than a service that can be pushed out of memory.
I loaded it all up into a little plastic case, and it seems to work pretty well, so far.
-PBD
Hi guys,
I'm experiencing some failures of power button of my HTC HD mini: it sometimes does not power on my phone and I have to press it several time before it reacts...
As I do not want to buy a new phone, I'm exploring some alternative approaches to power on my phone (power off is not a problem as I can use some application to power it off).
Approach 1
I'm using G-trigger which has a power on feature which may configured to any phone shake and which works even when the phone is in stand-by.
That works properly but the problem is that querying the G-sensor lead to a fast battery drain, hence this solution is actually an extreme solution that I may use only with some enhancements…
Approach 1a
I tried to work of G-trigger service in two ways:
a. By night: I configured a profile disabling the G-trigger service by night and re-enabling it in the morning
b. When in stand-by: I tried to disable the G-trigger service when in stand-by and re-enabling it when the screen turns on again. Anyway I didn’t figure out how to understand when the screen is on (I tried by mortscript here http://forum.xda-developers.com/showthread.php?t=1296958 but no success). Any idea??
Approach 2
I would try to use some of the volume button but I have no idea about: is there a way to trigger some program when the volume button is pressed when the phone is in stand-by
In conclusion, I don’t know how to proceed and I will appreciate any idea or suggestion.
Thanks in advance
hi all
like many others iv put my nexus 7 into the dash of my car. i was wondering if there is an app or way for my nexus to turn itself off when i turn the car off. iv figured out how to make the device turn on when power is restored to the device but still not sure how to turn the device off.
also would anyone know why when the nexus turns on, it immediately mutes itself? it is connected via 3.5mm jack 100% of the time and tasker opens up power amp but other then that i don't know what might be causing it. any help is appreciated on both issues
cheers
tittysprinklez
Tittysprinklez said:
hi all
like many others iv put my nexus 7 into the dash of my car. i was wondering if there is an app or way for my nexus to turn itself off when i turn the car off. iv figured out how to make the device turn on when power is restored to the device but still not sure how to turn the device off.
also would anyone know why when the nexus turns on, it immediately mutes itself? it is connected via 3.5mm jack 100% of the time and tasker opens up power amp but other then that i don't know what might be causing it. any help is appreciated on both issues
cheers
tittysprinklez
Click to expand...
Click to collapse
If you have tasker installed, create a state which is dependant on battery power - as an exit task tell the tablet to wait for 10 seconds, then call the misc->reboot action with type shutdown to turn the tablet off. The wait 10 seconds it to prevent it powering off when you are cranking the car...
If you just want to turn the screen off, not power the whole tablet down, there's a tasker action Display->System Lock which will turn the screen off..
You could also use tasker to change the system volume for you if you needed as a workaround...
*edit* - BTW - the tasker reboot options don't gracefully reboot / shutdown, so if you have apps running, there's a chance that you may lose data. To do a 'graceful' reboot / shutdown, you are better off using the secure setting plugin...