[Pkg-wmaker-commits] [wmacpi] 57/105: Imported Upstream version 2.2~rc4
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Tue Aug 18 01:13:45 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository wmacpi.
commit 5125869ab98b66350f7bdcfd443e2281b672db03
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date: Mon Nov 24 05:55:16 2014 -0600
Imported Upstream version 2.2~rc4
---
.arch-ids/AUTHORS.id | 1 +
.arch-ids/COPYING.id | 1 +
.arch-ids/ChangeLog.id | 1 +
.arch-ids/INSTALL.id | 1 +
.arch-ids/Makefile.id | 1 +
.arch-ids/README.id | 1 +
.arch-ids/TODO.id | 1 +
.arch-ids/acpi.1.id | 1 +
.arch-ids/acpi.c.id | 1 +
.arch-ids/libacpi.c.id | 1 +
.arch-ids/libacpi.h.id | 1 +
.arch-ids/master.xpm.id | 1 +
.arch-ids/master_low.xpm.id | 1 +
.arch-ids/wmacpi.1.id | 1 +
.arch-ids/wmacpi.c.id | 1 +
.arch-ids/wmacpi.h.id | 1 +
.hg_archival.txt | 2 +
.hgempty | 35 +++++++++++++
.hgignore | 3 ++
.hgtags | 7 +++
AUTHORS | 2 +-
ChangeLog | 33 +++++++++++++
wmacpi.c | 116 ++++++++++++++++++++++++++++++--------------
23 files changed, 176 insertions(+), 38 deletions(-)
diff --git a/.arch-ids/AUTHORS.id b/.arch-ids/AUTHORS.id
new file mode 100644
index 0000000..1572aa8
--- /dev/null
+++ b/.arch-ids/AUTHORS.id
@@ -0,0 +1 @@
+Simon Fowler <simon at himi.org> Sun Jul 11 11:28:38 2004 11066.0
diff --git a/.arch-ids/COPYING.id b/.arch-ids/COPYING.id
new file mode 100644
index 0000000..ce8aeb1
--- /dev/null
+++ b/.arch-ids/COPYING.id
@@ -0,0 +1 @@
+Simon Fowler <simon at himi.org> Sun Jul 11 11:28:38 2004 11066.1
diff --git a/.arch-ids/ChangeLog.id b/.arch-ids/ChangeLog.id
new file mode 100644
index 0000000..884ade8
--- /dev/null
+++ b/.arch-ids/ChangeLog.id
@@ -0,0 +1 @@
+Simon Fowler <simon at himi.org> Sun Jul 11 11:28:38 2004 11066.2
diff --git a/.arch-ids/INSTALL.id b/.arch-ids/INSTALL.id
new file mode 100644
index 0000000..0993c0e
--- /dev/null
+++ b/.arch-ids/INSTALL.id
@@ -0,0 +1 @@
+Simon Fowler <simon at himi.org> Sun Jul 11 11:28:38 2004 11066.3
diff --git a/.arch-ids/Makefile.id b/.arch-ids/Makefile.id
new file mode 100644
index 0000000..56b09e7
--- /dev/null
+++ b/.arch-ids/Makefile.id
@@ -0,0 +1 @@
+Simon Fowler <simon at himi.org> Sun Jul 11 11:28:38 2004 11066.4
diff --git a/.arch-ids/README.id b/.arch-ids/README.id
new file mode 100644
index 0000000..4e519aa
--- /dev/null
+++ b/.arch-ids/README.id
@@ -0,0 +1 @@
+Simon Fowler <simon at himi.org> Sun Jul 11 11:28:38 2004 11066.5
diff --git a/.arch-ids/TODO.id b/.arch-ids/TODO.id
new file mode 100644
index 0000000..c7eed4f
--- /dev/null
+++ b/.arch-ids/TODO.id
@@ -0,0 +1 @@
+Simon Fowler <simon at himi.org> Sun Jul 11 11:59:50 2004 11909.0
diff --git a/.arch-ids/acpi.1.id b/.arch-ids/acpi.1.id
new file mode 100644
index 0000000..86c3a00
--- /dev/null
+++ b/.arch-ids/acpi.1.id
@@ -0,0 +1 @@
+Simon Fowler <simon at himi.org> Sun Jul 11 13:18:00 2004 13139.0
diff --git a/.arch-ids/acpi.c.id b/.arch-ids/acpi.c.id
new file mode 100644
index 0000000..064283e
--- /dev/null
+++ b/.arch-ids/acpi.c.id
@@ -0,0 +1 @@
+Simon Fowler <simon at himi.org> Sun Jul 11 12:21:51 2004 12157.0
diff --git a/.arch-ids/libacpi.c.id b/.arch-ids/libacpi.c.id
new file mode 100644
index 0000000..3de5e17
--- /dev/null
+++ b/.arch-ids/libacpi.c.id
@@ -0,0 +1 @@
+Simon Fowler <simon at himi.org> Sun Jul 11 11:28:38 2004 11066.6
diff --git a/.arch-ids/libacpi.h.id b/.arch-ids/libacpi.h.id
new file mode 100644
index 0000000..f09d2ec
--- /dev/null
+++ b/.arch-ids/libacpi.h.id
@@ -0,0 +1 @@
+Simon Fowler <simon at himi.org> Sun Jul 11 12:18:57 2004 12091.0
diff --git a/.arch-ids/master.xpm.id b/.arch-ids/master.xpm.id
new file mode 100644
index 0000000..f4904ab
--- /dev/null
+++ b/.arch-ids/master.xpm.id
@@ -0,0 +1 @@
+Simon Fowler <simon at himi.org> Sun Jul 11 11:28:38 2004 11066.10
diff --git a/.arch-ids/master_low.xpm.id b/.arch-ids/master_low.xpm.id
new file mode 100644
index 0000000..a1f2ac5
--- /dev/null
+++ b/.arch-ids/master_low.xpm.id
@@ -0,0 +1 @@
+Simon Fowler <simon at himi.org> Sun Jul 11 11:28:38 2004 11066.11
diff --git a/.arch-ids/wmacpi.1.id b/.arch-ids/wmacpi.1.id
new file mode 100644
index 0000000..1ca7de9
--- /dev/null
+++ b/.arch-ids/wmacpi.1.id
@@ -0,0 +1 @@
+Simon Fowler <simon at himi.org> Sun Jul 11 11:28:38 2004 11066.22
diff --git a/.arch-ids/wmacpi.c.id b/.arch-ids/wmacpi.c.id
new file mode 100644
index 0000000..50862e2
--- /dev/null
+++ b/.arch-ids/wmacpi.c.id
@@ -0,0 +1 @@
+Simon Fowler <simon at himi.org> Sun Jul 11 11:28:38 2004 11066.8
diff --git a/.arch-ids/wmacpi.h.id b/.arch-ids/wmacpi.h.id
new file mode 100644
index 0000000..6a77ff5
--- /dev/null
+++ b/.arch-ids/wmacpi.h.id
@@ -0,0 +1 @@
+Simon Fowler <simon at himi.org> Sun Jul 11 11:28:38 2004 11066.9
diff --git a/.hg_archival.txt b/.hg_archival.txt
new file mode 100644
index 0000000..b8a6d79
--- /dev/null
+++ b/.hg_archival.txt
@@ -0,0 +1,2 @@
+repo: 9cde42e7fe71d3618c7c14b2f4fec73f079b283d
+node: f0f8df2eb33c81247679bd10585a3d380b03ca60
diff --git a/.hgempty b/.hgempty
new file mode 100644
index 0000000..dafe3bc
--- /dev/null
+++ b/.hgempty
@@ -0,0 +1,35 @@
+
+Empty original changeset by Simon Fowler <simon at himi.org>:
+[project @ simon at 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 at himi.org>:
+[project @ simon at 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 at himi.org>:
+[project @ simon at 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 at himi.org>:
+[project @ simon at 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 at himi.org>:
+[project @ simon at 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.
diff --git a/.hgignore b/.hgignore
new file mode 100644
index 0000000..ae1d399
--- /dev/null
+++ b/.hgignore
@@ -0,0 +1,3 @@
+(^|/)\{arch\}($|/)
+(^|/)\.hg($|/)
+(^|/)\.hgtags($|/)
diff --git a/.hgtags b/.hgtags
new file mode 100644
index 0000000..dd91897
--- /dev/null
+++ b/.hgtags
@@ -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
diff --git a/AUTHORS b/AUTHORS
index b04df42..df14ee7 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,4 +1,4 @@
-Simon Fowler <simon at himi.or>
+Simon Fowler <simon at himi.org>
Complete rewriting of the code from wmacpi-1.34.
timecop
diff --git a/ChangeLog b/ChangeLog
index 60e8b23..bd3c015 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
Some fixes for the sysfs interface support, supplied by
jblache at debian.org:
diff --git a/wmacpi.c b/wmacpi.c
index 815cfb1..057203a 100644
--- a/wmacpi.c
+++ b/wmacpi.c
@@ -46,7 +46,11 @@ static char **master_xpm = master_low_xpm;
#include "master.xpm"
#endif
+/* Do NOT change the BASE_PERIOD without reading the code ... */
+#define BASE_PERIOD 100000 /* base period, 100 ms (in usecs) */
+
struct dockapp {
+ int x_fd; /* X11 fd */
Display *display; /* display */
Window win; /* main window */
Pixmap pixmap; /* main pixmap */
@@ -62,6 +66,7 @@ struct dockapp {
int scroll; /* scroll message text? */
int scroll_reset; /* reset the scrolling text */
int percent;
+ int period_length; /* length of the polling period, multiple of BASE_PERIOD */
};
/* globals */
@@ -142,6 +147,7 @@ static void new_window(char *display, char *name, int argc, char **argv)
DAOpenDisplay(display, argc, argv);
DACreateIcon(name, 64, 64, argc, argv);
dockapp->display = DADisplay;
+ dockapp->x_fd = XConnectionNumber(dockapp->display);
dockapp->win = DAWindow;
XSelectInput(dockapp->display, dockapp->win,
@@ -406,7 +412,8 @@ static void really_blink_power_glyph(void)
kill_power_glyph();
else if (counter > 30)
counter = 0;
- counter++;
+
+ counter += dockapp->period_length;
}
static void blink_power_glyph(void)
@@ -425,7 +432,8 @@ static void really_blink_battery_glyph(void)
kill_battery_glyph();
else if (counter > 30)
counter = 0;
- counter++;
+
+ counter += dockapp->period_length;
}
static void blink_battery_glyph(void)
@@ -654,6 +662,7 @@ battery_t *switch_battery(global_t *globals, int battno)
return globals->binfo;
}
+
int main(int argc, char **argv)
{
char *display = NULL;
@@ -663,14 +672,16 @@ int main(int argc, char **argv)
int ac_count = 0;
int cli = 0, samples = 1, critical = 10;
int samplerate = 20;
- int sleep_rate = 10;
- int sleep_time = 1000000/sleep_rate;
int scroll_count = 0;
enum rtime_mode rt_mode = RT_RATE;
int rt_forced = 0;
battery_t *binfo = NULL;
global_t *globals;
+ fd_set fds;
+ struct timeval tv_rate;
+ struct timeval tv = {0, 0};
+
DAProgramOption options[] = {
{"-r", "--no-scroll", "disable scrolling message", 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 > 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) {
fprintf(stderr, "Please use values between 0 and 100%%\n");
fprintf(stderr, "Using default value of 10%%\n");
@@ -771,10 +809,10 @@ int main(int argc, char **argv)
acquire_all_info(globals);
if (globals->battery_count > 0) {
- binfo = &batteries[battery_no];
- globals->binfo = binfo;
- set_batt_id_area(battery_no);
- pinfo("monitoring battery %s\n", binfo->name);
+ binfo = &batteries[battery_no];
+ globals->binfo = binfo;
+ set_batt_id_area(battery_no);
+ pinfo("monitoring battery %s\n", binfo->name);
}
clear_time_display();
@@ -842,27 +880,29 @@ int main(int argc, char **argv)
* and is a slow device, so you get significant periods without
* interrupts. This causes interactivity to suffer . . .
*
- * My proposed workaround is to allow the user to set the sample
- * rate - it defaults to ten, but can be set lower (or higher).
- *
- * The only problem with this is that we need to sample less
- * frequently, while still allowing the app to update normally.
- * That means calling redraw_window() and all the set_*() functions
- * normally, but only calling acquire_all_info() every so often.
- * As it stands, we only call acquire_all_info() once every three
- * seconds (once every thirty updates) . . . I'm not entirely sure
- * /how/ this could cause interactivity problems, but hey . . .
+ * So, the workaround/fix for this is to sample at a much
+ * 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.
*
- * So, given the base rate of once every three seconds, we want to
- * change this test to . . . */
- /* Okay, this needs /fixing/ - it's ridiculous. We should be giving
- * the user the option of saying how many times per minute the
- * battery should be sampled, defaulting to 20 times.
- *
- * 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)) {
+ * Note that this has a wrinkle when blinking and/or scrolling
+ * is enabled, since we need to update the display more
+ * frequently than we sample (most likely). In that case we
+ * set the timeout based on the display update cycle. */
+
+ /* have we completed our timeout, or were we woken up early? */
+ if ((tv.tv_sec != 0) || (tv.tv_usec != 0))
+ goto win_update;
+
+ tv = tv_rate;
+
+ sample_count += dockapp->period_length;
+
+ if (sample_count >= samplerate) {
if (globals->battery_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
* and who knows what kind of shit will be happening soon . . . */
if (batt_count++ >= batt_reinit) {
- if(reinit_batteries(globals))
- pfatal("Oh my god, the batteries are gone!\n");
- batt_count = 0;
+ if(reinit_batteries(globals))
+ pfatal("Oh my god, the batteries are gone!\n");
+ batt_count = 0;
}
if (ac_count++ >= ac_reinit) {
- if(reinit_ac_adapters(globals))
- pfatal("What happened to our AC adapters?!?\n");
- ac_count = 0;
+ if(reinit_ac_adapters(globals))
+ pfatal("What happened to our AC adapters?!?\n");
+ ac_count = 0;
}
sample_count = 0;
}
@@ -924,11 +964,13 @@ int main(int argc, char **argv)
scroll_text();
- /* redraw_window, if anything changed - determined inside
- * redraw_window. */
+ win_update:
+ /* redraw_window, if anything changed */
redraw_window();
- usleep(sleep_time);
+ FD_ZERO(&fds);
+ FD_SET(dockapp->x_fd, &fds);
+ select(FD_SETSIZE, &fds, NULL, NULL, &tv);
}
return 0;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmacpi.git
More information about the Pkg-wmaker-commits
mailing list