Help - Search - Members - Calendar
Full Version: Alarms With Kdepim/pi For Rc12 Sl-c3100
OESF Forums > Distros, Development, and Model Specific Forums > Distro Support and Discussion > pdaXrom
cattin
I'm sure you are all well aware of the problems with KO/PI alarms on pdaxrom. I checked all the relevant threads in this forum but couldn't find a working solution. So I started designing my own.

My solution doesn't scan ko/pi's data file for the next alarm, but uses the two files (/home/root/.kopi_next_alarm & .kopi_suspend_alarm) created by ko/pi and relies on ko/pi to play the alarmtone and display the alarm message. My proposed solution can therefor not be called an 'alarm applet' as it just tries to fire-up the zaurus shortly before an alarm event triggers and as it requires KO/PI to be running.

The first problem I had to solve was related to bad parameters KO/PI used to play the alarm sound with the playwave command. This was easy to solve, as I just removed the offending sampling rate option '-r ....' from the source and recompiled KO/PI. With this simple change KO/PI could play the alarm sound given my zaurus was already running when the alarm was triggered.

Next I wrote three little scripts that would wake up the zaurus just before an alarm, so that KO/PI could ring the alarm. As you might know, the zaurus runs all scripts found in the folder /etc/apm/wakeup.d just before suspending. Each script either returns nothing or the number of minutes the zaurus should wait before wakeing up. So I created two little shell scripts (/etc/apm/wakeup.d/next_kopi_alarm & /etc/apm/wakeup.d/next_kopi_suspend) that are simple wrappers to the real awk script /etc/apm/scripts.d/min_to_next_kopi_alarm.awk. These scripts just return the remaining minutes until the next alarm and are called just before the zaurus suspends.

So far so good. My Zaurus could now wake up just before an alarm and play the alarm sound. For some strange reason this only worked for alarms on the same day, and not for alarms e.g. the next morning. As can be easily seen in the suspending scripts, apmsleep is called in the following manner:

CODE
apmsleep +0:n


with n being the number of minutes until the next alarm (note: n can be bigger than 60). As it turned out, the Zaurus wouldn't wakeup if the next alarm wrapped around midnight. It turned out, that apmsleep is indeed not aware of day wraps and was thus waiting for a time that alread passed.
My first tests after making the apmsleep command aware of day wraps seem to work. I am, however, not sure that it works correctly with all timezones.

Attached you find the apmsleep.c with my suggested changes. If you feel like playing around with it you need the apmd_3.2.1.orig.tar.gz package from the pdaxrom site to compile. Otherwise just use the binary version I included in this thread.

I don't take any responsibility if it doesn't work or even fries your Z ;-)

any comments or suggestions?

regards, Philippe

### Installation

1. copy all the files (except apmsleep.c) to your zaurus (in my case a SL-C3100)

2. mv next_kopi_suspend next_kopi_alarm /etc/apm/wakeup.d

3. mv min_to_next_kopi_alarm.awk /etc/apm/scripts.d

4. mv /usr/bin/apmsleep /usr/bin/apmsleep.orig

5. mv apmsleep /usr/bin

6. check, that all files are executable
gromituk
Well done *round of applause*
zautrix
Thanks for this detailed information.

In January I will try to integrate an automatic wakeup (based on your solution) into the KO/Pi ipks such that this is running out of the box when installing KO/Pi.

Now I have to find a used 760/860...

z.
Chero
I'm a married guy, but,

cattin, I LOVE YOU !!!!!
I installed your solution, everything seems to work just fine. Thanks a lot.

zautrix, I LOVE YOU !!!!!
If I wouldn't have kdepimpi, I'd give/sell you my C3100. wink.gif

(I sold my 860 2 weeks ago) unsure.gif

Chero.
plcg
Thanks for your great work, Philippe.

But...
my C1000 doesn't wake up before the alarm sad.gif

Is it a C1000 problem ?

plcg
cattin
QUOTE(plcg @ Dec 4 2005, 10:55 PM)
Thanks for your great work, Philippe.

But...
my C1000 doesn't wake up before the alarm  sad.gif

Is it a C1000 problem ?


There are several thinks you could test to find out the problem:

1.) check that the scripts in /etc/apm/wakeup.d are working correctly

CODE
cd /etc/apm/wakeup.d
./next_kopi_alarm
./next_kopi_suspend


are there any errors? does next_kopi_alarm give you the right number of minutes until the next alarm? the output of next_kopi_suspend is most likely an empty line.

2.) check apmsleep

CODE
/usr/bin/apmsleep -d +0:1


this should put your zaurus at sleep for 1 minute and then wake up again. if you don't get an error here and your debug output looks okay then there might be a more fundamental problem with your setup.

regards, Philippe
willgan
i'm having some problem with the ko/pi alarm on my C1000...

I followed the instruction provided by cattin

1. all the files are in the appropriate directory and executable..
2. Alarm works when my Z is running ko/pi
3. The alarm doesn't work when i off the Z or suspend the Z. But when i on the Z later, the alarm pops up.

Any idea on how to make the alarm work when the Z is in suspend mode?
yswong
Mine doesn't work either. By running apmsleep I found that the RTC time is wrongly set if /etc/localtime exists.

For example:

CODE
/etc/localtime -> /usr/share/zoneinfo/Asia/Hong_Kong (which is GMT+8)

apmsleep -d +0:1

Current RTC time/date is 04:11:14 05-11-2005.
Current local time/date is 12:11:15 05-11-2005.
Setting RTC alarm time to 20:12:14 04-11-2005.
RTC alarm time now set to 20:12:14 04-11-2005.

Another example:

CODE
/etc/localtime -> /usr/share/zoneinfo/America/New_York

apmsleep -d +0:1

Current RTC time/date is 04:48:20 05-11-2005.
Current local time/date is 23:48:20 04-11-2005.
Setting RTC alarm time to 09:49:20 05-11-2005.
RTC alarm time now set to 09:49:20 05-11-2005.

Another bug with apmsleep?
plcg
QUOTE(cattin @ Dec 4 2005, 09:33 PM)
1.) check that the scripts in /etc/apm/wakeup.d are working correctly

CODE
cd /etc/apm/wakeup.d
./next_kopi_alarm
./next_kopi_suspend


are there any errors? does next_kopi_alarm give you the right number of minutes until the next alarm? the output of next_kopi_suspend is most likely an empty line.

It works as expected smile.gif

QUOTE
2.) check apmsleep

CODE
/usr/bin/apmsleep -d +0:1


this should put your zaurus at sleep for 1 minute and then wake up again. if you don't get an error here and your debug output looks okay then there might be a more fundamental problem with your setup.

My Zaurus doesn't wake up...
I have to push "On/Off" button to wake it up an then i see "Time Leap detected" on screen.
That's all !

plcg
cattin
QUOTE(yswong @ Dec 5 2005, 07:41 AM)
Mine doesn't work either.  By running apmsleep I found that the RTC time is wrongly set if /etc/localtime exists.


I must have messed up with the timezone logic. I'll look into it this afternoon and post a revised version. Shouldn't be too difficult to fix.

philippe
cattin
QUOTE(cattin @ Dec 5 2005, 10:29 AM)
I must have messed up with the timezone logic. I'll look into it this afternoon and post a revised version. Shouldn't be too difficult to fix.


It took me a little longer as expected as I have a four week old NMI (non maskable interrupt) called Celine ;-)

the changelog for this new release 0.1 is as follows:

- rewrote the timezone logic in apmsleep.c. 'apmsleep +h:m' should work regardless your timezone.

- I also made 'apmsleep hh:mm' timezone aware and added one more twist to the original implementation. If hh:mm has already passed this day, the Zaurus will wake up @ hh:mm the next day :-) quite obvious but didn't work in the original implementation.

- the two scripts next_kopi_alarm & next_kopi_suspend both check whether kopi is indeed a running process, as it doesn't make sense to turn on the zaurus when kopi is not running in the first place (so don't change the filename of kopi or otherwise adapt the scripts accordingly).

I hope this release solves the problem people were reporting with my initial version and doesn't break for users were it already worked.

regards, Philippe
karlto
Hi

All this stuff is starting to look very good - having a working alarm is high on the priority list!

If you are having difficulties with apmsleep, it is quite simple to write a program that puts a specific date and time into the RTC alarm register - see the Linux kernel RTC documentation/apmsleep source for all the code you need. It can also be done using the registers.o module if you don't want to program anything (just convert date/time to hex and write to the /proc/cpu/registers/RTAR file). Personally I find it much easier to simply specify a date/time to wake up rather than figuring out the number of minutes

I have the code I was using to test my SL6000 somewhere if anyone is interested - problem is that the RTC alarm support in the pdaXrom kernel still doesn't work for the 6000! I am still trying to figure out how to get a kernel to cross compile when I have time - if anyone has any hints on which source, patches and version of the compiler I should use, please let me know!

Cheers

(RC12, SL6000L)
pgas
QUOTE
I am still trying to figure out how to get a kernel to cross compile when I have time - if anyone has any hints on which source, patches and version of the compiler I should use, please let me know!


try the pdaxrom builder, documentation here:
http://mail.pdaxrom.org/showpage.php?mid=3
download the builder here:
http://mail.pdaxrom.org/rc12/

you need the gcc2.95 toolchain to compile the kernel , 3.4 is used to build the rest of the packages.

The builder should download the sources and apply the patches for you.
yswong
Hi Philippe,

Thanks for the fix. I tested both cases and it worked great. Now I can add back the localtime link with Kopi alarm working!

Your NMI has just proved that you have a great interrupt handler. Keep that fresh and enjoy! 8)

Cheers,
ys
desertrat
QUOTE(plcg @ Dec 5 2005, 06:13 AM)
QUOTE
2.) check apmsleep

CODE
/usr/bin/apmsleep -d +0:1


this should put your zaurus at sleep for 1 minute and then wake up again. if you don't get an error here and your debug output looks okay then there might be a more fundamental problem with your setup.

My Zaurus doesn't wake up...
I have to push "On/Off" button to wake it up an then i see "Time Leap detected" on screen.
That's all !

plcg
*



I'm using wakeup_0.1.tar.gz and have the same problem. Here's my output:

CODE
# apmsleep -d +00:01
Current RTC time/date is 10:22:10 06-11-2005.
Current local time/date is 18:22:10 06-11-2005.
Setting RTC alarm time to 10:23:10 06-11-2005.
equivalent in localtime  18:23:10 06-11-2005.
RTC alarm time now set to 10:23:10 06-11-2005.
Waiting until clock jumps


After waiting several minutes I was quite certain it will not switch on automatically, so after pressing the ON button:

CODE
Time leap detected


Is there anything I can do to further debug this? I would love to get it working (I've already installed the specially compiled version kdepim in anticipation smile.gif)

-- cheers
albertr
Do you use kernel from rc12 too? I think apm rtc alarm should now work on all pxa270-based Zauriis with small patch that should be included in rc12 kernels for c1000/c3000 and c3100.
-albertr
plcg
QUOTE(albertr @ Dec 6 2005, 04:10 PM)
Do you use kernel from rc12 too? I think apm rtc alarm should now work on all pxa270-based Zauriis with small patch that should be included in rc12 kernels for c1000/c3000 and c3100.
-albertr
*

Hi,

And where can we find this small patch, please ?
Thanks.

plcg
cattin
QUOTE
Is there anything I can do to further debug this? I would love to get it working (I've already installed the specially compiled version kdepim in anticipation smile.gif)


this is a mistery to me, as the RTC settings seem to be okay. did your zaurus wakeup with the old apmsleep?

Philippe
albertr
QUOTE(plcg @ Dec 6 2005, 11:28 AM)
[And where can we find this small patch, please ?
Thanks.


It was posted awhile ago on some thread about kopi applet for pdaXrom, Please try to search this forum, If you can't find it, please let me know and I'll re-post it.
-albertr
plcg
QUOTE(albertr @ Dec 6 2005, 04:51 PM)
It was posted awhile ago on some thread about kopi applet for pdaXrom, Please try to search this forum, If you can't find it, please let me know and I'll re-post it.
-albertr
*

Thanks.

I've searched and found this link but it doesn't seem to work sad.gif

plcg
albertr
Sorry, looks like my provider changed the leased dhcp address, I'll slap it when get home tonight.
-albertr
karlto
pgas - thanks for the tip on the compiler (I think I have been trying various 3.x versions, but haven't gone back that far)

Because the SL6000 is a PXA255 (not PX270 as many others), I think this is why the RTC alarm wakeup problems. I have some thoughts on where to put a similar patch, so hopefully I can get a kernel to compile to test it...

plcg and desertrat seem to be getting the same behaviour as I am - everything works except the actual hardware wakeup!
desertrat
QUOTE(plcg @ Dec 6 2005, 05:04 PM)
I've searched and found this link but it doesn't seem to work  sad.gif


The link works now, but more importantly does anyone have the results of applying that patch tongue.gif . That is some binary file or another that I can copy to my c3100?

-- cheers
desertrat
QUOTE(cattin @ Dec 6 2005, 04:41 PM)
this is a mistery to me, as the RTC settings seem to be okay. did your zaurus wakeup with the old apmsleep?


I copied the original apmsleep back and tried it. That doesn't work either, it just stays off until I use the On/Off button to wake it up again. BTW did you use the patch that albertr refers to in post #16?

-- cheers
cattin
QUOTE(desertrat @ Dec 7 2005, 07:01 AM)
I copied the original apmsleep back and tried it. That doesn't work either, it just stays off until I use the On/Off button to wake it up again. BTW did you use the patch that albertr refers to in post #16?
*


No I didn't have to compile a patched kernel. I just flashed a brand new SL-C3k1 with RC12 directly (including the kernel). Even the original apmsleep was working as long as one didn't wrap around a day boundary.

regards, philippe
pgas
Don't know if it is relevant, but there are some posts related to trouble with apmsleep and related when ntp is installed.
albertr
If you were upgrading from RC11 to RC12 on a PXA270-based Zaurus, is there any chance that the new kernel was not flashed during upgrade? Type `uname -a` to make sure you are using the newer kernel.
-albertr
desertrat
QUOTE(pgas @ Dec 7 2005, 08:46 AM)
Don't know if it is relevant, but there are some posts related to trouble with apmsleep and related when ntp is installed.


Nope I don't use ntp. I only use ntpdate now and again to correct clock.

-- cheers
desertrat
QUOTE(albertr @ Dec 7 2005, 11:27 AM)
If you were upgrading from RC11 to RC12 on a PXA270-based Zaurus, is there any chance that the new kernel was not flashed during upgrade? Type `uname -a` to make sure you are using the newer kernel.


Before rc12 I had been using Cacko rom, so the kernel not being updated should not be a problem. In fact when I switched from Cacko I had even resized and reformatted the "root" partition.

BTW do you mean to say that rc12 already has the patch?

-- cheers
albertr
QUOTE(desertrat @ Dec 7 2005, 06:58 AM)
BTW do you mean to say that rc12 already has the patch?


Yes, I think so, since it was mentioned by Sashz in the first post on the following thread:
http://www.oesf.org/forums/index.php?showtopic=15762
-albertr
Bundabrg
Karlto,

Just a quick update. The reason why I used minutes instead of a time is that it is far (FAR) easier to find the thing that is the nearest minutes away than to subtract two time+dates ;-) (IE, for the scripts in wakeup.d) using simple bash.

- Bundabrg
karlto
QUOTE(Bundabrg @ Dec 9 2005, 07:39 PM)
Karlto,

Just a quick update. The reason why I used minutes instead of a time is that it is far (FAR) easier to find the thing that is the nearest minutes away than to subtract two time+dates ;-) (IE, for the scripts in wakeup.d) using simple bash.

- Bundabrg
*


Don't listen to me too much - I can't even get the thing to wake up by itself yet... smile.gif
sashz
here compiled atd + at which using with Qtopia ROM)

probably it work for me:)

install package, run service:

CODE
/etc/rc.d/init.d/atd start


job list must be in file: for example if you want run dillo, need create text file "job" :

CODE
dillo http://www.oesf.org


than for wakeup zaurus in 7:00 enter:

CODE
at -f job 7:00


than when time will reached, it will run dillo. If zaurus suspend, it will wake up and run dillo.

PS i compiled package with Cxx00 configuration, if it will not work on C7x0/6000, plz write.
clofland
Wow Sash! This atd program for pdaXrom seems to solve a whole lot of problems! Now I can forget that stupid buggy apmsleep thing.

I am testing it on my 760, and so far it seems to work. It runs as scheduled, and wakes the Z up to run scheduled jobs.

Thank you VERY much!

EDIT: I've done more testing, and it definitely DOES wake up my Z for scheduled tasks!

It does have to be running, of course, and the IPK doesn't create the symlinks in /etc/rc.d/rc3.d/ and the other similar directories to start it at boot time. Gotta do that by hand.

Thanks again for the good work Sash!
karlto
Thanks sash. atd works as expected on the SL6000 - no wake from suspend though.

I'm sure the wakeup issue is with the kernel, so I'll keep perservering to get one compiled...
trichmon
I will echo karlto. With a clean flash of RC12 atd works fine except it for the wake form suspend issue.
sashz
QUOTE(trichmon @ Dec 13 2005, 01:27 PM)
I will echo karlto.  With a clean flash of RC12 atd works fine except it for the wake form suspend issue.
*

no running ntpd or somelike utils which can modify hardware clock?

just tried atd with SL-C760, work fine.
trichmon
I dont have ntp installed. Im not sure what other packages might effect it. But at is working great, just need to get the resume for the alarms worked out. I also tried this package with the tosa image in the rc12/test directory as well.

todd
clofland
Just a quick note on 'at' usage. It took me a while to figure this out, so I thought I'd share it. 'at' is just a shell script. 'cat /usr/bin/at' will make a lot of things clear.

If you want to schedule a job to run 20 minutes in the future, you can just run:

at -f job "$(date -d20minute)"

The 'at' script uses the 'date' command to interpret what you give it, so format your time/date string so that 'date' can handle it, and 'at' will be happy and do the right thing.
karlto
QUOTE(sashz @ Dec 14 2005, 06:13 PM)
QUOTE(trichmon @ Dec 13 2005, 01:27 PM)
I will echo karlto.  With a clean flash of RC12 atd works fine except it for the wake form suspend issue.
*

no running ntpd or somelike utils which can modify hardware clock?

just tried atd with SL-C760, work fine.
*



I don't have any of that running either (except atd to try it out). I have no data to lose at present, so if there is anything you would like me to test, let me know...
clofland
The 'chat' program, which is run from pppd to make a PPP connection doesn't work when run from an 'at' job.

I can't tell if it is just not sending data to the serial port, or if it doesn't get any response.

Any ideas?

All works fine from any normal script, just not an 'at' job. sad.gif

Does anyone know a simple way to have pppd drop me to an intereactive session with the serial port, instead of turning the session over to 'chat'?

(This is a BlueTooth connection, if that helps.)
karlto
Hi all

Still not having any joy with the SL6000 waking up on alarm - I have started a new thread here:

SL6000 Wake On Alarm

as it is starting to get a little off topic here...
Zumi
Hi!

OK, so thanks for the work of cattin and sashz and others, I think I made a working solution with atd and the ~/.kopi_* files. It's a script for the /etc/apm/ directory. It runs on suspend and resume and makes files in the /var/spool/at directory, so it wakes up the Z before (-10 sec) an alarm event.
This means you still have to have KO/Pi running in the background but let's hope that atd makes everything nicer than apmsleep. You also need atd installed (it's available in the 1.1.0beta1 feeds) and I guess you need a kdepim that is compiled with the sampling rate option '-r ...' removed (for example the one cattin posted in the first post) to play sounds with KO/Pi.
I think that's all.

So, please try it out, give feedback!

Click to view attachment

Zumi smile.gif
david_dahan
QUOTE(Zumi @ Jan 6 2006, 12:11 AM)
Hi!

OK, so thanks for the work of cattin and sashz and others, I think I made a working solution with atd and the ~/.kopi_* files. It's a script for the /etc/apm/ directory. It runs on suspend and resume and makes files in the /var/spool/at directory, so it wakes up the Z before (-10 sec) an alarm event.
This means you still have to have KO/Pi running in the background but let's hope that atd makes everything nicer than apmsleep. You also need atd installed (it's available in the 1.1.0beta1 feeds) and I guess you need a kdepim that is compiled with the sampling rate option '-r ...' removed (for example the one cattin posted in the first post) to play sounds with KO/Pi.
I think that's all.

So, please try it out, give feedback!

Click to view attachment

Zumi smile.gif
*



Hi Zumi,

I tryed your package , it works perfectly .

many thanks,
David.
Zumi
QUOTE(david_dahan @ Jan 8 2006, 12:47 AM)
Hi Zumi,

I tryed your package , it works perfectly .

many thanks,
David.
*

Thanks for the feedback! I guess this doesn't get enough publicity this way, hidden in the end of this topic. unsure.gif
I think I post a fresh topic about it there must be more people who need this. Five downloads since days? No way. smile.gif

Zumi
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.