-rw-r--r-- | core/opiealarm/opiealarm.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/opiealarm/opiealarm.c b/core/opiealarm/opiealarm.c index 465e633..998cabd 100644 --- a/core/opiealarm/opiealarm.c +++ b/core/opiealarm/opiealarm.c | |||
@@ -1,29 +1,29 @@ | |||
1 | /* | 1 | /* |
2 | * opiealarm.c | 2 | * opiealarm.c |
3 | * | 3 | * |
4 | * This program is for extracting the event time/date out | 4 | * This program is for extracting the event time/date out |
5 | * of /etc/resumeat and setting the RTC alarm to that time/date. | 5 | * of /var/run/resumeat and setting the RTC alarm to that time/date. |
6 | * It is designed to run via a script just before the iPAQ | 6 | * It is designed to run via a script just before the iPAQ |
7 | * is suspended and right after the iPAQ resumes operation. | 7 | * is suspended and right after the iPAQ resumes operation. |
8 | * | 8 | * |
9 | * written and copyrighted by Robert Griebl <sandman@handhelds.org> | 9 | * written and copyrighted by Robert Griebl <sandman@handhelds.org> |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <stdio.h> | 12 | #include <stdio.h> |
13 | #include <linux/rtc.h> | 13 | #include <linux/rtc.h> |
14 | #include <sys/ioctl.h> | 14 | #include <sys/ioctl.h> |
15 | #include <sys/time.h> | 15 | #include <sys/time.h> |
16 | #include <sys/types.h> | 16 | #include <sys/types.h> |
17 | #include <fcntl.h> | 17 | #include <fcntl.h> |
18 | #include <unistd.h> | 18 | #include <unistd.h> |
19 | #include <errno.h> | 19 | #include <errno.h> |
20 | #include <time.h> | 20 | #include <time.h> |
21 | #include <stdlib.h> | 21 | #include <stdlib.h> |
22 | #include <syslog.h> | 22 | #include <syslog.h> |
23 | #include <signal.h> | 23 | #include <signal.h> |
24 | #include <errno.h> | 24 | #include <errno.h> |
25 | #include <string.h> | 25 | #include <string.h> |
26 | 26 | ||
27 | 27 | ||
28 | #define PIDFILE "/var/run/opiealarm.pid" | 28 | #define PIDFILE "/var/run/opiealarm.pid" |
29 | #define TIMEFILE "/var/run/resumeat" | 29 | #define TIMEFILE "/var/run/resumeat" |
@@ -350,34 +350,34 @@ int resume ( int resuspend ) | |||
350 | 350 | ||
351 | // sleep <resuspend> seconds - this method is much more precise than sleep() ! | 351 | // sleep <resuspend> seconds - this method is much more precise than sleep() ! |
352 | time ( &start ); | 352 | time ( &start ); |
353 | do { | 353 | do { |
354 | sleep ( 1 ); | 354 | sleep ( 1 ); |
355 | time ( &now ); | 355 | time ( &now ); |
356 | } while (( now - start ) < resuspend ); | 356 | } while (( now - start ) < resuspend ); |
357 | 357 | ||
358 | if ( onac ( )) { // still on ac ? | 358 | if ( onac ( )) { // still on ac ? |
359 | argv[0] = "qcop"; | 359 | argv[0] = "qcop"; |
360 | argv[1] = "QPE/Desktop"; | 360 | argv[1] = "QPE/Desktop"; |
361 | argv[2] = "suspend()"; | 361 | argv[2] = "suspend()"; |
362 | argv[3] = 0; | 362 | argv[3] = 0; |
363 | 363 | ||
364 | // hard coded for now ...but needed | 364 | // hard coded for now ...but needed |
365 | // another way would be to simulate a power-button press | 365 | // another way would be to simulate a power-button press |
366 | 366 | ||
367 | setenv ( "LOGNAME", "root", 1 ); | 367 | setenv ( "LOGNAME", "root", 1 ); |
368 | setenv ( "HOME", "/root", 1 ); | 368 | setenv ( "HOME", "/root", 1 ); |
369 | setenv ( "LD_LIBRARY_PATH", "/opt/QtPalmtop/lib", 1 ); | 369 | setenv ( "LD_LIBRARY_PATH", "/opt/QtPalmtop/lib", 1 ); |
370 | setenv ( "QTDIR", "/opt/QtPalmtop", 1 ); | 370 | setenv ( "QTDIR", "/opt/QtPalmtop", 1 ); |
371 | 371 | ||
372 | remove_pidfile ( ); | 372 | remove_pidfile ( ); |
373 | 373 | ||
374 | // no need for system() since this process is no longer usefull anyway | 374 | // no need for system() since this process is no longer usefull anyway |
375 | execv ( "/opt/QtPalmtop/bin/qcop", argv ); | 375 | execv ( "/opt/QtPalmtop/bin/qcop", argv ); |
376 | 376 | ||
377 | perror ( "exec for qcop failed" ); | 377 | perror ( "exec for qcop failed" ); |
378 | return 5; | 378 | return 5; |
379 | } | 379 | } |
380 | } | 380 | } |
381 | } | 381 | } |
382 | return 0; | 382 | return 0; |
383 | } | 383 | } |