summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/opiealarm/opiealarm.c36
-rwxr-xr-xroot/etc/resume-scripts/R46opiealarm2
2 files changed, 25 insertions, 13 deletions
diff --git a/core/opiealarm/opiealarm.c b/core/opiealarm/opiealarm.c
index 3a06236..ac98832 100644
--- a/core/opiealarm/opiealarm.c
+++ b/core/opiealarm/opiealarm.c
@@ -32,3 +32,3 @@ FILE *log; // debug only
-int resume ( void );
+int resume ( int resuspend );
int suspend ( void );
@@ -75,3 +75,6 @@ void usage ( void )
{
- fprintf ( stderr, "Usage: opiealarm -r|-s\n" );
+ fprintf ( stderr, "Usage: opiealarm -r|-s [-a]\n\n" );
+ fprintf ( stderr, "\t-s\tSuspend mode: set RTC alarm\n" );
+ fprintf ( stderr, "\t-r\tResume mode: kill running opiealarm\n" );
+ fprintf ( stderr, "\t-a <x>\tResuspend in <x> seconds (resume mode)\n\n" );
exit ( 1 );
@@ -141,5 +144,6 @@ int main ( int argc, char **argv )
int mode = 0;
+ int ac_resusp = 0;
int opt;
- while (( opt = getopt ( argc, argv, "rs" )) != EOF ) {
+ while (( opt = getopt ( argc, argv, "a:rs" )) != EOF ) {
switch ( opt ) {
@@ -151,2 +155,10 @@ int main ( int argc, char **argv )
break;
+ case 'a':
+ ac_resusp = atoi ( optarg );
+ if ( ac_resusp < 30 ) {
+ ac_resusp = 120;
+
+ fprintf ( stderr, "Warning: resuspend timeout must be >= 30 sec. -- now set to 120 sec\n" );
+ }
+ break;
default:
@@ -168,7 +180,7 @@ int main ( int argc, char **argv )
- if ( mode == 'r' )
- return resume ( );
- else
- return suspend ( );
-
+ switch ( mode ) {
+ case 'r': return resume ( ac_resusp );
+ case 's':
+ default : return suspend ( );
+ }
return 0;
@@ -264,3 +276,3 @@ static int onac ( void )
-int resume ( void )
+int resume ( int resuspend )
{
@@ -271,3 +283,3 @@ int resume ( void )
if ( !opiealarm_was_running ) { // opiealarm -s got it's RTC signal -> wake up by RTC
- if ( onac ( )) {
+ if ( resuspend && onac ( )) {
time_t start, now;
@@ -278,3 +290,3 @@ int resume ( void )
- // sleep 120sec (not less!)
+ // sleep <resuspend> sec (not less!)
time ( &start );
@@ -283,3 +295,3 @@ int resume ( void )
time ( &now );
- } while (( now - start ) < 120 );
+ } while (( now - start ) < resuspend );
diff --git a/root/etc/resume-scripts/R46opiealarm b/root/etc/resume-scripts/R46opiealarm
index c258047..169dc30 100755
--- a/root/etc/resume-scripts/R46opiealarm
+++ b/root/etc/resume-scripts/R46opiealarm
@@ -4,2 +4,2 @@
-/opt/QtPalmtop/bin/opiealarm -r
+/opt/QtPalmtop/bin/opiealarm -r -a 120