OESF Portables Forum

Model Specific Forums => Sharp Zaurus => Zaurus - pdaXrom => Topic started by: SSG on January 11, 2005, 05:24:07 am

Title: Even If Simple Alarm In Pdaxrom?
Post by: SSG on January 11, 2005, 05:24:07 am
existence of a solution working alarm clock for wakening zaurus ?
Title: Even If Simple Alarm In Pdaxrom?
Post by: scoutme on January 11, 2005, 05:44:20 am
tried to find an answer in vain...
would be a great step on
Title: Even If Simple Alarm In Pdaxrom?
Post by: pgas on January 11, 2005, 06:25:22 am
someone has compiled xmms-alarm an put it in the unstable feed maybe it works?
Title: Even If Simple Alarm In Pdaxrom?
Post by: SSG on January 12, 2005, 10:25:19 am
se la vi. Have zaurus - yourself rescue myself
Title: Even If Simple Alarm In Pdaxrom?
Post by: Martin on January 12, 2005, 12:44:43 pm
Hi all,

@pgas ... xmms-alarm-plugin works great using RC8 :-)

Martin
Title: Even If Simple Alarm In Pdaxrom?
Post by: scoutme on January 12, 2005, 01:16:17 pm
maybe, nut no way to wakeup from suspended state
Title: Even If Simple Alarm In Pdaxrom?
Post by: shula on January 13, 2005, 11:49:43 am
i tried too xmms-alarm ==> it doesnt wake up from suspend (c860).
i'll try some qtopia if i manage to install the qpe libraries.


i wonder if i can WAKE UP the Z from a shell comamnd or a python script ?
Title: Even If Simple Alarm In Pdaxrom?
Post by: Bundabrg on January 13, 2005, 06:08:42 pm
Hmmm, check how it does it under OZ. From memory its something it calls with apm before it suspends... I suspect it may be something like "sleep for 80 minutes". If this is the case, it would be relatively easy to parse out the next alarm from whatever and edit the apm script.


 - Bundabrg
Title: Even If Simple Alarm In Pdaxrom?
Post by: scoutme on January 13, 2005, 07:51:03 pm
..I fear zaurus has not the hardware needed for wakeup functions
Title: Even If Simple Alarm In Pdaxrom?
Post by: thseiler on January 14, 2005, 03:50:15 am
To: scoutme
 ..I fear zaurus has not the hardware needed for wakeup functions

Intels Developer manual to the PXA255 processor states:

Section 1.2.14 Real Time Clock
... The RTC provides a constant frequency output and a programmable alarm register
This alarm register can also be used to wake up the processor from sleep mode...

It all boils down to reading the RTC register, addind the apropriate number of seconds one wants
to sleep , and then writing this back into the Alarm Register prior to going to sleep.

I think there must be some code somewhere that does it already.
Will investigate further...

thseiler
Title: Even If Simple Alarm In Pdaxrom?
Post by: iamasmith on January 14, 2005, 09:15:49 am
The RTC_ALM_SET IOCTL for the /dev/rtc device is documented in the following location. http://www.uclinux.org/pub/uClinux/ports/b...vice_driver.pdf (http://www.uclinux.org/pub/uClinux/ports/blackfin/docs/pdf-docs/RTC_device_driver.pdf)

Now I know that's uClinux but I have checked the cotulla-rtc driver in the Sharp Kernel and it looks like it takes the same IOCTL.

Haven't tried it yet though !

- Andy
Title: Even If Simple Alarm In Pdaxrom?
Post by: iamasmith on January 14, 2005, 09:26:48 am
In fact check out the Documentation/rtc.txt file in the Linux Kernel source. DUH, should have checked there first !.
Title: Even If Simple Alarm In Pdaxrom?
Post by: pantau on January 14, 2005, 04:55:19 pm
There is an rtc-test program which runs under pdaXrom. You find it at rtc-test.c (http://www.risacher.org/yopy/rtc-test.c).
Also there is a program called apmsleep. It's available in the debian archive apmd for the arm architecture. It kind of works. It suspends the C860 I have and wakes it up at the given time. But when I run it under X in aterm the behaivor of the X-server is kind of strange/slow. On console level it works.
At least both could be a starting point. Or is there any compareable program in pdaxrom (feed?) I couldn't find anything....
Title: Even If Simple Alarm In Pdaxrom?
Post by: pgas on January 15, 2005, 07:27:33 am
The problem here is that pdaxrom use the  dpms options via xset to suspend the Z and not apm,
in fact if you try apm --suspend, it  exhibits the same behavior that pantau describe.


But as kapm is running, apm must be involved at some point.

I think we  need to know what Sash has cook up with apm/ xset and get the sources of his hacks before we can try to implement something using the rtc.
Title: Even If Simple Alarm In Pdaxrom?
Post by: pgas on January 15, 2005, 07:51:10 am
hmm,
I get something working, I have edited the script /usr/bin/apm so that instead of
calling apm.x --suspend it calls  apmsleep +00:01.

I then powered off my Z and after 1 minute it has been waked up with X working.

So xset must call the /usr/bin/apm script at some point

Attached is apmsleep gziped just copy it somewhere like /usr/bin
Now we can try to put up some software/ scripts to use this I think
Title: Even If Simple Alarm In Pdaxrom?
Post by: shula on January 15, 2005, 10:21:11 am
so do i need to calculate how many seconds left before alarm?

---
#!/bin/bash
secs = alram_due_time - currecnt_time
execute apmsleep  <secs>
xmms filename.wav
---
??
Title: Even If Simple Alarm In Pdaxrom?
Post by: pgas on January 15, 2005, 12:04:38 pm
see the man page here (http://linux.about.com/library/cmd/blcmdl1_apmsleep.htm) for instance.
Title: Even If Simple Alarm In Pdaxrom?
Post by: gromituk on January 17, 2005, 12:13:14 pm
Quote
It all boils down to reading the RTC register, addind the apropriate number of seconds one wants
to sleep , and then writing this back into the Alarm Register prior to going to sleep.
[div align=\"right\"][{POST_SNAPBACK}][/a][/div] (http://index.php?act=findpost&pid=62511\")

Sorry to wander off-topic into reminiscence-land, but this reminds me of the old calculator-style [a href=\"http://www.wickidsoftware.freeserve.co.uk/comput/psion1.jpg]Psion II[/url] from the mid-80s.  Its "custom chip" was basically a chain of flip-flops connected to a 32kHz crystal.  This provided an interrupt every second while it was switched on, to keep its clock running (no real time clock chip).  This in itself was tricky to do right, because a second could be lost each time you switched it on if you weren't careful.

But things really got interesting when it was powered down.  Every time you switched it off, it calculated how many seconds to the next alarm.  It then reset the latter part of its counter chain, and
manually clocked it to the right offset
before switching off the machine.  (For example, to pre-load it with 100 seconds, the processor would waggle its clock pin 100 times.)  When the counter overflowed, it woke the machine up again.

Luckily, the counter chain wasn't too long, but the downside of this was that it would overflow in 34 minutes 8 seconds (which is the period of 32kHz divided by 2^the number of flip flops).  The upshot of this was that even when no alarms were set, every 34 minutes and 8 seconds the Psion would be rudely awakened, update its time value by 34 minutes 8 seconds, check whether there was an alarm due in the next 34 minutes and 8 seconds, pre-load the counter if necessary, and then fall asleep again.  And it would both snooze like this for months on a PP3 battery, and switch off a lot more quickly when you wanted it to than the Z running PdaXrom does!

If Psion could get that to work, surely it's not beyond the wit of man to get the Z to wake up when you want it to.
Title: Even If Simple Alarm In Pdaxrom?
Post by: zi99y on November 23, 2006, 06:20:07 pm
It looks like this alarm idea was given up on, has anyone out there got pdax to wake up successfully at a given time? Would be a nice feature especially if it could be used with gpe-calendar or something like it...
Title: Even If Simple Alarm In Pdaxrom?
Post by: InSearchOf on November 23, 2006, 06:34:31 pm
Well... since the migration to 2.6 kernel series... apm had to be rebuilt for the most part... so I think once we work out all the bugs in it... we could get that functionally working well... but right now... it could work... but tests to get that working havent been made by me....

Late
Title: Even If Simple Alarm In Pdaxrom?
Post by: karlto on November 23, 2006, 08:47:15 pm
Quote
It looks like this alarm idea was given up on, has anyone out there got pdax to wake up successfully at a given time? Would be a nice feature especially if it could be used with gpe-calendar or something like it...
[div align=\"right\"][a href=\"index.php?act=findpost&pid=147110\"][{POST_SNAPBACK}][/a][/div]
It was fixed with kernel patches from beta1 (I think?) onward. All you need is a program that sets alarms - ko/pi does it directly through apm scripts, and gpe-calendar uses atd (which I prefer and seems more reliable).

The only problem is that gpe-calendar versions for beta1/beta3 have broken alarm functions! Search this forum for another topic somewhere which describes how to fix it if you go this way.