wmacpi: Bump to version 2.2rc4.
Source obtained from http://sourceforge.net/projects/wmacpi/files/. 2008 November 14 2.2rc4 Change the way that we sleep/wait for activity, to use select rather than a fixed-length sleep, supplied by Julien Blache of Debian: Hi, The attached patch for wmacpi makes it use select() instead of sleeping. It also adjusts the timeout of the select() call depending on the blink & scroll options. If scrolling is not activated, there's no reason to wake up 10x/sec. If blinking is activated, waking up once per second is enough. If blinking is not activated, then we can wake up just to update the data and we're fine. With scrolling and blinking disabled, this saves a number of wakeups and helps battery life. Unfortunately there's another source of wakeups that's probably due to libdockapp that still makes 6 wakeups/seconds (in another thread it seems). With this patch wmacpi makes a best effort to match the sample rate set by the user, but that's hardly an issue I think. I haven't released this patch yet in Debian, so if you like it and want to roll out a release, feel free :) Otherwise I'll add it to the package soon. Thanks, JB.
This commit is contained in:
parent
61cad1c561
commit
aa177b7402
1
wmacpi/.arch-ids/AUTHORS.id
Normal file
1
wmacpi/.arch-ids/AUTHORS.id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.0
|
1
wmacpi/.arch-ids/COPYING.id
Normal file
1
wmacpi/.arch-ids/COPYING.id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.1
|
1
wmacpi/.arch-ids/ChangeLog.id
Normal file
1
wmacpi/.arch-ids/ChangeLog.id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.2
|
1
wmacpi/.arch-ids/INSTALL.id
Normal file
1
wmacpi/.arch-ids/INSTALL.id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.3
|
1
wmacpi/.arch-ids/Makefile.id
Normal file
1
wmacpi/.arch-ids/Makefile.id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.4
|
1
wmacpi/.arch-ids/README.id
Normal file
1
wmacpi/.arch-ids/README.id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.5
|
1
wmacpi/.arch-ids/TODO.id
Normal file
1
wmacpi/.arch-ids/TODO.id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Simon Fowler <simon@himi.org> Sun Jul 11 11:59:50 2004 11909.0
|
1
wmacpi/.arch-ids/acpi.1.id
Normal file
1
wmacpi/.arch-ids/acpi.1.id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Simon Fowler <simon@himi.org> Sun Jul 11 13:18:00 2004 13139.0
|
1
wmacpi/.arch-ids/acpi.c.id
Normal file
1
wmacpi/.arch-ids/acpi.c.id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Simon Fowler <simon@himi.org> Sun Jul 11 12:21:51 2004 12157.0
|
1
wmacpi/.arch-ids/libacpi.c.id
Normal file
1
wmacpi/.arch-ids/libacpi.c.id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.6
|
1
wmacpi/.arch-ids/libacpi.h.id
Normal file
1
wmacpi/.arch-ids/libacpi.h.id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Simon Fowler <simon@himi.org> Sun Jul 11 12:18:57 2004 12091.0
|
1
wmacpi/.arch-ids/master.xpm.id
Normal file
1
wmacpi/.arch-ids/master.xpm.id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.10
|
1
wmacpi/.arch-ids/master_low.xpm.id
Normal file
1
wmacpi/.arch-ids/master_low.xpm.id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.11
|
1
wmacpi/.arch-ids/wmacpi.1.id
Normal file
1
wmacpi/.arch-ids/wmacpi.1.id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.22
|
1
wmacpi/.arch-ids/wmacpi.c.id
Normal file
1
wmacpi/.arch-ids/wmacpi.c.id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.8
|
1
wmacpi/.arch-ids/wmacpi.h.id
Normal file
1
wmacpi/.arch-ids/wmacpi.h.id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.9
|
2
wmacpi/.hg_archival.txt
Normal file
2
wmacpi/.hg_archival.txt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
repo: 9cde42e7fe71d3618c7c14b2f4fec73f079b283d
|
||||||
|
node: f0f8df2eb33c81247679bd10585a3d380b03ca60
|
35
wmacpi/.hgempty
Normal file
35
wmacpi/.hgempty
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
|
||||||
|
Empty original changeset by Simon Fowler <simon@himi.org>:
|
||||||
|
[project @ simon@himi.org--wmacpi/wmacpi--mainline--2.0--patch-2]
|
||||||
|
Fixes for compiling against libdockapp-0.5.0
|
||||||
|
This amounted to a four line patch - narrowing the type of
|
||||||
|
the dockapp width and height to an unsigned short.
|
||||||
|
|
||||||
|
Unfortunately this isn't compatible with libdockapp-0.4.0
|
||||||
|
now.
|
||||||
|
|
||||||
|
Empty original changeset by Simon Fowler <simon@himi.org>:
|
||||||
|
[project @ simon@himi.org--wmacpi/wmacpi--mainline--2.0--patch-3]
|
||||||
|
Upped version numbers for 2.1 release.
|
||||||
|
That's about it.
|
||||||
|
|
||||||
|
Empty original changeset by Simon Fowler <simon@himi.org>:
|
||||||
|
[project @ simon@himi.org--wmacpi/wmacpi--mainline--2.0--patch-4]
|
||||||
|
Small patch submitted by Patrice Dumas <pertusus at free.fr>
|
||||||
|
Keywords: libdockapp build fixes
|
||||||
|
Build fixes for newer versions of libdockapp.
|
||||||
|
|
||||||
|
Empty original changeset by Simon Fowler <simon@himi.org>:
|
||||||
|
[project @ simon@himi.org--wmacpi/wmacpi--mainline--2.0--patch-5]
|
||||||
|
Updated email address and changelog for alpha release.
|
||||||
|
Since my dreamcraft.com.au address will be going away at some point . . .
|
||||||
|
|
||||||
|
Empty original changeset by Simon Fowler <simon@himi.org>:
|
||||||
|
[project @ simon@himi.org--wmacpi/wmacpi--mainline--2.0--patch-6]
|
||||||
|
Fix for 'charged' battery status
|
||||||
|
Some batteries report their status as 'discharging' when they're
|
||||||
|
fully charged, some report their status as 'charged' - previously
|
||||||
|
I was only checking for 'discharging' when switching out of the
|
||||||
|
battery charging state, now we check for 'charged' as well.
|
||||||
|
|
||||||
|
This fixes part of Debian bug #393617.
|
3
wmacpi/.hgignore
Normal file
3
wmacpi/.hgignore
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
(^|/)\{arch\}($|/)
|
||||||
|
(^|/)\.hg($|/)
|
||||||
|
(^|/)\.hgtags($|/)
|
7
wmacpi/.hgtags
Normal file
7
wmacpi/.hgtags
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
8b1a90b86e0bf59867af5dc51de1db30b76458e7 v2.2rc1
|
||||||
|
98ed78c8c5450f8322ac92b8987037f7c60a8bb6 v2.2rc2
|
||||||
|
d3cffa90043a32ac2192a072454945631b664ebb v2.2rc2-1
|
||||||
|
dc57f7d93d9c0c5dd8a283ca3d1d48420c12b536 v2.2rc3
|
||||||
|
4be24f89e71d83589056ccbc38376867a6a25ffa v2.2rc3-1
|
||||||
|
bfff36bca604857508fe37552acbdcfe94fad31d v2.2rc4
|
||||||
|
8f72761f2fe3aeab65e04079e6253bb00fe957dc v2.2rc4-1
|
|
@ -1,4 +1,4 @@
|
||||||
Simon Fowler <simon@himi.or>
|
Simon Fowler <simon@himi.org>
|
||||||
Complete rewriting of the code from wmacpi-1.34.
|
Complete rewriting of the code from wmacpi-1.34.
|
||||||
|
|
||||||
timecop
|
timecop
|
||||||
|
|
|
@ -1,3 +1,36 @@
|
||||||
|
2008 November 14 2.2rc4
|
||||||
|
Change the way that we sleep/wait for activity, to use select
|
||||||
|
rather than a fixed-length sleep, supplied by Julien Blache of
|
||||||
|
Debian:
|
||||||
|
|
||||||
|
Hi,
|
||||||
|
|
||||||
|
The attached patch for wmacpi makes it use select() instead of
|
||||||
|
sleeping. It also adjusts the timeout of the select() call
|
||||||
|
depending on the blink & scroll options.
|
||||||
|
|
||||||
|
If scrolling is not activated, there's no reason to wake up
|
||||||
|
10x/sec. If blinking is activated, waking up once per second is
|
||||||
|
enough. If blinking is not activated, then we can wake up just to
|
||||||
|
update the data and we're fine.
|
||||||
|
|
||||||
|
With scrolling and blinking disabled, this saves a number of
|
||||||
|
wakeups and helps battery life. Unfortunately there's another
|
||||||
|
source of wakeups that's probably due to libdockapp that still
|
||||||
|
makes 6 wakeups/seconds (in another thread it seems).
|
||||||
|
|
||||||
|
With this patch wmacpi makes a best effort to match the sample
|
||||||
|
rate set by the user, but that's hardly an issue I think.
|
||||||
|
|
||||||
|
I haven't released this patch yet in Debian, so if you like it and
|
||||||
|
want to roll out a release, feel free :) Otherwise I'll add it to
|
||||||
|
the package soon.
|
||||||
|
|
||||||
|
Thanks,
|
||||||
|
|
||||||
|
JB.
|
||||||
|
|
||||||
|
|
||||||
2008 March 18 2.2rc3
|
2008 March 18 2.2rc3
|
||||||
Some fixes for the sysfs interface support, supplied by
|
Some fixes for the sysfs interface support, supplied by
|
||||||
jblache@debian.org:
|
jblache@debian.org:
|
||||||
|
|
116
wmacpi/wmacpi.c
116
wmacpi/wmacpi.c
|
@ -46,7 +46,11 @@ static char **master_xpm = master_low_xpm;
|
||||||
#include "master.xpm"
|
#include "master.xpm"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Do NOT change the BASE_PERIOD without reading the code ... */
|
||||||
|
#define BASE_PERIOD 100000 /* base period, 100 ms (in usecs) */
|
||||||
|
|
||||||
struct dockapp {
|
struct dockapp {
|
||||||
|
int x_fd; /* X11 fd */
|
||||||
Display *display; /* display */
|
Display *display; /* display */
|
||||||
Window win; /* main window */
|
Window win; /* main window */
|
||||||
Pixmap pixmap; /* main pixmap */
|
Pixmap pixmap; /* main pixmap */
|
||||||
|
@ -62,6 +66,7 @@ struct dockapp {
|
||||||
int scroll; /* scroll message text? */
|
int scroll; /* scroll message text? */
|
||||||
int scroll_reset; /* reset the scrolling text */
|
int scroll_reset; /* reset the scrolling text */
|
||||||
int percent;
|
int percent;
|
||||||
|
int period_length; /* length of the polling period, multiple of BASE_PERIOD */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* globals */
|
/* globals */
|
||||||
|
@ -142,6 +147,7 @@ static void new_window(char *display, char *name, int argc, char **argv)
|
||||||
DAOpenDisplay(display, argc, argv);
|
DAOpenDisplay(display, argc, argv);
|
||||||
DACreateIcon(name, 64, 64, argc, argv);
|
DACreateIcon(name, 64, 64, argc, argv);
|
||||||
dockapp->display = DADisplay;
|
dockapp->display = DADisplay;
|
||||||
|
dockapp->x_fd = XConnectionNumber(dockapp->display);
|
||||||
dockapp->win = DAWindow;
|
dockapp->win = DAWindow;
|
||||||
|
|
||||||
XSelectInput(dockapp->display, dockapp->win,
|
XSelectInput(dockapp->display, dockapp->win,
|
||||||
|
@ -406,7 +412,8 @@ static void really_blink_power_glyph(void)
|
||||||
kill_power_glyph();
|
kill_power_glyph();
|
||||||
else if (counter > 30)
|
else if (counter > 30)
|
||||||
counter = 0;
|
counter = 0;
|
||||||
counter++;
|
|
||||||
|
counter += dockapp->period_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void blink_power_glyph(void)
|
static void blink_power_glyph(void)
|
||||||
|
@ -425,7 +432,8 @@ static void really_blink_battery_glyph(void)
|
||||||
kill_battery_glyph();
|
kill_battery_glyph();
|
||||||
else if (counter > 30)
|
else if (counter > 30)
|
||||||
counter = 0;
|
counter = 0;
|
||||||
counter++;
|
|
||||||
|
counter += dockapp->period_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void blink_battery_glyph(void)
|
static void blink_battery_glyph(void)
|
||||||
|
@ -654,6 +662,7 @@ battery_t *switch_battery(global_t *globals, int battno)
|
||||||
return globals->binfo;
|
return globals->binfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *display = NULL;
|
char *display = NULL;
|
||||||
|
@ -663,14 +672,16 @@ int main(int argc, char **argv)
|
||||||
int ac_count = 0;
|
int ac_count = 0;
|
||||||
int cli = 0, samples = 1, critical = 10;
|
int cli = 0, samples = 1, critical = 10;
|
||||||
int samplerate = 20;
|
int samplerate = 20;
|
||||||
int sleep_rate = 10;
|
|
||||||
int sleep_time = 1000000/sleep_rate;
|
|
||||||
int scroll_count = 0;
|
int scroll_count = 0;
|
||||||
enum rtime_mode rt_mode = RT_RATE;
|
enum rtime_mode rt_mode = RT_RATE;
|
||||||
int rt_forced = 0;
|
int rt_forced = 0;
|
||||||
battery_t *binfo = NULL;
|
battery_t *binfo = NULL;
|
||||||
global_t *globals;
|
global_t *globals;
|
||||||
|
|
||||||
|
fd_set fds;
|
||||||
|
struct timeval tv_rate;
|
||||||
|
struct timeval tv = {0, 0};
|
||||||
|
|
||||||
DAProgramOption options[] = {
|
DAProgramOption options[] = {
|
||||||
{"-r", "--no-scroll", "disable scrolling message", DONone, False, {NULL}},
|
{"-r", "--no-scroll", "disable scrolling message", DONone, False, {NULL}},
|
||||||
{"-n", "--no-blink", "disable blinking of various UI elements", DONone, False, {NULL}},
|
{"-n", "--no-blink", "disable blinking of various UI elements", DONone, False, {NULL}},
|
||||||
|
@ -722,6 +733,33 @@ int main(int argc, char **argv)
|
||||||
if (samplerate == 0) samplerate = 1;
|
if (samplerate == 0) samplerate = 1;
|
||||||
if (samplerate > 600) samplerate = 600;
|
if (samplerate > 600) samplerate = 600;
|
||||||
|
|
||||||
|
/* convert to number of base periods */
|
||||||
|
samplerate = ((60 * 1000000) / samplerate) / BASE_PERIOD;
|
||||||
|
|
||||||
|
if (!dockapp->scroll) {
|
||||||
|
if (!dockapp->blink) {
|
||||||
|
/* Adapt the period to the sample rate */
|
||||||
|
tv_rate.tv_usec = samplerate * BASE_PERIOD;
|
||||||
|
|
||||||
|
tv_rate.tv_sec = tv_rate.tv_usec / 1000000;
|
||||||
|
tv_rate.tv_usec = tv_rate.tv_usec - (tv_rate.tv_sec * 1000000);
|
||||||
|
|
||||||
|
dockapp->period_length = samplerate;
|
||||||
|
} else {
|
||||||
|
/* blinking is every second */
|
||||||
|
tv_rate.tv_sec = 1; /* BASE_PERIOD * 10 = 1 sec */
|
||||||
|
tv_rate.tv_usec = 0;
|
||||||
|
|
||||||
|
dockapp->period_length = 10;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* scrolling is every BASE_PERIOD (100 ms) */
|
||||||
|
tv_rate.tv_sec = 0;
|
||||||
|
tv_rate.tv_usec = BASE_PERIOD;
|
||||||
|
|
||||||
|
dockapp->period_length = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (critical > 100) {
|
if (critical > 100) {
|
||||||
fprintf(stderr, "Please use values between 0 and 100%%\n");
|
fprintf(stderr, "Please use values between 0 and 100%%\n");
|
||||||
fprintf(stderr, "Using default value of 10%%\n");
|
fprintf(stderr, "Using default value of 10%%\n");
|
||||||
|
@ -771,10 +809,10 @@ int main(int argc, char **argv)
|
||||||
acquire_all_info(globals);
|
acquire_all_info(globals);
|
||||||
|
|
||||||
if (globals->battery_count > 0) {
|
if (globals->battery_count > 0) {
|
||||||
binfo = &batteries[battery_no];
|
binfo = &batteries[battery_no];
|
||||||
globals->binfo = binfo;
|
globals->binfo = binfo;
|
||||||
set_batt_id_area(battery_no);
|
set_batt_id_area(battery_no);
|
||||||
pinfo("monitoring battery %s\n", binfo->name);
|
pinfo("monitoring battery %s\n", binfo->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
clear_time_display();
|
clear_time_display();
|
||||||
|
@ -842,27 +880,29 @@ int main(int argc, char **argv)
|
||||||
* and is a slow device, so you get significant periods without
|
* and is a slow device, so you get significant periods without
|
||||||
* interrupts. This causes interactivity to suffer . . .
|
* interrupts. This causes interactivity to suffer . . .
|
||||||
*
|
*
|
||||||
* My proposed workaround is to allow the user to set the sample
|
* So, the workaround/fix for this is to sample at a much
|
||||||
* rate - it defaults to ten, but can be set lower (or higher).
|
* lower rate than we may update/refresh/expose/whatever. The
|
||||||
|
* user specifies how many times they want us to sample per
|
||||||
|
* minute; we use select() on our X events fd to wake up when
|
||||||
|
* there's some display work to be done, with the timeout set
|
||||||
|
* to whatever the time between samples is. When we hit our
|
||||||
|
* select() timeout we update our samples, otherwise we update
|
||||||
|
* the display.
|
||||||
*
|
*
|
||||||
* The only problem with this is that we need to sample less
|
* Note that this has a wrinkle when blinking and/or scrolling
|
||||||
* frequently, while still allowing the app to update normally.
|
* is enabled, since we need to update the display more
|
||||||
* That means calling redraw_window() and all the set_*() functions
|
* frequently than we sample (most likely). In that case we
|
||||||
* normally, but only calling acquire_all_info() every so often.
|
* set the timeout based on the display update cycle. */
|
||||||
* As it stands, we only call acquire_all_info() once every three
|
|
||||||
* seconds (once every thirty updates) . . . I'm not entirely sure
|
/* have we completed our timeout, or were we woken up early? */
|
||||||
* /how/ this could cause interactivity problems, but hey . . .
|
if ((tv.tv_sec != 0) || (tv.tv_usec != 0))
|
||||||
*
|
goto win_update;
|
||||||
* So, given the base rate of once every three seconds, we want to
|
|
||||||
* change this test to . . . */
|
tv = tv_rate;
|
||||||
/* Okay, this needs /fixing/ - it's ridiculous. We should be giving
|
|
||||||
* the user the option of saying how many times per minute the
|
sample_count += dockapp->period_length;
|
||||||
* battery should be sampled, defaulting to 20 times.
|
|
||||||
*
|
if (sample_count >= samplerate) {
|
||||||
* We sleep for one tenth of a second at a time, so 60 seconds
|
|
||||||
* translates to 600 sleeps. So, we change the default sample
|
|
||||||
* rate to 20, and the calculation below becomes . . .*/
|
|
||||||
if (sample_count++ == ((sleep_rate*60)/samplerate)) {
|
|
||||||
if (globals->battery_count == 0) {
|
if (globals->battery_count == 0) {
|
||||||
batt_count = 0;
|
batt_count = 0;
|
||||||
|
|
||||||
|
@ -883,15 +923,15 @@ int main(int argc, char **argv)
|
||||||
* they change - you can hotplug batteries on most laptops these days
|
* they change - you can hotplug batteries on most laptops these days
|
||||||
* and who knows what kind of shit will be happening soon . . . */
|
* and who knows what kind of shit will be happening soon . . . */
|
||||||
if (batt_count++ >= batt_reinit) {
|
if (batt_count++ >= batt_reinit) {
|
||||||
if(reinit_batteries(globals))
|
if(reinit_batteries(globals))
|
||||||
pfatal("Oh my god, the batteries are gone!\n");
|
pfatal("Oh my god, the batteries are gone!\n");
|
||||||
batt_count = 0;
|
batt_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ac_count++ >= ac_reinit) {
|
if (ac_count++ >= ac_reinit) {
|
||||||
if(reinit_ac_adapters(globals))
|
if(reinit_ac_adapters(globals))
|
||||||
pfatal("What happened to our AC adapters?!?\n");
|
pfatal("What happened to our AC adapters?!?\n");
|
||||||
ac_count = 0;
|
ac_count = 0;
|
||||||
}
|
}
|
||||||
sample_count = 0;
|
sample_count = 0;
|
||||||
}
|
}
|
||||||
|
@ -924,11 +964,13 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
scroll_text();
|
scroll_text();
|
||||||
|
|
||||||
/* redraw_window, if anything changed - determined inside
|
win_update:
|
||||||
* redraw_window. */
|
/* redraw_window, if anything changed */
|
||||||
redraw_window();
|
redraw_window();
|
||||||
|
|
||||||
usleep(sleep_time);
|
FD_ZERO(&fds);
|
||||||
|
FD_SET(dockapp->x_fd, &fds);
|
||||||
|
select(FD_SETSIZE, &fds, NULL, NULL, &tv);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue