maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   The alarm works whilst powered off! How? (https://talk.maemo.org/showthread.php?t=56430)

damion 2010-06-17 09:32

The alarm works whilst powered off! How?
 
I forgot to restart my phone when rebooting it this morning so after power down, had left it off. Then the alarm went off!? It looked as graphical as the normal times it goes off, but when I selected snooze, I was prompted by an option to turn the phone on at which point I twigged!

I selected yes and the NOKIA logo appeared and it slowly (well not that bad) booted up normally. How on earth did it display that much graphical complexity, and play a musical* alarm sound all from firmware? I'm fairly certain it hadn't booted up to be able to do the alarm and then was resetting to normal boot when I asked it to boot up fully, but that's one option.

Perhaps the firmware is way more advanced than I assumed, either way I'm impressed and confused. Can anyone shed any light?

*To be honest this is the default audio.

ToJa92 2010-06-17 09:34

Re: The alarm works whilst powered off! How?
 
I'd guess it runs a daemon on the CPU which sleeps until the alarm should go off... So when the alarm is supposed to go off, it loads a bit of the gui and loads the alarm file and plays it.

noipv4 2010-06-17 09:37

Re: The alarm works whilst powered off! How?
 
I think it's a background process similar to the one which is started when the phone is turned off and the charger is connected.

Jezz 2010-06-17 09:37

Re: The alarm works whilst powered off! How?
 
All phones do this, even basic £20 phones can do it

nexus101 2010-06-17 09:37

Re: The alarm works whilst powered off! How?
 
Cool, that's a nice feature. Had not yet given it a try. Good to know that it works. :-)

I missed that feature on my previous phone (windows mobile 6.1 .. ugh!) and loved it on all my phones before these windows dongles.

nexus

nexus101 2010-06-17 09:39

Re: The alarm works whilst powered off! How?
 
@Jezz

not all.
expensive windows mobile phones can't do it (XDA/HTC touch diamond).

nexus

jasonisdavid 2010-06-17 09:45

Re: The alarm works whilst powered off! How?
 
Also if you phone powers down due to a dead battery it will store enough still in it to sound an alarm i believe.

damion 2010-06-17 10:26

Re: The alarm works whilst powered off! How?
 
The ability to control the backlighting and other I/O, detect proximity event changes, handle positional data on the touch screen and graphically display buttons and localised language words on the buttons is F*CK loads of OS capability. It also plays music!

This is not impossible to work out the changable stuff then flash in to a limited little OS of it's own along with the firmware. You could hardwire what you expect the firmware to handle so it just runs some preprepared cpu instructions to trigger all the right stuff. I'm just amazed this is done.

It does make some more sense to configure the internal low power clock with a time to wake up the device, then try a very fast boot, not many init scripts, do the alarm capability and then on request to power up, just reset in to a full OS. It seems a pity to to utilised the booted kernel but the lack of runthrough of init scripts might make that more messy.

I'd estimate that it takes about 75% of the Linux based OS (maemo) to handle playing an alarm wav and pick up the screen pressed option. It's stupid to say £20 phone does the same, their OSes boot in 1-3 seconds and have trivial keypad button hardware, screen and alarm noise functionality so the firmware IS the OS.

ruskie 2010-06-17 11:51

Re: The alarm works whilst powered off! How?
 
Lol... running with fbcon you actually see when you shotdown that the phone actually boots back up into some form of a sleep mode. I'm guessing just enough to actually run things that it needs to.

festivalnut 2010-06-17 12:07

Re: The alarm works whilst powered off! How?
 
yeah nokias have done this for a while now. my n95 sure did and pretty sure my 5230 did aswell. i'm no expert but of course the internal chronometer is always running, and has a command to wake up the os at alarmed times.

lardman 2010-06-17 12:25

Re: The alarm works whilst powered off! How?
 
Quote:

Originally Posted by ruskie (Post 719079)
Lol... running with fbcon you actually see when you shotdown that the phone actually boots back up into some form of a sleep mode. I'm guessing just enough to actually run things that it needs to.

Likewise when you attach the charger the phone boots up enough to run the charging software.

sennyk 2010-06-17 12:35

Re: The alarm works whilst powered off! How?
 
I'm sure that the system has a real time clock chip (maybe a DS1337) that only pulls a few microwatts when the rest of the phone is powered down. The alarm software sets the next alarm time on the real time clock chip. That chip will signal an interrupt line and will also signal the voltage regulator to power up the device. The phone on startup notices that the alarm fired and will notify the user. Any phone with the right hardware should be able to do this.

jolouis 2010-06-17 12:49

Re: The alarm works whilst powered off! How?
 
Quote:

Originally Posted by sennyk (Post 719131)
I'm sure that the system has a real time clock chip (maybe a DS1337) that only pulls a few microwatts when the rest of the phone is powered down. The alarm software sets the next alarm time on the real time clock chip. That chip will signal an interrupt line and will also signal the voltage regulator to power up the device. The phone on startup notices that the alarm fired and will notify the user. Any phone with the right hardware should be able to do this.

That's pretty much it. The tablets have had this feature since the N800 days. Basically what happens is when you schedule an alarm with AlarmD, it registers the timing of the event with the realtime clock (the N8x0s used to use retutime to do this, not sure if that applies to N900 or not). The clock chip is running always, even when the phone is off; once it detects that it's time to wake up, it triggers the device to boot up into a special "act-dead" mode (as Nokia calls it) which then reads the alarm queue to check to see what triggered the boot, and display the alarm stuff.

There's nothing special about "Act-dead" mode for the alarm, other than the fact that it's coded into most of the bootup scripts that if the device is triggered in that mode a lot of those will not run; so the device "starts" quite quickly because it just ignores a bunch of normal bootup proceedures. The downside to that is that if you want to keep the device on after the alarm, it has to actually restart in order to properly process all of that "normal boot" process.

The coolest part about it all really though is that you can use the AlarmD interface to boot "normal" mode and do things from power down as well... it's not a feature of the built-in alarms application as far as I know... but proper usage of the AlarmD api allows it.

Take a look at FlipClock for example. We use the AlarmD api to register alarm events... so if you set an alarm within Flipclock, turn your device off... when the time for that alarm comes up, the device automatically boots, launches FlipClock, and triggers your alarm! That API and custom ability is what makes the whole alarmD thing so cool/unique on the Nokia devices...

(btw for the record, the battery charging is actually an even more stripped down "act-dead" mode... the device actually powers up, loads frame buffer drivers for the display/etc, then shows you the charging screen).


All times are GMT. The time now is 17:20.

vBulletin® Version 3.8.8