Bug#566843: fix pal to not wake up ten times a second in interactive mode

2010-01-28 Thread Martijn van Oosterhout
Is the signal handling the only reason why there's a timeout at all?
Because if so it seems a better solution would be to fix the code not
to timeout at all...

Have a nice day,

On Mon, Jan 25, 2010 at 03:01:45PM +0100, Uli Martens wrote:
> Package: pal
> Version: 0.4.3-5
> Severity: wishlist
> Tags: patch
> 
> Hi Carsten,
> 
> right now, pal wakes up every 0.1s when started with -m. This is bad for my
> battery. Attached is a patch to only wake up every 25.5s. Please note that
> keypresses still are going to be reported back to pal at once by ncurses, the
> only drawback I'm aware of is that interrupt handling can be delayed as pal
> records them but can only do its actions after the ncurses-timeout of 25.5s
> happened, for example after an SIGWINCH (window-resize).
> 
> thanks,
>   youam

> diff -u pal-0.4.3/debian/changelog pal-0.4.3/debian/changelog
> --- pal-0.4.3/debian/changelog
> +++ pal-0.4.3/debian/changelog
> @@ -1,3 +1,9 @@
> +pal (0.4.3-3.1) unstable; urgency=low
> +
> +  * make pal wake up less often in manage mode
> +
> + -- Uli Martens   Thu, 26 Feb 2009 05:21:12 +0100
> +
>  pal (0.4.3-3) unstable; urgency=low
>  
>* Recode austria.pal from ISO-8859 to UTF-8.  (Closes: #499389)
> diff -u pal-0.4.3/debian/patches/series pal-0.4.3/debian/patches/series
> --- pal-0.4.3/debian/patches/series
> +++ pal-0.4.3/debian/patches/series
> @@ -3,0 +4 @@
> +52_debian_make_pal_manage_wake_up_less_often.patch
> only in patch2:
> unchanged:
> --- 
> pal-0.4.3.orig/debian/patches/52_debian_make_pal_manage_wake_up_less_often.patch
> +++ 
> pal-0.4.3/debian/patches/52_debian_make_pal_manage_wake_up_less_often.patch
> @@ -0,0 +1,16 @@
> +pal (0.4.3-3)  * pal -m used to wake up every tenth of a second. ncurses
> + enforces a maximum sleep time of 25.5 seconds, which is 
> still
> + a lot better when you're running on battery
> +
> +--- pal-0.4.3.orig/src/manage.c
>  pal-0.4.3/src/manage.c
> +@@ -413,7 +413,8 @@
> + keypad(stdscr, TRUE);  /* enable keyboard mapping */
> + (void) nonl(); /* tell curses not to do NL->CR/NL on output */
> + (void) cbreak();   /* take input chars one at a time, no wait for 
> \n */
> +-(void) halfdelay(1);   /* always return from getch() within a tenth of 
> a second */
> ++(void) halfdelay(255); /* try not to wake up. ncurses still forces a 
> wakeup
> ++  every 25.5 seconds when in 
> non-linebuffered-mode */
> + (void) noecho();   /* echo input - in color */
> + 
> + signal(SIGINT, pal_manage_finish);   /* setup function to call on 
> Ctrl+C */


-- 
Martijn van Oosterhout  http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while 
> boarding. Thank you for flying nlogn airlines.



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#566843: fix pal to not wake up ten times a second in interactive mode

2010-01-25 Thread Uli Martens
Package: pal
Version: 0.4.3-5
Severity: wishlist
Tags: patch

Hi Carsten,

right now, pal wakes up every 0.1s when started with -m. This is bad for my
battery. Attached is a patch to only wake up every 25.5s. Please note that
keypresses still are going to be reported back to pal at once by ncurses, the
only drawback I'm aware of is that interrupt handling can be delayed as pal
records them but can only do its actions after the ncurses-timeout of 25.5s
happened, for example after an SIGWINCH (window-resize).

thanks,
youam
diff -u pal-0.4.3/debian/changelog pal-0.4.3/debian/changelog
--- pal-0.4.3/debian/changelog
+++ pal-0.4.3/debian/changelog
@@ -1,3 +1,9 @@
+pal (0.4.3-3.1) unstable; urgency=low
+
+  * make pal wake up less often in manage mode
+
+ -- Uli Martens   Thu, 26 Feb 2009 05:21:12 +0100
+
 pal (0.4.3-3) unstable; urgency=low
 
   * Recode austria.pal from ISO-8859 to UTF-8.  (Closes: #499389)
diff -u pal-0.4.3/debian/patches/series pal-0.4.3/debian/patches/series
--- pal-0.4.3/debian/patches/series
+++ pal-0.4.3/debian/patches/series
@@ -3,0 +4 @@
+52_debian_make_pal_manage_wake_up_less_often.patch
only in patch2:
unchanged:
--- pal-0.4.3.orig/debian/patches/52_debian_make_pal_manage_wake_up_less_often.patch
+++ pal-0.4.3/debian/patches/52_debian_make_pal_manage_wake_up_less_often.patch
@@ -0,0 +1,16 @@
+pal (0.4.3-3)  * pal -m used to wake up every tenth of a second. ncurses
+ enforces a maximum sleep time of 25.5 seconds, which is still
+ a lot better when you're running on battery
+
+--- pal-0.4.3.orig/src/manage.c
 pal-0.4.3/src/manage.c
+@@ -413,7 +413,8 @@
+ keypad(stdscr, TRUE);  /* enable keyboard mapping */
+ (void) nonl(); /* tell curses not to do NL->CR/NL on output */
+ (void) cbreak();   /* take input chars one at a time, no wait for \n */
+-(void) halfdelay(1);   /* always return from getch() within a tenth of a second */
++(void) halfdelay(255); /* try not to wake up. ncurses still forces a wakeup
++  every 25.5 seconds when in non-linebuffered-mode */
+ (void) noecho();   /* echo input - in color */
+ 
+ signal(SIGINT, pal_manage_finish);   /* setup function to call on Ctrl+C */