cattin doesn't have a personal statement currently.
Gender Not Set
Joined: 24-July 05
Profile Views: 446*
Last Seen: 11th December 2006 - 11:36 PM
Local Time: Apr 26 2017, 12:25 AM
18 posts (0 per day)
* Profile views updated each hour
4 Dec 2005
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:
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?
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
Other users have left no comments for cattin.
There are no friends to display.
|Lo-Fi Version||Time is now: 25th April 2017 - 02:25 PM|