summaryrefslogtreecommitdiff
path: root/recipes/ffalarms
diff options
context:
space:
mode:
authorMartin Jansa <Martin.Jansa@gmail.com>2009-11-18 09:26:06 +0100
committerMartin Jansa <Martin.Jansa@gmail.com>2009-11-18 09:57:44 +0100
commit6cc72681e13ae441ebb6af30f7f183b7d19f0f43 (patch)
treeb726b109b685ce3114a5415a45aeb2e1f50eda8c /recipes/ffalarms
parenta24c1e613252bdd25b000c9452642b35799ef510 (diff)
ffalarms: new recipe from SHR
Diffstat (limited to 'recipes/ffalarms')
-rw-r--r--recipes/ffalarms/atd-over-fso/atd-alarm-glue.patch14
-rw-r--r--recipes/ffalarms/atd-over-fso/atd-over-fso.conf.patch13
-rw-r--r--recipes/ffalarms/atd-over-fso/atd-startup-restart.patch17
-rw-r--r--recipes/ffalarms/atd-over-fso/atd-startup.patch39
-rw-r--r--recipes/ffalarms/atd-over-fso/init.d-atd-restart.patch17
-rw-r--r--recipes/ffalarms/atd-over-fso/no-oknodo.patch11
-rw-r--r--recipes/ffalarms/atd-over-fso/run-over-fso.patch505
-rw-r--r--recipes/ffalarms/atd-over-fso_0.70.bb46
-rw-r--r--recipes/ffalarms/ffalarms/shr.patch11
-rw-r--r--recipes/ffalarms/ffalarms_0.2.2.bb23
-rw-r--r--recipes/ffalarms/ffalarms_svn.bb36
11 files changed, 732 insertions, 0 deletions
diff --git a/recipes/ffalarms/atd-over-fso/atd-alarm-glue.patch b/recipes/ffalarms/atd-over-fso/atd-alarm-glue.patch
new file mode 100644
index 0000000000..66a268ce2b
--- /dev/null
+++ b/recipes/ffalarms/atd-over-fso/atd-alarm-glue.patch
@@ -0,0 +1,14 @@
+--- Makefile-orig 2003-03-23 19:46:26.000000000 +0100
++++ Makefile 2009-03-16 19:39:39.000000000 +0100
+@@ -10,6 +10,11 @@
+ rm -f atq
+ ln -s atd atq
+
++atd.o: atd-alarm-glue.h
++
++atd-alarm-glue.h: atd-alarm.xml
++ dbus-binding-tool --prefix=atd_alarm --mode=glib-server $< --output=$@
++
+ dist: atd
+ cp atd dist/usr/sbin/
+ rm dist/usr/bin/atq
diff --git a/recipes/ffalarms/atd-over-fso/atd-over-fso.conf.patch b/recipes/ffalarms/atd-over-fso/atd-over-fso.conf.patch
new file mode 100644
index 0000000000..6b6bebaa0f
--- /dev/null
+++ b/recipes/ffalarms/atd-over-fso/atd-over-fso.conf.patch
@@ -0,0 +1,13 @@
+--- /dev/null 2009-03-26 10:57:36.511814417 +0100
++++ dist/etc/dbus-1/system.d/atd-over-fso.conf 2009-03-29 03:15:37.000000000 +0200
+@@ -0,0 +1,10 @@
++<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
++ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
++<busconfig>
++ <policy user="root">
++ <allow own="org.openmoko.projects.ffalarms.atd"/>
++ <allow send_path="/"/>
++ <allow send_destination="org.openmoko.projects.ffalarms.atd"/>
++ <allow receive_sender="org.openmoko.projects.ffalarms.atd"/>
++ </policy>
++</busconfig>
diff --git a/recipes/ffalarms/atd-over-fso/atd-startup-restart.patch b/recipes/ffalarms/atd-over-fso/atd-startup-restart.patch
new file mode 100644
index 0000000000..adea0e1178
--- /dev/null
+++ b/recipes/ffalarms/atd-over-fso/atd-startup-restart.patch
@@ -0,0 +1,17 @@
+--- dist/etc/init.d/atd-orig 2009-03-29 14:20:09.000000000 +0200
++++ dist/etc/init.d/atd 2009-03-29 14:37:31.000000000 +0200
+@@ -20,9 +20,13 @@
+ rm -f /var/spool/at/trigger
+ echo "."
+ ;;
++ restart)
++ $0 stop
++ $0 start
++ ;;
+
+ *)
+- echo "Usage: /etc/init.d/atd {start|stop}"
++ echo "Usage: /etc/init.d/atd {start|stop|restart}"
+ exit 1
+ esac
+
diff --git a/recipes/ffalarms/atd-over-fso/atd-startup.patch b/recipes/ffalarms/atd-over-fso/atd-startup.patch
new file mode 100644
index 0000000000..dc4c1195d1
--- /dev/null
+++ b/recipes/ffalarms/atd-over-fso/atd-startup.patch
@@ -0,0 +1,39 @@
+? atd-startup.patch
+Index: ChangeLog
+===================================================================
+RCS file: /cvs/apps/atd/ChangeLog,v
+retrieving revision 1.2
+diff -B -b -u -r1.2 ChangeLog
+--- ChangeLog 2 Feb 2004 15:30:39 -0000 1.2
++++ ChangeLog 13 Jan 2006 11:54:00 -0000
+@@ -1,3 +1,8 @@
++2006-01-13 Florian Boor <florian@kernelconcepts.de>
++
++ * dist/etc/init.d/atd: Remove obsolete --oknodo and add -m to
++ enable pidfile.
++
+ V0.7
+ - removed waiting for childpid after having spawned an event
+ this caused trouble with events rescheduling themselves
+Index: dist/etc/init.d/atd
+===================================================================
+RCS file: /cvs/apps/atd/dist/etc/init.d/atd,v
+retrieving revision 1.3
+diff -B -b -u -r1.3 atd
+--- dist/etc/init.d/atd 24 Jan 2003 15:09:03 -0000 1.3
++++ dist/etc/init.d/atd 13 Jan 2006 11:54:00 -0000
+@@ -11,12 +11,12 @@
+ echo -n "Starting at daemon: atd"
+ mkdir -p /var/spool/at
+ chmod a+w /var/spool/at
+- start-stop-daemon --start --quiet --pidfile /var/run/atd.pid --exec /usr/sbin/atd /var/spool/at >/dev/null 2>&1 &
++ start-stop-daemon --start --quiet -m --pidfile /var/run/atd.pid --exec /usr/sbin/atd /var/spool/at >/dev/null 2>&1 &
+ echo "."
+ ;;
+ stop)
+ echo -n "Stopping at daemon: atd"
+- start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/atd.pid --exec /usr/sbin/atd
++ start-stop-daemon --stop --quiet --pidfile /var/run/atd.pid --exec /usr/sbin/atd
+ rm -f /var/spool/at/trigger
+ echo "."
+ ;;
diff --git a/recipes/ffalarms/atd-over-fso/init.d-atd-restart.patch b/recipes/ffalarms/atd-over-fso/init.d-atd-restart.patch
new file mode 100644
index 0000000000..11742d9937
--- /dev/null
+++ b/recipes/ffalarms/atd-over-fso/init.d-atd-restart.patch
@@ -0,0 +1,17 @@
+--- S97atd-orig 2009-03-29 11:59:02.000000000 +0200
++++ S97atd 2009-03-29 12:03:07.000000000 +0200
+@@ -20,9 +20,13 @@
+ rm -f /var/spool/at/trigger
+ echo "."
+ ;;
++ restart)
++ $0 stop
++ $0 start
++ ;;
+
+ *)
+- echo "Usage: /etc/init.d/atd {start|stop}"
++ echo "Usage: /etc/init.d/atd {start|stop|restart}"
+ exit 1
+ esac
+
diff --git a/recipes/ffalarms/atd-over-fso/no-oknodo.patch b/recipes/ffalarms/atd-over-fso/no-oknodo.patch
new file mode 100644
index 0000000000..e1eb2528ac
--- /dev/null
+++ b/recipes/ffalarms/atd-over-fso/no-oknodo.patch
@@ -0,0 +1,11 @@
+--- atd/dist/etc/init.d/atd.orig 2003-01-24 07:09:03.000000000 -0800
++++ atd/dist/etc/init.d/atd 2005-09-22 14:50:55.000000000 -0700
+@@ -16,7 +16,7 @@ case "$1" in
+ ;;
+ stop)
+ echo -n "Stopping at daemon: atd"
+- start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/atd.pid --exec /usr/sbin/atd
++ start-stop-daemon --stop --quiet --pidfile /var/run/atd.pid --exec /usr/sbin/atd
+ rm -f /var/spool/at/trigger
+ echo "."
+ ;;
diff --git a/recipes/ffalarms/atd-over-fso/run-over-fso.patch b/recipes/ffalarms/atd-over-fso/run-over-fso.patch
new file mode 100644
index 0000000000..425aca45fb
--- /dev/null
+++ b/recipes/ffalarms/atd-over-fso/run-over-fso.patch
@@ -0,0 +1,505 @@
+--- src/atd.c-orig 2004-02-02 16:30:39.000000000 +0100
++++ src/atd.c 2009-09-15 22:57:35.000000000 +0200
+@@ -7,10 +7,12 @@
+ * Copyright (C) 1996, Paul Gortmaker
+ * Copyright (C) 2001, Russell Nelson
+ * Copyright (C) 2002-2004, Nils Faerber <nils@handhelds.org>
++ * Copyright (C) 2009, Łukasz Pankowski <lukpank@o2.pl>
+ *
+ * Released under the GNU General Public License, version 2,
+ * included herein by reference.
+ *
++ * Łukasz Pankowski: modified to work over org.freesmartphone.otimed
+ */
+
+ #include <stdio.h>
+@@ -31,6 +33,16 @@
+ #include <dirent.h>
+ #include <pwd.h>
+ #include <signal.h>
++#include <glib.h>
++#include <dbus/dbus-glib.h>
++#include <dbus/dbus-glib-lowlevel.h>
++#include <dbus/dbus.h>
++#include "atd-alarm.h"
++#include "atd-alarm-glue.h"
++
++#define DBUS_NAME "org.openmoko.projects.ffalarms.atd"
++#define DBUS_RECONNECT_TIMEOUT 10
++#define OTIMED "org.freesmartphone.otimed"
+
+
+ /* globals... */
+@@ -62,33 +74,23 @@
+ }
+
+
+-void waitfor (time_t t)
++void rtc_set_time (void)
+ {
+-int rtcfd, tfd, retval= 0;
+-unsigned long data;
++int rtcfd, retval= 0;
+ struct rtc_time rtc_tm;
+-time_t now, then;
++time_t now;
+ struct tm *tm;
+-struct timeval tv;
+-int nfds;
+-fd_set afds;
+
+ #ifdef DEBUG
+- printf("waitfor %ld\n", t);
++ printf("rtc_set_time\n");
+ #endif
+ rtcfd = open ("/dev/rtc", O_RDONLY);
+
+ if (rtcfd == -1) {
++ /* treat it as warning, may be should retry? */
+ perror("/dev/rtc");
+- exit(errno);
+- }
+-
+- /* Read the RTC time/date */
+- tfd = open ("trigger", O_RDWR);
+-
+- if (tfd == -1) {
+- perror("trigger");
+- exit(errno);
++ errno = 0;
++ return;
+ }
+
+ /* Set the RTC time/date */
+@@ -112,112 +114,7 @@
+ rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
+ #endif
+
+- tm = gmtime (&t);
+-
+-#ifdef DEBUG
+- printf ("Alarm date/time is %d-%d-%d, %02d:%02d:%02d.\n",
+- tm->tm_mday, tm->tm_mon + 1, tm->tm_year + 1900,
+- tm->tm_hour, tm->tm_min, tm->tm_sec);
+-#endif
+- if (t && compare_rtc_to_tm (&rtc_tm, tm) >= 0) {
+- close (rtcfd);
+- close (tfd);
+- return;
+- }
+-
+- if (t) {
+- /* set the alarm */
+- rtc_tm.tm_mday = tm->tm_mday;
+- rtc_tm.tm_mon = tm->tm_mon;
+- rtc_tm.tm_year = tm->tm_year;
+- rtc_tm.tm_sec = tm->tm_sec;
+- rtc_tm.tm_min = tm->tm_min;
+- rtc_tm.tm_hour = tm->tm_hour;
+- retval = ioctl (rtcfd, RTC_ALM_SET, &rtc_tm);
+- if (retval == -1) {
+- perror ("ioctl");
+- exit (errno);
+- }
+-#ifdef DEBUG
+- printf ("Alarm date/time now set to %d-%d-%d, %02d:%02d:%02d.\n",
+- rtc_tm.tm_mday, rtc_tm.tm_mon + 1, rtc_tm.tm_year + 1900,
+- rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
+-#endif
+-
+- /* Read the current alarm settings */
+- retval = ioctl (rtcfd, RTC_ALM_READ, &rtc_tm);
+- if (retval == -1) {
+- perror ("ioctl");
+- exit (errno);
+- }
+-
+-#ifdef DEBUG
+- printf ("Alarm date/time now in RTC: %d-%d-%d, %02d:%02d:%02d.\n",
+- rtc_tm.tm_mday, rtc_tm.tm_mon + 1, rtc_tm.tm_year + 1900,
+- rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
+-#endif
+-
+- /* Enable alarm interrupts */
+- retval = ioctl (rtcfd, RTC_AIE_ON, 0);
+- if (retval == -1) {
+- perror ("ioctl");
+- exit (errno);
+- }
+- }
+-
+-#ifdef DEBUG
+- printf ("Waiting for alarm...");
+- fflush (stdout);
+-#endif
+- /* This blocks until the alarm ring causes an interrupt */
+- FD_ZERO (&afds);
+- if (t)
+- FD_SET (rtcfd, &afds);
+- FD_SET (tfd, &afds);
+- nfds = rtcfd+1;
+- if (tfd > rtcfd)
+- nfds = tfd + 1;
+- /* Wait up to ten minutes. */
+- tv.tv_sec = 10 * 60;
+- tv.tv_usec = 0;
+- then = now;
+- if (select (nfds, &afds, (fd_set *) 0, (fd_set *) 0, &tv) < 0) {
+- if (errno != EINTR)
+- perror ("select");
+- exit (errno);
+- }
+- now = time (NULL);
+-#ifdef DEBUG
+- printf ("While we were sleeping, %d seconds elapsed, but %d alarms passed\n",
+- (int)(now - then), (int)(tv.tv_sec));
+-#endif
+- if (FD_ISSET (rtcfd, &afds)) {
+- retval = read (rtcfd, &data, sizeof (unsigned long));
+- if (retval == -1) {
+- perror ("read");
+- exit (errno);
+- }
+- }
+- if (FD_ISSET(tfd, &afds)) {
+- retval = read (tfd, &data, 1);
+- if (retval == -1) {
+- perror ("read");
+- exit (errno);
+- }
+- }
+-#ifdef DEBUG
+- printf ("Something happened!\n");
+-#endif
+-
+- /* Disable alarm interrupts */
+- retval = ioctl (rtcfd, RTC_AIE_OFF, 0);
+- if (retval == -1) {
+- perror ("ioctl");
+- exit (errno);
+- }
+-
+ close (rtcfd);
+- close (tfd);
+ }
+
+
+@@ -345,11 +242,223 @@
+ }
+
+
++G_DEFINE_TYPE(AtdAlarm, atd_alarm, G_TYPE_OBJECT);
++
++
++static void atd_alarm_finalize (GObject* self) {
++ g_object_unref(((AtdAlarm*) self)->alarm_proxy);
++ G_OBJECT_CLASS (atd_alarm_parent_class)->finalize (self);
++}
++
++
++static void atd_alarm_class_init(AtdAlarmClass *cls)
++{
++ G_OBJECT_CLASS (cls)->finalize = atd_alarm_finalize;
++}
++
++
++static void atd_alarm_init(AtdAlarm *self)
++{
++}
++
++
++AtdAlarm* atd_alarm_new (char *spooldir)
++{
++AtdAlarm *self;
++
++ self = g_object_new(ATD_TYPE_ALARM, NULL);
++ if (self) {
++ self->bus = NULL;
++ self->alarm_proxy = NULL;
++ self->trigger = NULL;
++ }
++ return self;
++}
++
++
++gboolean input_on_trigger(GIOChannel *source, GIOCondition condition,
++ AtdAlarm *obj)
++{
++char data;
++
++ if (read (g_io_channel_unix_get_fd(source), &data, 1) == -1) {
++ perror ("read");
++ exit (errno);
++ }
++ atd_alarm_alarm(obj);
++
++ return TRUE;
++}
++
++
++void display_free_g_error(GError **error)
++{
++ if ((*error)->domain == DBUS_GERROR &&
++ (*error)->code == DBUS_GERROR_REMOTE_EXCEPTION)
++ g_printerr("Remote exception: %s: %s\n",
++ dbus_g_error_get_name(*error),
++ (*error)->message);
++ else
++ g_printerr("Error: %s\n", (*error)->message);
++ g_error_free(*error);
++ *error = NULL;
++}
++
++
++static void otimed_destroy(DBusGProxy *alarm_proxy, AtdAlarm *obj)
++{
++#ifdef DEBUG
++ printf("proxy for " OTIMED " destroyed\n");
++#endif
++ g_object_unref(obj->alarm_proxy);
++ obj->alarm_proxy = NULL;
++}
++
++
++void atd_alarm_connect_otimed(AtdAlarm *self)
++{
++GError *error;
++int tfd;
++
++ error = NULL;
++ self->alarm_proxy = dbus_g_proxy_new_for_name_owner
++ (self->bus, OTIMED, "/org/freesmartphone/Time/Alarm",
++ "org.freesmartphone.Time.Alarm", &error);
++ if (error != NULL) {
++ display_free_g_error(&error);
++ return;
++ }
++ g_signal_connect(self->alarm_proxy, "destroy",
++ G_CALLBACK(otimed_destroy), self);
++
++ /* if we are connected to otimed (so we know it is up and
++ * running) we can open the trigger
++ */
++ if (self->trigger)
++ return;
++ if (mkfifo ("trigger.new", 0777) < 0)
++ die ("cannot mkfifo trigger.new");
++ if (rename ("trigger.new","trigger"))
++ die ("cannot rename trigger.new");
++ chmod ("trigger", S_IWUSR | S_IWGRP | S_IWOTH);
++ tfd = open ("trigger", O_RDWR);
++ if (tfd == -1) {
++ perror("trigger");
++ exit(errno);
++ }
++ self->trigger = g_io_channel_unix_new(tfd);
++ g_io_add_watch(self->trigger, G_IO_IN,
++ (GIOFunc) input_on_trigger, self);
++}
++
++
++void atd_alarm_waitfor(AtdAlarm *self, time_t t)
++{
++GError *error;
++
++ if (!t)
++ return;
++
++ rtc_set_time();
++ error = NULL;
++ if (self->alarm_proxy == NULL) {
++ g_printerr(OTIMED " not running, could not call SetAlarm\n");
++ } else if (!dbus_g_proxy_call(self->alarm_proxy, "SetAlarm", &error,
++ G_TYPE_STRING, DBUS_NAME,
++ G_TYPE_INT, t, G_TYPE_INVALID,
++ G_TYPE_INVALID)) {
++ display_free_g_error(&error);
++ }
++#ifdef DEBUG
++ printf("DBus waitfor: %d\n", (int) t);
++#endif
++}
++
++
++void name_owner_changed(DBusGProxy *proxy, const char *name,
++ const char *prev_name, const char *new_name,
++ AtdAlarm *obj)
++{
++ if (!strcmp(name, OTIMED) && *new_name) {
++#ifdef DEBUG
++ printf("DBus NameOwnerChanged: " OTIMED "\n");
++#endif
++ atd_alarm_connect_otimed(obj);
++ atd_alarm_alarm(obj);
++ }
++}
++
++
++static void dbus_disconnected(DBusGProxy *obj, GMainLoop *ml)
++{
++ g_printerr("DBus disconnected\n");
++ g_main_loop_quit(ml);
++}
++
++
++void atd_alarm_start(AtdAlarm *self)
++//int start_atd_alarm(GIOChannel *trigger, int exit_on_error)
++{
++GMainLoop *ml;
++GError *error;
++DBusError dbus_error;
++DBusGProxy *proxy;
++int code;
++
++ error = NULL;
++ self->bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
++ if (!self->bus) {
++ g_printerr("failed to connect to DBUS: %s\n",
++ error->message);
++ g_error_free(error);
++ return;
++ }
++ dbus_error_init(&dbus_error);
++ code = dbus_bus_request_name
++ (dbus_g_connection_get_connection(self->bus),
++ DBUS_NAME, DBUS_NAME_FLAG_DO_NOT_QUEUE, &dbus_error);
++ if (code != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
++ if (code == -1)
++ g_printerr("Error: %s\n", dbus_error.message);
++ else
++ g_printerr("could not register name (%d): %s\n",
++ code, DBUS_NAME);
++ exit(1);
++ }
++ dbus_g_connection_register_g_object(self->bus, "/", G_OBJECT(self));
++ proxy = dbus_g_proxy_new_for_name(self->bus, "org.freedesktop.DBus",
++ "/org/freedesktop/DBus",
++ "org.freedesktop.DBus");
++ dbus_g_proxy_add_signal(proxy, "NameOwnerChanged", G_TYPE_STRING,
++ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
++ dbus_g_proxy_connect_signal(proxy, "NameOwnerChanged",
++ G_CALLBACK(name_owner_changed), self, NULL);
++ atd_alarm_connect_otimed(self);
++ atd_alarm_alarm(self);
++
++ ml = g_main_loop_new(NULL, FALSE);
++ g_signal_connect(proxy, "destroy", G_CALLBACK(dbus_disconnected), ml);
++ dbus_connection_set_exit_on_disconnect
++ (dbus_g_connection_get_connection(self->bus), FALSE);
++
++ g_main_loop_run(ml);
++
++ g_object_unref(proxy);
++ if (self->alarm_proxy)
++ g_object_unref(self->alarm_proxy);
++ self->alarm_proxy = NULL;
++ dbus_g_connection_unref(self->bus);
++ self->bus = NULL;
++ g_main_loop_unref(ml);
++
++ return;
++}
++
++
+ int main (int argc, char *argv[])
+ {
+-struct dirent *dirent;
+-unsigned long this, next, now;
+ char *argv0;
++AtdAlarm *obj;
+
+ argv0 = strrchr(argv[0], '/');
+ if (!argv0)
+@@ -362,17 +471,36 @@
+ die("cannot chdir");
+ if (!strcmp (argv0, "atq"))
+ exit_atq();
+- if (mkfifo ("trigger.new", 0777) < 0)
+- die ("cannot mkfifo trigger.new");
+- if (rename ("trigger.new","trigger"))
+- die ("cannot rename trigger.new");
+- chmod ("trigger", S_IWUSR | S_IWGRP | S_IWOTH);
+
+ /* ignore some signals we get from spawned processes */
+ signal (SIGCHLD, SIG_IGN);
+ signal (SIGPIPE, SIG_IGN);
+
++
++ g_type_init();
++ dbus_g_object_type_install_info(ATD_TYPE_ALARM,
++ &dbus_glib_atd_alarm_object_info);
++ obj = atd_alarm_new(argv[1]);
++ if (!obj) {
++ g_printerr("Failed to create AtdAlarm object");
++ exit(1);
++ }
+ while (1) {
++ atd_alarm_start(obj);
++ sleep(DBUS_RECONNECT_TIMEOUT);
++ }
++}
++
++
++gboolean atd_alarm_alarm(AtdAlarm *self)
++{
++struct dirent *dirent;
++unsigned long this, next, now;
++
++#ifdef DEBUG
++ printf("atd_alarm_alarm() run at: %d\n", (int) time(NULL));
++#endif
++
+ /* run all the jobs in the past */
+ now = time (NULL);
+ scan_from_top ();
+@@ -402,8 +530,7 @@
+ #endif
+ if (next == ULONG_MAX)
+ next = 0;
+- waitfor (next);
+- }
++ atd_alarm_waitfor (self, next);
+
+-return 0;
++ return TRUE;
+ }
+--- /dev/null 2009-09-15 19:51:58.514753360 +0200
++++ src/atd-alarm.h 2009-09-15 22:45:59.000000000 +0200
+@@ -0,0 +1,26 @@
++#ifndef ATD_ALARM_H
++#define ATD_ALARM_H
++
++#include <glib-object.h>
++#include <dbus/dbus-glib.h>
++
++#define ATD_TYPE_ALARM (atd_alarm_get_type())
++
++typedef struct _AtdAlarm
++{
++ GObject parent;
++ DBusGConnection *bus;
++ DBusGProxy *alarm_proxy;
++ GIOChannel *trigger;
++} AtdAlarm;
++
++typedef struct _AtdAlarmClass
++{
++ GObjectClass parent_class;
++} AtdAlarmClass;
++
++static gboolean atd_alarm_alarm(AtdAlarm *self);
++
++static void atd_alarm_waitfor(AtdAlarm *self, time_t t);
++
++#endif
+--- /dev/null 2009-09-15 19:51:58.514753360 +0200
++++ src/atd-alarm.xml 2009-03-16 17:55:48.000000000 +0100
+@@ -0,0 +1,8 @@
++<?xml version="1.0" encoding="UTF-8" ?>
++
++<node name="/">
++ <interface name="org.freesmartphone.Notification">
++ <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="atd_alarm" />
++ <method name="Alarm" />
++ </interface>
++</node>
diff --git a/recipes/ffalarms/atd-over-fso_0.70.bb b/recipes/ffalarms/atd-over-fso_0.70.bb
new file mode 100644
index 0000000000..951e10c66d
--- /dev/null
+++ b/recipes/ffalarms/atd-over-fso_0.70.bb
@@ -0,0 +1,46 @@
+DESCRIPTION = "Lightweight At Daemon working on top of org.freesmartphone.otimed"
+SECTION = "base"
+LICENSE = "GPLV2"
+RCONFLICTS = "at atd"
+RREPLACES = "at atd"
+RPROVIDES = "atd"
+DEPENDS = "dbus-glib pkgconfig"
+RDEPENDS += "dbus dbus-glib frameworkd"
+
+PR = "r2"
+
+SRC_URI = "${HANDHELDS_CVS};module=apps/atd;tag=ATD-0_70 \
+ file://atd-startup.patch;patch=1;pnum=0 \
+ file://atd-startup-restart.patch;patch=2;pnum=0 \
+ file://atd-alarm-glue.patch;patch=3;pnum=0 \
+ file://atd-over-fso.conf.patch;patch=4;pnum=0 \
+ file://run-over-fso.patch;patch=5;pnum=1"
+S = "${WORKDIR}/atd"
+
+inherit update-rc.d
+
+INITSCRIPT_NAME = "atd"
+INITSCRIPT_PARAMS = "defaults 97"
+
+do_compile() {
+ export CFLAGS="$CFLAGS `${STAGING_BINDIR_NATIVE}/pkg-config --cflags dbus-glib-1`"
+ export LDFLAGS="$LDFLAGS `${STAGING_BINDIR_NATIVE}/pkg-config --libs dbus-glib-1`"
+ oe_runmake
+}
+
+do_install() {
+ install -d ${D}${sbindir}
+ install atd ${D}${sbindir}/atd
+ install -d ${D}${sysconfdir}/init.d
+ install -d ${D}${sysconfdir}/dbus-1/system.d
+ install dist/etc/init.d/atd ${D}${sysconfdir}/init.d/atd
+ install dist/etc/dbus-1/system.d/atd-over-fso.conf ${D}${sysconfdir}/dbus-1/system.d/atd-over-fso.conf
+}
+
+updatercd_postinst_prepend() {
+/etc/init.d/dbus-1 reload
+}
+
+updatercd_postrm_append() {
+/etc/init.d/dbus-1 reload
+}
diff --git a/recipes/ffalarms/ffalarms/shr.patch b/recipes/ffalarms/ffalarms/shr.patch
new file mode 100644
index 0000000000..77a66d6583
--- /dev/null
+++ b/recipes/ffalarms/ffalarms/shr.patch
@@ -0,0 +1,11 @@
+--- ffalarms-0.2.4/ffalarms.vala 2009-09-21 14:05:09.000000000 +0200
++++ ffalarms-0.2.4/ffalarms.vala 2009-09-21 14:05:09.000000000 +0200
+@@ -27,7 +27,7 @@
+ "Could not contact atd daemon, the alarm may not work";
+ public const string COMMANDS = "alsactl amixer";
+ public const string ALSASTATE =
+- "/usr/share/openmoko/scenarios/stereoout.state";
++ "/usr/share/shr/scenarii/stereoout.state";
+
+
+ public errordomain MyError {
diff --git a/recipes/ffalarms/ffalarms_0.2.2.bb b/recipes/ffalarms/ffalarms_0.2.2.bb
new file mode 100644
index 0000000000..a280779d52
--- /dev/null
+++ b/recipes/ffalarms/ffalarms_0.2.2.bb
@@ -0,0 +1,23 @@
+DESCRIPTION = "Finger friendly alarms"
+HOMEPAGE = "http://ffalarms.projects.openmoko.org/"
+LICENSE = "GPLv3"
+AUTHOR = "Lukasz Pankowski <lukpank@o2.pl>"
+MAINTAINER = "Lukasz Pankowski <lukpank@o2.pl>"
+SECTION = "x11/applications"
+PRIORITY = "optional"
+DEPENDS = "edje-native python-native"
+
+# Pure Python plus Edje interface
+PACKAGE_ARCH = "all"
+
+SRC_URI = "http://projects.openmoko.org/frs/download.php/832/ffalarms-0.2.2.tar.gz"
+
+inherit distutils
+
+FILES_${PN} += "${datadir}/${PN} ${datadir}/applications/ffalarms.desktop ${datadir}/pixmaps"
+
+RDEPENDS += "python-re python-datetime python-edje python-ecore \
+ atd-over-fso alsa-utils-amixer alsa-utils-alsactl \
+ ttf-dejavu-sans"
+
+RSUGGESTS += "mplayer alsa-utils-aplay openmoko-alsa-scenarios"
diff --git a/recipes/ffalarms/ffalarms_svn.bb b/recipes/ffalarms/ffalarms_svn.bb
new file mode 100644
index 0000000000..a627a96ea6
--- /dev/null
+++ b/recipes/ffalarms/ffalarms_svn.bb
@@ -0,0 +1,36 @@
+DESCRIPTION = "Finger friendly alarms"
+HOMEPAGE = "http://ffalarms.projects.openmoko.org/"
+LICENSE = "GPLv3"
+AUTHOR = "Lukasz Pankowski <lukpank@o2.pl>"
+MAINTAINER = "Lukasz Pankowski <lukpank@o2.pl>"
+SECTION = "x11/applications"
+PRIORITY = "optional"
+DEPENDS = "elementary libeflvala libical"
+
+PV = "0.3.1+svnr${SRCPV}"
+PR = "r0"
+
+# needed because there is do_stage_append in vala.bbclass and do_stage() was removed..
+do_stage() {
+
+}
+
+inherit vala
+
+SRC_URI = "svn://svn.projects.openmoko.org/svnroot/ffalarms;module=trunk;proto=https"
+
+S = "${WORKDIR}/trunk"
+
+FILES_${PN} += "${datadir}/${PN} ${datadir}/applications ${datadir}/pixmaps"
+
+RDEPENDS = "atd alsa-utils-amixer alsa-utils-alsactl virtual/alsa-scenarios ttf-dejavu-sans libical"
+
+RSUGGESTS = "mplayer alsa-utils-aplay frameworkd"
+
+do_compile() {
+ oe_runmake VAPIDIR=${STAGING_DATADIR}/vala/vapi
+}
+
+do_install() {
+ oe_runmake install DESTDIR=${D}
+}