summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorPaul Sokolovsky <pmiscml@gmail.com>2007-12-31 16:03:00 +0000
committerPaul Sokolovsky <pmiscml@gmail.com>2007-12-31 16:03:00 +0000
commita23d5bfd390b32cd85f03ceb9f8ee9b05deb0168 (patch)
tree724d25be92a12729842a538fb1598dc03433a0ce /packages
parentb94ef855cc784eb638acc902f20f9143d5c61bf3 (diff)
ipaq-sleep 0.9: Remove supposed fixes for all bugs except the most prominent one.
* Apparently, it was big, big mistake to touch this code. Code Police, thy curse can't be lifted, let Perl be my witness! * Leave only obvious fix (off-by one error) for #3540. * Fixes #3586. (Well, it should. Noone really have reported that ipaq-sleep does *not* use 100% of CPU time during its normal course of action.) * This puts average latency of backlight coming back up after it was power-saved and touch/keypress happens to 1 second (which was the matter of other fixes, which reduced latency to ~0.2s).
Diffstat (limited to 'packages')
-rw-r--r--packages/ipaq-sleep/files/unbreak.patch173
-rw-r--r--packages/ipaq-sleep/ipaq-sleep_0.9.bb2
2 files changed, 1 insertions, 174 deletions
diff --git a/packages/ipaq-sleep/files/unbreak.patch b/packages/ipaq-sleep/files/unbreak.patch
index 5884bf69e1..5116e9957f 100644
--- a/packages/ipaq-sleep/files/unbreak.patch
+++ b/packages/ipaq-sleep/files/unbreak.patch
@@ -1,39 +1,5 @@
--- a/ipaq-sleep.c.org 2006-01-20 19:43:14.000000000 +0200
+++ a/ipaq-sleep.c 2007-12-26 06:26:32.000000000 +0200
-@@ -27,14 +27,14 @@
- #include <X11/Xlib.h>
- #include <X11/extensions/scrnsaver.h>
-
--#undef DEBUG
-+#define DEBUG
-
- int irqs[MAX_IRQS]; /* irqs to examine have a value of 1 */
- long v, irq_count[MAX_IRQS]; /* holds previous counters of the irq's */
- int sleep_idle=3 * 60; /* in seconds */
- int dim_idle=1 * 60; /* in seconds */
- int daemonize=1;
--int sleep_time = DEFAULT_SLEEP_TIME;
-+int sleep_time = 1; //DEFAULT_SLEEP_TIME;
- int cpu=1;
- int apm=1;
- int dimming=1;
-@@ -57,6 +57,7 @@
- Window root; /* The root window (which holds MIT_SCREEN_SAVER
- info). */
- XScreenSaverInfo *info; /* The MIT_SCREEN_SAVER info object. */
-+int xfd = -1;
-
- int init() {
- int first_event, first_error;
-@@ -69,6 +70,8 @@
- else {
- XScreenSaverQueryExtension(dpy, &first_event, &first_error);
- root = DefaultRootWindow(dpy);
-+ XSelectInput(dpy, root, KeyPressMask | KeyReleaseMask | PointerMotionMask);
-+ xfd = ConnectionNumber(dpy);
- info = XScreenSaverAllocInfo();
- #ifdef DEBUG
- if (debug)
@@ -108,7 +111,7 @@
if (fgets (buf, 32, input))
{
@@ -43,142 +9,3 @@
else
r = -1;
}
-@@ -189,7 +192,7 @@
- if (strcmp(func, Lflag)==0) {
- dim_level=atoi(value);
- #ifdef DEBUG
-- if (debug) fprintf(dgfp, "dim_idle=%d\n", dim_idle);
-+ if (debug) fprintf(dgfp, "dim_level=%d\n", dim_idle);
- #endif
- }
- if (strcmp(func, aflag)==0) {
-@@ -282,6 +285,12 @@
- dimming=0;
- }
- }
-+ if (strcmp(func, Lflag)==0) {
-+ dim_level=atoi(value);
-+#ifdef DEBUG
-+ if (debug) fprintf(dgfp, "dim_level=%d\n", dim_idle);
-+#endif
-+ }
- if (strcmp(func, aflag)==0) {
- apm=atoi(value);
- #ifdef DEBUG
-@@ -487,8 +496,11 @@
- return(1);
- }
-
-+ if (info.ac_line_status == AC_LINE_STATUS_UNKNOWN || info.battery_status == BATTERY_STATUS_UNKNOWN)
-+ return(0);
-+
- #ifdef DEBUG
-- if (debug) fprintf(dgfp,"You are NOT on external power. Its all good.....\n");
-+ if (debug) fprintf(dgfp,"You are NOT on external power. Line status: %d, battery status: %d.\n", info.ac_line_status, info.battery_status);
- #endif
- runtime = info.battery_time;
- if (apm && runtime >= 0 && runtime < battery_level)
-@@ -587,12 +599,17 @@
-
- }
-
-+/* X idle status checked every sleep_time,
-+ other boring and expensive stuff - sleep_time * CYCLE_INTERLEAVE */
-+#define CYCLE_INTERLEAVE 10
-+
- /* Keep checking the interrupts. As long as there is activity, do nothing. */
- void main_loop (void) {
-- int activity, i, total_unused=0, apm_active=0, old_apm=0;
-+ int activity, i, apm_active=0, old_apm=0, last_active = time(NULL);
- int dimmed=0, current_bl=32;
- int newIdle, oldIdle, lastIdle, oldTime, newTime;
- char iline[64];
-+ int cycle = 0;
-
- Time idleTime; /* milliseconds */
- FILE *f;
-@@ -656,6 +673,9 @@
- if (dimming && !dimmed && !apm_active) {
- if ((newIdle-oldIdle)>=dim_idle) {
- current_bl = read_backlight ();
-+#ifdef DEBUG
-+ if (debug) fprintf(dgfp, "Dim timeout. Current bl value=%d, setting to=%d\n", current_bl, dim_level);
-+#endif
- set_backlight (dim_level);
- dimmed=1;
- }
-@@ -664,6 +684,11 @@
- lastIdle=newIdle;
-
- }
-+
-+ cycle++;
-+ cycle %= CYCLE_INTERLEAVE;
-+ if (cycle)
-+ goto sleep;
-
- apm_active=check_apm();
- if (apm_active) {
-@@ -698,17 +723,15 @@
- }
-
- if (activity) {
-- total_unused = 0;
-+ last_active = time(NULL);
- }
- else {
-- total_unused += sleep_time;
-- if (total_unused >= sleep_idle && sleeping) {
-+ if (time(NULL) - last_active >= sleep_idle && sleeping) {
-
- if (check_cpu() || check_PID() || probe_IRQs()) {
- #ifdef DEBUG
- if (debug) fprintf(dgfp,"You cannot sleep at this time! Not going to sleep....\n");
- #endif
-- total_unused=0;
- oldIdle=newIdle;
- }
- else {
-@@ -718,24 +741,37 @@
- do_sleep ();
- set_backlight (current_bl);
- dimmed=0;
-- total_unused=0;
-+ last_active = time(NULL);
- }
- }
-
- }
-
-+sleep:
- #ifdef DEBUG
- if (debug) fflush(dgfp);
- #endif
-- sleep(sleep_time);
-+ {
-+ struct timeval tv;
-+ fd_set readset;
-+ FD_ZERO(&readset);
-+ if (xfd != -1)
-+ FD_SET(xfd, &readset);
-+ tv.tv_sec = 1;
-+ tv.tv_usec = 0;
-+#ifdef DEBUG
-+ if (debug) fprintf(dgfp, "select=%d, tv_sec=%d, tv_usec=%d\n", select(xfd+1, &readset, NULL, NULL, &tv), tv.tv_sec, tv.tv_usec);
-+#endif
-+ }
-+
-
- newTime=time(NULL);
-- if (oldTime && newTime-sleep_time > oldTime +1) {
-+ if (oldTime && newTime-sleep_time > oldTime +2) {
- #ifdef DEBUG
- if (debug)
-- fprintf(stderr, "%i sec sleep; resetting timer and resetting dimmer...", (int)(newTime - oldTime));
-+ fprintf(dgfp, "%i sec sleep, apparently, was suspended; resetting timer and resetting dimmer...", (int)(newTime - oldTime));
- #endif
-- total_unused=0;
-+ last_active = time(NULL);
-
- query_idle(&idleTime);
- lastIdle=oldIdle=(int)idleTime;
diff --git a/packages/ipaq-sleep/ipaq-sleep_0.9.bb b/packages/ipaq-sleep/ipaq-sleep_0.9.bb
index 005c606c29..a3fcbdf270 100644
--- a/packages/ipaq-sleep/ipaq-sleep_0.9.bb
+++ b/packages/ipaq-sleep/ipaq-sleep_0.9.bb
@@ -10,7 +10,7 @@ SRC_URI_append = " file://init-script-busybox.patch;patch=1"
SRC_URI_append = " file://install-fix.patch;patch=1"
SRC_URI_append = " file://unbreak.patch;patch=1"
-PR = "r5"
+PR = "r6"
DESCRIPTION = "Automatic sleep/suspend control daemon"