wmacpi: Bump to version 2.2rc3.

Source obtained from http://sourceforge.net/projects/wmacpi/files/.

2008 March 18 2.2rc3
	Some fixes for the sysfs interface support, supplied by
	jblache@debian.org:

	> Okay, I finally found time to make a new release including this
	> patch - 2.2rc2. It's up on my website now.

	I don't remember sending you the updated patch, as it turned out that
	you can have different attributes in sysfs depending on what the
	battery reports.

	The current version is attached.

	Thanks,

	JB.

Source obtained from http://sourceforge.net/projects/wmacpi/files/.
This commit is contained in:
Doug Torrance 2014-08-18 17:56:28 -05:00 committed by Carlos R. Mafra
parent ffd4b11477
commit 61cad1c561
45 changed files with 542 additions and 495 deletions

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.0

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.1

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.2

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.3

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.4

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.5

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:59:50 2004 11909.0

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 13:18:00 2004 13139.0

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 12:21:51 2004 12157.0

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.6

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 12:18:57 2004 12091.0

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.10

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.11

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.22

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.8

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.9

View file

@ -1,2 +0,0 @@
repo: 9cde42e7fe71d3618c7c14b2f4fec73f079b283d
node: 65f88f7c4b29c4c74f068ba63c1c63c83c193eec

View file

@ -1,35 +0,0 @@
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.

View file

@ -1,3 +0,0 @@
(^|/)\{arch\}($|/)
(^|/)\.hg($|/)
(^|/)\.hgtags($|/)

View file

@ -1 +0,0 @@
8b1a90b86e0bf59867af5dc51de1db30b76458e7 v2.2rc1

View file

@ -1,3 +1,29 @@
2008 March 18 2.2rc3
Some fixes for the sysfs interface support, supplied by
jblache@debian.org:
> Okay, I finally found time to make a new release including this
> patch - 2.2rc2. It's up on my website now.
I don't remember sending you the updated patch, as it turned out that
you can have different attributes in sysfs depending on what the
battery reports.
The current version is attached.
Thanks,
JB.
2008 March 14 2.2rc2
Support for the sysfs interface that became mandatory with kernel
2.6.24 (patch supplied by jblache@debian.org).
A number of graphics fixes also from jblache@debian.org.
Removed support for hardware reported critical battery status.
2007 July 14 2.2rc1
Major changes to command line handling and to the way we use
libdockapp, courtesy of Patrice Dumas. This should hopefully fix

View file

@ -26,7 +26,7 @@
#include "libacpi.h"
#define ACPI_VER "2.2rc1"
#define ACPI_VER "2.2rc3"
global_t *globals;

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.12

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.13

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.14

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.15

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.16

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.17

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.18

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.19

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.20

View file

@ -1 +0,0 @@
Simon Fowler <simon@himi.org> Sun Jul 11 11:28:38 2004 11066.21

View file

@ -1,147 +0,0 @@
wmacpi-ng (0.99-1) unstable; urgency=low
* New upstream version.
-- Simon Fowler <simon@dreamcraft.com.au> Fri, 26 Sep 2003 13:48:55 +1000
wmacpi-ng (0.92-1) unstable; urgency=low
* New upstream version.
-- Simon Fowler <simon@dreamcraft.com.au> Tue, 23 Sep 2003 11:57:09 +1000
wmacpi-ng (0.91-1) unstable; urgency=low
* New upstream version.
-- Simon Fowler <simon@dreamcraft.com.au> Wed, 6 Aug 2003 18:32:11 +1000
wmacpi-ng (0.90-1) unstable; urgency=low
* New upstream version.
-- Simon Fowler <simon@hollie.himi.private> Wed, 16 Jul 2003 18:52:04 +1000
wmacpi-ng (0.50a2-1) unstable; urgency=low
* New alpha upstream version.
-- Simon Fowler <simon@dreamcraft.com.au> Fri, 11 Jul 2003 14:29:44 +1000
wmacpi-ng (0.50a1-1) unstable; urgency=low
* New alpha upstream version.
-- Simon Fowler <simon@hollie.himi.private> Thu, 10 Jul 2003 11:46:11 +1000
wmacpi-ng (0.50a-1) unstable; urgency=low
* New alpha upstream version.
-- Simon Fowler <simon@hollie.himi.private> Thu, 10 Jul 2003 00:07:44 +1000
wmacpi-ng (0.50-1) unstable; urgency=low
* New upstream version.
-- Simon Fowler <simon@hollie.himi.private> Sun, 6 Jul 2003 16:50:59 +1000
wmacpi-ng (0.19-1) unstable; urgency=low
* New upstream version.
-- Simon Fowler <simon@hollie.himi.private> Wed, 2 Jul 2003 00:55:36 +1000
wmacpi-ng (0.15-1) unstable; urgency=low
* New upstream version.
-- Simon Fowler <simon@hollie.himi.private> Tue, 24 Jun 2003 00:38:26 +1000
wmacpi-ng (0.14-1) unstable; urgency=low
* New upstream version.
-- Simon Fowler <simon@hollie.himi.private> Tue, 24 Jun 2003 00:00:26 +1000
wmacpi-ng (0.13-1) unstable; urgency=low
* New upstream version.
-- Simon Fowler <simon@hollie.himi.private> Mon, 23 Jun 2003 23:49:05 +1000
wmacpi-ng (0.12-1) unstable; urgency=low
* New upstream version.
-- Simon Fowler <simon@hollie.himi.private> Sat, 21 Jun 2003 12:24:43 +1000
wmacpi-ng (0.11-1) unstable; urgency=low
* New upstream version.
-- Simon Fowler <simon@hollie.himi.private> Fri, 30 May 2003 23:42:12 +1000
wmacpi-ng (0.10-1) unstable; urgency=low
* New upstream version.
-- Simon Fowler <simon@dreamcraft.com.au> Fri, 30 May 2003 13:35:50 +1000
wmacpi-ng (0.2a-1) unstable; urgency=low
* New upstream version.
-- Simon Fowler <simon@dreamcraft.com.au> Mon, 26 May 2003 22:08:45 +1000
wmacpi-ng (0.2-1) unstable; urgency=low
* New version.
-- Simon Fowler <simon@dreamcraft.com.au> Mon, 26 May 2003 18:59:16 +1000
wmacpi-ng (0.1-1) unstable; urgency=low
* New package, since the current version doesn't work with kernel
2.4.21-rc2.
-- Simon Fowler <simon@dreamcraft.com.au> Mon, 26 May 2003 14:01:40 +1000
wmacpi (1.34-1) unstable; urgency=low
* New maintainer.
* New upstream release (closes: #143387).
* debian/control:
- Updated description.
- Bumped Standards-Version to 3.5.9.
- Updated build-dependency on debhelper to >= 4.
- Changed priority to "optional".
- Added a recommendation on "wmaker".
* debian/compat:
- Introduced this file and set its contents to "4".
* debian/copyright:
- Updated maintainer and homepage infos.
* debian/rules:
- Made some minor modifications to comply with policy.
* debian/watch:
- Introduced this file, which seems to be currently useless, though. the
web server does not allow browsing in the necessary directories.
* debian/docs:
- Included AUTHORS.
* debian/wmacpi.1:
- Updated man page to reflect current parameters of wmacpi.
-- Sebastian Henschel <shensche@kodeaffe.de> Sat, 19 Apr 2003 17:09:11 +0200
wmacpi (1.33-1) unstable; urgency=low
* New upstream release
-- Simon Richter <sjr@debian.org> Mon, 28 May 2001 01:49:55 +0200
wmacpi (1.31-1) unstable; urgency=low
* Initial Release (Closes: #90347).
-- Simon Richter <Simon.Richter@phobos.fs.tum.de> Mon, 19 Mar 2001 23:26:49 +0100

View file

@ -1 +0,0 @@
4

View file

@ -1,20 +0,0 @@
Source: wmacpi
Section: x11
Priority: optional
Maintainer: Simon Fowler <simon@dreamcraft.com.au>
Build-Depends: debhelper (>= 4), xlibs-dev
Standards-Version: 3.5.9
Package: wmacpi
Architecture: i386
Depends: ${shlibs:Depends}
Recommends: wmaker
Description: An ACPI battery monitor for WindowMaker
This is a battery monitor that uses ACPI to query the battery status.
This version should work with all recent kernels, both 2.4 and 2.6.
.
This is a reworked version to handle modern kernels, done by Simon
Fowler <simon@dreamcraft.com.au>
.
Author: Simon Fowler <simon@dreamcraft.com.au>
Homepage: http://himi.org/wmacpi-ng/

View file

@ -1,27 +0,0 @@
This package was debianized by Simon Richter <Simon.Richter@phobos.fs.tum.de> on
Mon, 19 Mar 2001 23:26:49 +0100.
It was taken over by Sebastian Henschel <shensche@kodeaffe.de> on Sat, 19 Apr 2003 15:31:00 +0200.
It was downloaded from http://www.ne.jp/asahi/linux/timecop/
Upstream Author: Timecop <timecop@japan.co.jp>
Copyright:
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 dated June, 1991.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this package; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
On Debian GNU/Linux systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL'.

View file

@ -1 +0,0 @@
usr/bin

View file

@ -1,3 +0,0 @@
README
AUTHORS
TODO

View file

@ -1,2 +0,0 @@
?package(wmacpi):needs=X11 section=Apps/System\
title="wmacpi" command="/usr/bin/wmacpi"

View file

@ -1,90 +0,0 @@
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
INSTALLDIR=$(CURDIR)/debian/wmacpi
# These are used for cross-compiling and for saving the configure script
# # from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS = "-Wall -g -O0"
else
CFLAGS = "-Wall -g -O2"
endif
configure: configure-stamp
configure-stamp:
dh_testdir
touch configure-stamp
build: configure-stamp build-stamp
build-stamp:
dh_testdir
# Add here commands to compile the package.
$(MAKE)
touch build-stamp
clean:
dh_testdir
dh_testroot
rm -f build-stamp configure-stamp
# Add here commands to clean up after the build process.
-$(MAKE) clean-all
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
# Add here commands to install the package into debian/wmacpi.
install -o root -g root -m 755 wmacpi $(INSTALLDIR)/usr/bin/
# install -o root -g root -m 755 acpi-ng $(INSTALLDIR)/usr/bin/
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir
dh_testroot
# dh_installdebconf
dh_installdocs
# dh_installexamples
dh_installmenu
# dh_installemacsen
# dh_installpam
# dh_installinit
# dh_installcron
dh_installman wmacpi.1 # acpi.1
# dh_installinfo
# dh_undocumented
dh_installchangelogs ChangeLog
dh_link
dh_strip
dh_compress
dh_fixperms
# dh_makeshlibs
dh_installdeb
# dh_perl
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure

View file

@ -1,2 +0,0 @@
version=2
http://www.ne.jp/asahi/linux/timecop/software/wmacpi-(.*)\.tar\.gz debian uupdate

View file

@ -4,6 +4,7 @@
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <dirent.h>
#include <time.h>
@ -11,13 +12,129 @@
#include "libacpi.h"
extern char *state[];
/* extern global_t *globals; */
#define PROC_DATA_SOURCE 0
#define SYSFS_DATA_SOURCE 1
static int data_source;
/* local proto */
int acpi_get_design_cap(int batt);
static int read_sysfs_file(char *node, char *prop, char *buf, size_t buflen)
{
char tmp[256];
FILE *fp;
int ret;
ret = snprintf(tmp, sizeof(tmp), "/sys/class/power_supply/%s/%s", node, prop);
if (ret >= (int)sizeof(tmp)) {
perr("Path too long for %s/%s\n", node, prop);
return -1;
}
fp = fopen(tmp, "r");
if (fp == NULL) {
perr("Could not open %s/%s\n", node, prop);
return -2;
}
ret = fread(buf, 1, buflen - 1, fp);
fclose(fp);
if (ret == 0) {
perr("Could not read %s/%s\n", node, prop);
return -3;
}
buf[ret] = '\0';
return 0;
}
/* initialise the batteries */
int init_batteries(global_t *globals)
static int sysfs_init_batteries(global_t *globals)
{
DIR *battdir;
struct dirent *batt;
char *name;
char *names[MAXBATT];
char ps_type[16];
int i, j;
/* now enumerate batteries */
globals->battery_count = 0;
battdir = opendir("/sys/class/power_supply");
if (battdir == NULL) {
pfatal("No batteries or ACPI not supported\n");
return 1;
}
while ((batt = readdir(battdir))) {
/* there's a serious problem with this code when there's
* more than one battery: the readdir won't return the
* entries in sorted order, so battery one won't
* necessarily be the first one returned. So, we need
* to sort them ourselves before adding them to the
* batteries array. */
name = batt->d_name;
/* skip ., .. and dotfiles */
if (name[0] == '.')
continue;
if (read_sysfs_file(name, "type", ps_type, sizeof(ps_type)) < 0)
continue;
if (strncmp("Battery", ps_type, 7) != 0)
continue;
names[globals->battery_count] = strdup(name);
globals->battery_count++;
}
closedir(battdir);
/* A nice quick insertion sort, ala CLR. */
{
char *tmp1, *tmp2;
for (i = 1; i < globals->battery_count; i++) {
tmp1 = names[i];
j = i - 1;
while ((j >= 0) && ((strcmp(tmp1, names[j])) < 0)) {
tmp2 = names[j+1];
names[j+1] = names[j];
names[j] = tmp2;
}
}
}
for (i = 0; i < globals->battery_count; i++) {
snprintf(batteries[i].name, MAX_NAME, "%s", names[i]);
pdebug("battery detected at /sys/class/power_supply/%s\n", batteries[i].name);
pinfo("found battery %s\n", names[i]);
if (read_sysfs_file(batteries[i].name, "energy_now", ps_type, sizeof(ps_type)) == 0)
batteries[i].sysfs_capa_mode = SYSFS_CAPA_ENERGY;
else if (read_sysfs_file(batteries[i].name, "charge_now", ps_type, sizeof(ps_type)) == 0)
batteries[i].sysfs_capa_mode = SYSFS_CAPA_CHARGE;
else if (read_sysfs_file(batteries[i].name, "capacity", ps_type, sizeof(ps_type)) == 0) {
batteries[i].sysfs_capa_mode = SYSFS_CAPA_PERCENT;
batteries[i].design_cap = 100;
batteries[i].last_full_cap = 100;
} else
batteries[i].sysfs_capa_mode = SYSFS_CAPA_ERR;
}
/* tell user some info */
pdebug("%d batteries detected\n", globals->battery_count);
pinfo("libacpi: found %d batter%s\n", globals->battery_count,
(globals->battery_count == 1) ? "y" : "ies");
return 0;
}
/* initialise the batteries */
static int procfs_init_batteries(global_t *globals)
{
DIR *battdir;
struct dirent *batt;
@ -83,6 +200,14 @@ int init_batteries(global_t *globals)
return 0;
}
int init_batteries(global_t *globals)
{
if (data_source == SYSFS_DATA_SOURCE)
return sysfs_init_batteries(globals);
else
return procfs_init_batteries(globals);
}
/* a stub that just calls the current function */
int reinit_batteries(global_t *globals)
{
@ -90,10 +215,62 @@ int reinit_batteries(global_t *globals)
return init_batteries(globals);
}
/* the actual name of the subdirectory under power_supply may
* be anything, so we need to read the directory and use the
* name we find there. */
static int sysfs_init_ac_adapters(global_t *globals)
{
DIR *acdir;
struct dirent *adapter;
adapter_t *ap = &globals->adapter;
char *name;
char ps_type[16];
acdir = opendir("/sys/class/power_supply");
if (acdir == NULL) {
pfatal("Unable to open /sys/class/power_supply -"
" are you sure this system supports ACPI?\n");
return 1;
}
name = NULL;
while ((adapter = readdir(acdir)) != NULL) {
name = adapter->d_name;
if (name[0] == '.') {
name = NULL;
continue;
}
if (read_sysfs_file(name, "type", ps_type, sizeof(ps_type)) < 0) {
name = NULL;
continue;
}
if (strncmp("Mains", ps_type, 5) == 0) {
pdebug("found adapter %s\n", name);
break;
} else {
name = NULL;
}
}
closedir(acdir);
if (name == NULL) {
perr("No AC adapter found !\n");
return 1;
}
/* we'll just use the first adapter we find ... */
ap->name = strdup(name);
pinfo("libacpi: found ac adapter %s\n", ap->name);
return 0;
}
/* the actual name of the subdirectory under ac_adapter may
* be anything, so we need to read the directory and use the
* name we find there. */
int init_ac_adapters(global_t *globals)
static int procfs_init_ac_adapters(global_t *globals)
{
DIR *acdir;
struct dirent *adapter;
@ -125,6 +302,14 @@ int init_ac_adapters(global_t *globals)
return 0;
}
int init_ac_adapters(global_t *globals)
{
if (data_source == SYSFS_DATA_SOURCE)
return sysfs_init_ac_adapters(globals);
else
return procfs_init_ac_adapters(globals);
}
/* stub that does nothing but call the normal init function */
int reinit_ac_adapters(global_t *globals)
{
@ -162,6 +347,15 @@ int power_init(global_t *globals)
/* yep, all good */
fclose(acpi);
/* determine data source */
if (access("/sys/class/power_supply", R_OK | X_OK) == 0) {
data_source = SYSFS_DATA_SOURCE;
pinfo("Selecting sysfs as the data source\n");
} else {
data_source = PROC_DATA_SOURCE;
pinfo("Selecting procfs as the data source\n");
}
if (!(retval = init_batteries(globals)))
retval = init_ac_adapters(globals);
@ -187,7 +381,7 @@ int power_reinit(global_t *globals)
return retval;
}
char *get_value(char *string)
static char *get_value(char *string)
{
char *retval;
int i;
@ -203,14 +397,28 @@ char *get_value(char *string)
return retval;
}
int check_error(char *buf)
static int check_error(char *buf)
{
if(strstr(buf, "ERROR") != NULL)
return 1;
return 0;
}
power_state_t get_power_status(global_t *globals)
static power_state_t sysfs_get_power_status(global_t *globals)
{
char online[2];
adapter_t *ap = &globals->adapter;
if (read_sysfs_file(ap->name, "online", online, sizeof(online)) < 0)
return PS_ERR;
if (*online == '1')
return AC;
else
return BATT;
}
static power_state_t procfs_get_power_status(global_t *globals)
{
FILE *file;
char buf[1024];
@ -232,7 +440,140 @@ power_state_t get_power_status(global_t *globals)
return BATT;
}
int get_battery_info(int batt_no)
power_state_t get_power_status(global_t *globals)
{
if (data_source == SYSFS_DATA_SOURCE)
return sysfs_get_power_status(globals);
else
return procfs_get_power_status(globals);
}
static int sysfs_get_battery_info(global_t *globals, int batt_no)
{
battery_t *info = &batteries[batt_no];
char buf[32];
int ret;
/* check to see if battery is present */
ret = read_sysfs_file(info->name, "present", buf, sizeof(buf));
if (ret < 0) {
/* interestingly, when the battery is not present, the whole
* /sys/class/power_supply/BATn directory does not exist.
* Yes, this is broken.
*/
if (ret == -2)
info->present = 0;
/* reinit batteries, this one went away and it's very
possible there just isn't any other one */
reinit_batteries(globals);
return 0;
}
info->present = (*buf == '1');
if (!info->present) {
pinfo("Battery %s not present\n", info->name);
return 0;
}
/* get design capacity
* note that all these integer values can also contain the
* string 'unknown', so we need to check for this. */
if (info->sysfs_capa_mode == SYSFS_CAPA_ENERGY) {
if (read_sysfs_file(info->name, "energy_full_design", buf, sizeof(buf)) < 0)
info->design_cap = -1;
else
info->design_cap = strtoul(buf, NULL, 10) / 1000;
/* get last full capacity */
if (read_sysfs_file(info->name, "energy_full", buf, sizeof(buf)) < 0)
info->last_full_cap = -1;
else
info->last_full_cap = strtoul(buf, NULL, 10) / 1000;
} else if (info->sysfs_capa_mode == SYSFS_CAPA_CHARGE) {
/* get design capacity */
if (read_sysfs_file(info->name, "charge_full_design", buf, sizeof(buf)) < 0)
info->design_cap = -1;
else
info->design_cap = strtoul(buf, NULL, 10) / 1000;
/* get last full capacity */
if (read_sysfs_file(info->name, "charge_full", buf, sizeof(buf)) < 0)
info->last_full_cap = -1;
else
info->last_full_cap = strtoul(buf, NULL, 10) / 1000;
} else if (info->sysfs_capa_mode != SYSFS_CAPA_PERCENT) {
info->design_cap = -1;
info->last_full_cap = -1;
}
/* get design voltage */
if (read_sysfs_file(info->name, "voltage_min_design", buf, sizeof(buf)) < 0)
info->design_voltage = -1;
else
info->design_voltage = strtoul(buf, NULL, 10) / 1000;
/* get charging state */
if (read_sysfs_file(info->name, "status", buf, sizeof(buf)) < 0) {
info->charge_state = CH_ERR;
} else {
if (strncmp(buf, "Unknown", 7) == 0)
info->charge_state = CH_ERR;
else if (strncmp(buf, "Discharging", 11) == 0)
info->charge_state = DISCHARGE;
else if (strncmp(buf, "Charging", 8) == 0)
info->charge_state = CHARGE;
else if (strncmp(buf, "Not charging", 12) == 0)
info->charge_state = NO_CHARGE;
else if (strncmp(buf, "Full", 4) == 0)
info->charge_state = FULL; /* DISCHARGE ? as per old comment ... */
}
/* get current rate of burn
* note that if it's on AC, this will report 0 */
if (read_sysfs_file(info->name, "current_now", buf, sizeof(buf)) < 0)
info->present_rate = -1;
else {
int rate;
rate = strtoul(buf, NULL, 10) / 1000;
info->present_rate = (rate != 0) ? rate : info->present_rate;
}
if (info->sysfs_capa_mode == SYSFS_CAPA_ENERGY) {
/* get remaining capacity */
if (read_sysfs_file(info->name, "energy_now", buf, sizeof(buf)) < 0)
info->remaining_cap = -1;
else
info->remaining_cap = strtoul(buf, NULL, 10) / 1000;
} else if (info->sysfs_capa_mode == SYSFS_CAPA_CHARGE) {
/* get remaining capacity */
if (read_sysfs_file(info->name, "charge_now", buf, sizeof(buf)) < 0)
info->remaining_cap = -1;
else
info->remaining_cap = strtoul(buf, NULL, 10) / 1000;
} else if (info->sysfs_capa_mode == SYSFS_CAPA_PERCENT) {
/* get remaining capacity */
if (read_sysfs_file(info->name, "capacity", buf, sizeof(buf)) < 0)
info->remaining_cap = -1;
else
info->remaining_cap = strtoul(buf, NULL, 10) / 1000;
} else {
info->remaining_cap = -1;
}
/* get current voltage */
if (read_sysfs_file(info->name, "voltage_now", buf, sizeof(buf)) < 0)
info->present_voltage = -1;
else
info->present_voltage = strtoul(buf, NULL, 10) / 1000;
return 1;
}
static int procfs_get_battery_info(global_t *globals, int batt_no)
{
FILE *file;
battery_t *info = &batteries[batt_no];
@ -241,6 +582,8 @@ int get_battery_info(int batt_no)
int buflen;
char *val;
globals = globals; /* silencing a warning */
if ((file = fopen(info->info_file, "r")) == NULL) {
/* this is cheating, but string concatenation should work . . . */
pfatal("Could not open %s:", info->info_file );
@ -325,18 +668,6 @@ int get_battery_info(int batt_no)
return 0;
}
/* get capacity state
* note that this has only two values (at least, in the 2.4.21-rc2
* source code) - ok and critical. */
entry = strstr(buf, "capacity state:");
val = get_value(entry);
if (val[0] == 'u')
info->capacity_state = CS_ERR;
else if ((strncmp(val, "ok", 2)) == 0)
info->capacity_state = OK;
else
info->capacity_state = CRITICAL;
/* get charging state */
entry = strstr(buf, "charging state:");
val = get_value(entry);
@ -385,6 +716,14 @@ int get_battery_info(int batt_no)
return 1;
}
int get_battery_info(global_t *globals, int batt_no)
{
if (data_source == SYSFS_DATA_SOURCE)
return sysfs_get_battery_info(globals, batt_no);
else
return procfs_get_battery_info(globals, batt_no);
}
/*
* 2003-7-1.
* In order to make this code more convenient for things other than
@ -562,7 +901,7 @@ void acquire_batt_info(global_t *globals, int batt)
battery_t *binfo;
adapter_t *ap = &globals->adapter;
get_battery_info(batt);
get_battery_info(globals, batt);
binfo = &batteries[batt];
@ -594,16 +933,6 @@ void acquire_batt_info(global_t *globals, int batt)
* globals->power value . . . .*/
ap->power = get_power_status(globals);
if ((ap->power != AC) && (binfo->charge_state == DISCHARGE)) {
/* we're not on power, and not charging. So we might as well
* check if we're at a critical battery level, and calculate
* other interesting stuff . . . */
if (binfo->capacity_state == CRITICAL) {
pinfo("Received critical battery status");
ap->power = HARD_CRIT;
}
}
binfo->charge_time = calc_charge_time(globals, batt);
/* and finally, we tell anyone who wants to use this information

View file

@ -2,7 +2,7 @@
#define _LIBACPI_H_
#define LIBACPI_VER "0.93"
#define LIBACPI_VER "0.95"
/* Here because we need it for definitions in this file . . . */
#define MAX_NAME 128
@ -26,21 +26,23 @@ typedef enum {
MED,
LOW,
CRIT,
HARD_CRIT,
BS_ERR,
} batt_state_t;
typedef enum {
CHARGE,
DISCHARGE,
FULL,
NO_CHARGE,
CH_ERR,
} charge_state_t;
typedef enum {
OK,
CRITICAL,
CS_ERR,
} cap_state_t;
SYSFS_CAPA_ENERGY,
SYSFS_CAPA_CHARGE,
SYSFS_CAPA_PERCENT,
SYSFS_CAPA_ERR,
} sysfs_capa_t;
typedef struct {
/* general info */
@ -48,12 +50,13 @@ typedef struct {
/* these two are conveniences */
char info_file[MAX_NAME];
char state_file[MAX_NAME];
/* sysfs capacity mode */
sysfs_capa_t sysfs_capa_mode;
int present;
int design_cap; /* assuming mAh */
int last_full_cap;
int design_voltage; /* in mV */
/* state info */
cap_state_t capacity_state;
charge_state_t charge_state;
int present_rate; /* in mAh */
int remaining_cap; /* in mAh */

View file

@ -96,9 +96,9 @@ static char * master_xpm[] = {
" . c #004941",
".. c #20B2AE",
"+. c #303030",
"@. c #027E72",
"#. c #188A86",
"$. c #22B2AE",
"@. c #188A86",
"#. c #22B2AE",
"$. c #027E72",
"%. c #034A40",
"&. c #107D79",
" . + @ # $ % & * = - % ; > , ' % ) ! ~ { % ] ^ / ( % _ : < [ % } | 1 2 % 3 4 5 6 % 7 8 9 0 % a b c d % e f g h ",
@ -119,39 +119,39 @@ static char * master_xpm[] = {
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % .% % % % .% .% % % % .% % ..% % .% % % % .% .% % % % .% ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % % % % % % % % % % % % % % % % % % % % % % ` . +.+.+.+.% +.+.+.+.% +.+.+.+.% +.+.+.+.% +.+.+.+.% +.+.+.+.% +.+.+.+.% +.+.+.+.% +.+.+.+.% +.+.+.+.% +.+.+.+. % .% % % % .% .% % % % .% % ..% % .% % % % .% .% % % % .% ",
" . % % % % % % ..........% % % % ....................% % ` . % % % % % . . .% % % . . .% % % ..% % % % % ` . % .% % % % .% .% % % % .% % % % % .% % % % .% .% % % % .% ",
" . % % % % % ..% % % % ......% % ..% % % % % % % % ..% % ` . % % .% .% % % .% .% % % .% ..% ..% ..% % ` . i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z % @.........@.% @.........@.% % % % % @.........@.% @.........@.% ",
" . % % % % % ..% % % % ..% % % % ..% % % % % % % % ....% ` . % % .% .% % % .% .% % % .% % ..% ..% % % ` . i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ",
" . % % % ......% % % % ..% % % % ..% % % % % % % % ....% ` . % % % % % . . .% % % . . .% % % % ..% % % % ` . i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z % .% % % % .% .% % % % .% % ..% % .% % % % .% .% % % % .% ",
" . % % ..% % ..% % % % ......% % ..% % % % % % % % ....% ` . % % .% .% % % .% .% % % .% % ..% ..% % % ` . i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z % .% % % % .% .% % % % .% % ..% % .% % % % .% .% % % % .% ",
" . % ..% % % % ..........% % % % ..% % % % % % % % ..% % ` . % % .% .% % % .% .% % % .% ..% ..% ..% % ` . i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z % .% % % % .% .% % % % .% % % % % .% % % % .% .% % % % .% ",
" . % ..% % % % % % % % % % % % % ....................% % ` . % % % % % . . .% % % . . .% % % % % ..% % % ` . i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z % .% % % % .% .% % % % .% % % % % .% % % % .% .% % % % .% ",
" . % % % % % ..% % % % ......% % ..% % % % % % % % ..% % ` . % % .% .% % % .% .% % % .% ..% ..% ..% % ` . i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z % .% % % % .% .% % % % .% % % % % .% % % % .% .% % % % .% ",
" . % % % % % ..% % % % ..% % % % ..% % % % % % % % ....% ` . % % .% .% % % .% .% % % .% % ..% ..% % % ` . i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z % % ........% % % ........% % % % % % % ........% % % ........% % ",
" . % % % ......% % % % ..% % % % ..% % % % % % % % ....% ` . % % % % % . . .% % % . . .% % % % ..% % % % ` . i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z % .% % % % .% .% % % % .% % % % % .% % % % .% .% % % % .% ",
" . % % ..% % ..% % % % ......% % ..% % % % % % % % ....% ` . % % .% .% % % .% .% % % .% % ..% ..% % % ` . i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z % .% % % % .% .% % % % .% % % % % .% % % % .% .% % % % .% ",
" . % ..% % % % ..........% % % % ..% % % % % % % % ..% % ` . % % .% .% % % .% .% % % .% ..% ..% ..% % ` . i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z % .% % % % .% .% % % % .% % ..% % .% % % % .% .% % % % .% ",
" . % ..% % % % % % % % % % % % % ....................% % ` . % % % % % . . .% % % . . .% % % % % ..% % % ` . i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z % .% % % % .% .% % % % .% % ..% % .% % % % .% .% % % % .% ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % % % % % % % % % % % % % % % % % % % % % % ` . i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z % % . . . .% % % . . . .% % % % % % % . . . .% % % . . . .% % ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % % % % % % % % % % % % % % % % % % % % % % ` . i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % % % % % % % % % % % % % % % % % % % % % % ` . i j k l % m n o p % q r s t % u v w x % y z A B % C D E F % G H I J % K L M N % O P Q R % S T U V % W X Y Z % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ",
" ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` . ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ",
" . % % ......% % % . . .#.% #.......#.% #.......#.% #. . . .#.% #.......#.% #.......#.% #.......#.% #.......#.% #.......#.% % ..% % % % % % % ",
" . % % ......% % % . . .@.% @.......@.% @.......@.% @. . . .@.% @.......@.% @.......@.% @.......@.% @.......@.% @.......@.% % ..% % % % % % % ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ` . % ..% % % ..% .% % % ..% .% % % ..% .% % % ..% ..% % % ..% ..% % % .% ..% % % .% .% % % ..% ..% % % ..% ..% % % ..% ..% ..% ..% % ..% ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` % % % % % % % % % % % % % % % % ` . % ..% % % ..% .% % % ..% .% % % ..% .% % % ..% ..% % % ..% ..% % % .% ..% % % .% .% % % ..% ..% % % ..% ..% % % ..% % ..% ..% % % #.% ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` % % % % % % % % % % % % % % % % ` . % #. . . .#.% % . . .#.% #.......#.% % ......#.% #.......#.% #.......#.% #.......#.% % . . .#.% #.......#.% #.......#.% % % ..% % % % % % ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` % % % % % % % % % % % % % % % % ` . % ..% % % ..% .% % % ..% .% % % ..% .% % % ..% ..% % % ..% ..% % % .% ..% % % .% .% % % ..% ..% % % ..% ..% % % ..% % ..% ..% % % @.% ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` % % % % % % % % % % % % % % % % ` . % @. . . .@.% % . . .@.% @.......@.% % ......@.% @.......@.% @.......@.% @.......@.% % . . .@.% @.......@.% @.......@.% % % ..% % % % % % ",
" . % % % . . . .% % % . . . .% % % % % % % . . . .% % % . . . .% % % ` % % % % % % % % % . . . .% % % ` . % ..% % % ..% .% % % ..% ..% % % .% .% % % ..% .% % % ..% .% % % ..% ..% % % ..% .% % % ..% ..% % % ..% .% % % ..% % ..% ..% % % % % ",
" . % % .% % % % .% .% % % % .% % .% % .% % % % .% .% % % % .% % ` % % % % % % % % .% % % % .% % ` . % ..% % % ..% .% % % ..% ..% % % .% .% % % ..% .% % % ..% .% % % ..% ..% % % ..% .% % % ..% ..% % % ..% .% % % ..% ..% ..% ..% % ..% ",
" . % % .% % % % .% .% % % % .% % .% % .% % % % .% .% % % % .% % ` % $.$.$.$.% % % .% % % % .% % ` . % % ......% % % . . .#.% #.......#.% #.......#.% % . . .#.% #.......#.% #.......#.% % . . .#.% #.......#.% #.......#.% % % % ..% % % #.% ",
" . % % .% % % % .% .% % % % .% % % % % .% % % % .% .% % % % .% % ` % $.% % % $.% % .% % % % .% % ` . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ",
" . % % .% % % % .% .% % % % .% % % % % .% % % % .% .% % % % .% % ` % $.% % % $.% % .% % % % .% % ` . ",
" . % % % . . . .% % % . . . .% % % % % % % . . . .% % % . . . .% % % ` % $.% % % $.% % % . . . .% % % ` . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % . . . . . . . . . . . . . . . . ` ",
" . % % .% % % % .% .% % % % .% % % % % .% % % % .% .% % % % .% % ` % $.$.$.$.% % % .% % % % .% % ` . % % % % % % ..........% % % % ....................% % % #.% % ......% % % ......% % % ..% % % % % % % % % % % % % % % % % % % % ` ",
" . % % .% % % % .% .% % % % .% % % % % .% % % % .% .% % % % .% % ` % $.% % % $.% % .% % % % .% % ` . % % % % % ..% % % % ......% % ..% % % % % % % % ..% % % ..% ..% % % ..% ..% % % ..% ..% ..% ..% % % % % % % % % % % % % % % % % ` ",
" . % % .% % % % .% .% % % % .% % .% % .% % % % .% .% % % % .% % ` % $.% % % $.% % .% % % % .% % ` . % % % % % ..% % % % ..% % % % ..% % % % % % % % ....% % ..% ..% % % ..% ..% % % ..% % ..% ..% % % % % % % % % % % . . . .% % % ` ",
" . % % .% % % % .% .% % % % .% % .% % .% % % % .% .% % % % .% % ` % $.% % % $.% % .% % % % .% % ` . % % % ......% % % % ..% % % % ..% % % % % % % % ....% % #.% #. . . .#.% #. . . .#.% % % ..% % % % % % % % % % % .% % % % .% % ` ",
" . % % % . . . .% % % . . . .% % % % % % % . . . .% % % . . . .% % % ` % $.$.$.$.% % % % . . . .% % % ` . % % ..% % ..% % % % ......% % ..% % % % % % % % ....% % ..% ..% % % ..% ..% % % ..% % ..% ..% % % $.$.$.$.% % % .% % % % .% % ` ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` % % % % % % % % % % % % % % % % ` . % ..% % % % ..........% % % % ..% % % % % % % % ..% % % ..% ..% % % ..% ..% % % ..% ..% ..% ..% % $.% % % $.% % .% % % % .% % ` ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` % % % % % % % % % % % % % % % % ` . % ..% % % % % % % % % % % % % ....................% % % #.% % ......% % % ......% % % % % ..% % % $.% % % $.% % .% % % % .% % ` ",
" ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % $.% % % $.% % % . . . .% % % ` ",
" . % $.$.$.$.% % % .% % % % .% % ` ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % $.% % % $.% % .% % % % .% % ` ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . % % % % % % . . . . .% % % % . . . . . . . . . .% % % % % % . . .% % % . . .% % % .% % % % % $.% % % $.% % .% % % % .% % ` ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % % % % .% % % % . . .% % .% % % % % % % % .% % % .% .% % % .% .% % % .% .% .% .% % $.% % % $.% % .% % % % .% % ` ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % % % % .% % % % .% % % % .% % % % % % % % . .% % .% .% % % .% .% % % .% % .% .% % % $.$.$.$.% % % % . . . .% % % ` ",
" . % % .% % % % .% .% % % % .% % .% % .% % % % .% .% % % % .% % ` % #.#.#.#.% % % .% % % % .% % ` . % % ......% % % . . .@.% @.......@.% @.......@.% % . . .@.% @.......@.% @.......@.% % . . .@.% @.......@.% @.......@.% % % % ..% % % @.% ",
" . % % .% % % % .% .% % % % .% % % % % .% % % % .% .% % % % .% % ` % #.% % % #.% % .% % % % .% % ` . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ",
" . % % .% % % % .% .% % % % .% % % % % .% % % % .% .% % % % .% % ` % #.% % % #.% % .% % % % .% % ` . ",
" . % % % . . . .% % % . . . .% % % % % % % . . . .% % % . . . .% % % ` % #.% % % #.% % % . . . .% % % ` . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % . . . . . . . . . . . . . . . . ` ",
" . % % .% % % % .% .% % % % .% % % % % .% % % % .% .% % % % .% % ` % #.#.#.#.% % % .% % % % .% % ` . % % % % % % ..........% % % % ....................% % % @.% % ......% % % ......% % % ..% % % % % % % % % % % % % % % % % % % % ` ",
" . % % .% % % % .% .% % % % .% % % % % .% % % % .% .% % % % .% % ` % #.% % % #.% % .% % % % .% % ` . % % % % % ..% % % % ......% % ..% % % % % % % % ..% % % ..% ..% % % ..% ..% % % ..% ..% ..% ..% % % % % % % % % % % % % % % % % ` ",
" . % % .% % % % .% .% % % % .% % .% % .% % % % .% .% % % % .% % ` % #.% % % #.% % .% % % % .% % ` . % % % % % ..% % % % ..% % % % ..% % % % % % % % ....% % ..% ..% % % ..% ..% % % ..% % ..% ..% % % % % % % % % % % . . . .% % % ` ",
" . % % .% % % % .% .% % % % .% % .% % .% % % % .% .% % % % .% % ` % #.% % % #.% % .% % % % .% % ` . % % % ......% % % % ..% % % % ..% % % % % % % % ....% % @.% @. . . .@.% @. . . .@.% % % ..% % % % % % % % % % % .% % % % .% % ` ",
" . % % % . . . .% % % . . . .% % % % % % % . . . .% % % . . . .% % % ` % #.#.#.#.% % % % . . . .% % % ` . % % ..% % ..% % % % ......% % ..% % % % % % % % ....% % ..% ..% % % ..% ..% % % ..% % ..% ..% % % #.#.#.#.% % % .% % % % .% % ` ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` % % % % % % % % % % % % % % % % ` . % ..% % % % ..........% % % % ..% % % % % % % % ..% % % ..% ..% % % ..% ..% % % ..% ..% ..% ..% % #.% % % #.% % .% % % % .% % ` ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` % % % % % % % % % % % % % % % % ` . % ..% % % % % % % % % % % % % ....................% % % @.% % ......% % % ......% % % % % ..% % % #.% % % #.% % .% % % % .% % ` ",
" ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % #.% % % #.% % % . . . .% % % ` ",
" . % #.#.#.#.% % % .% % % % .% % ` ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % #.% % % #.% % .% % % % .% % ` ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . % % % % % % . . . . .% % % % . . . . . . . . . .% % % % % % . . .% % % . . .% % % .% % % % % #.% % % #.% % .% % % % .% % ` ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % % % % .% % % % . . .% % .% % % % % % % % .% % % .% .% % % .% .% % % .% .% .% .% % #.% % % #.% % .% % % % .% % ` ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % % % % .% % % % .% % % % .% % % % % % % % . .% % .% .% % % .% .% % % .% % .% .% % % #.#.#.#.% % % % . . . .% % % ` ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % % . . .% % % % .% % % % .% % % % % % % % . .% % % % % . . .% % % . . .% % % % .% % % % % % % % % % % % % % % % % % % ` ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % .% % .% % % % . . .% % .% % % % % % % % . .% % .% .% % % .% .% % % .% % .% .% % % % % % % % % % % % % % % % % % ` ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % .% % % % . . . . .% % % % .% % % % % % % % .% % % .% .% % % .% .% % % .% .% .% .% ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ",
@ -159,33 +159,33 @@ static char * master_xpm[] = {
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % $.$.$.% % % % % % @.% @.$.$.$.@.% @.$.$.$.@.% @.% % % @.% @.$.$.$.@.% @.$.$.$.@.% @.$.$.$.@.% @.$.$.$.@.% @.$.$.$.@.% % % % % % % % % % % % % % % % % % % ",
" ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` . % $.% % % $.% % % % % $.% % % % % $.% % % % % $.% $.% % % $.% $.% % % % % $.% % % % % % % % % $.% $.% % % $.% $.% % % $.% % % % % % % % % % % % % % % % % % % ",
" . % $.% % % $.% % % % % $.% % % % % $.% % % % % $.% $.% % % $.% $.% % % % % $.% % % % % % % % % $.% $.% % % $.% $.% % % $.% % % % % % % % % % % % % % % % % % % ",
" . % @.% % % @.% % % % % @.% @.$.$.$.@.% % $.$.$.@.% @.$.$.$.@.% @.$.$.$.@.% @.$.$.$.@.% % % % % @.% %.$.$.$.%.% @.$.$.$.@.% @.$.$.$.@.% % % % % % % % % % % % % ",
" . % $.% % % $.% % % % % $.% $.% % % % % % % % % $.% % % % % $.% % % % % $.% $.% % % $.% % % % % $.% $.% % % $.% % % % % $.% % % % % % % % % % % % % % % % % % % ",
" . % $.% % % $.% % % % % $.% $.% % % % % % % % % $.% % % % % $.% % % % % $.% $.% % % $.% % % % % $.% $.% % % $.% % % % % $.% % % % % % % % % % % % % % % % % % % ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . % % $.$.$.% % % % % % $.% @.$.$.$.@.% @.$.$.$.@.% % % % % @.% @.$.$.$.@.% @.$.$.$.@.% % % % % @.% @.$.$.$.@.% @.$.$.$.@.% % % % % % % % % % % % % % % % % $.% ",
" . % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ` . % % #.#.#.% % % % % % $.% $.#.#.#.$.% $.#.#.#.$.% $.% % % $.% $.#.#.#.$.% $.#.#.#.$.% $.#.#.#.$.% $.#.#.#.$.% $.#.#.#.$.% % % % % % % % % % % % % % % % % % % ",
" ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` . % #.% % % #.% % % % % #.% % % % % #.% % % % % #.% #.% % % #.% #.% % % % % #.% % % % % % % % % #.% #.% % % #.% #.% % % #.% % % % % % % % % % % % % % % % % % % ",
" . % #.% % % #.% % % % % #.% % % % % #.% % % % % #.% #.% % % #.% #.% % % % % #.% % % % % % % % % #.% #.% % % #.% #.% % % #.% % % % % % % % % % % % % % % % % % % ",
" . % $.% % % $.% % % % % $.% $.#.#.#.$.% % #.#.#.$.% $.#.#.#.$.% $.#.#.#.$.% $.#.#.#.$.% % % % % $.% %.#.#.#.%.% $.#.#.#.$.% $.#.#.#.$.% % % % % % % % % % % % % ",
" . % #.% % % #.% % % % % #.% #.% % % % % % % % % #.% % % % % #.% % % % % #.% #.% % % #.% % % % % #.% #.% % % #.% % % % % #.% % % % % % % % % % % % % % % % % % % ",
" . % #.% % % #.% % % % % #.% #.% % % % % % % % % #.% % % % % #.% % % % % #.% #.% % % #.% % % % % #.% #.% % % #.% % % % % #.% % % % % % % % % % % % % % % % % % % ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . % % #.#.#.% % % % % % #.% $.#.#.#.$.% $.#.#.#.$.% % % % % $.% $.#.#.#.$.% $.#.#.#.$.% % % % % $.% $.#.#.#.$.% $.#.#.#.$.% % % % % % % % % % % % % % % % % #.% ",
" % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ",
"% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ",
"% %.$.$.$.%.% @.$.$.$.% % @.$.$.$.@.% @.$.$.$.% % @.$.$.$.@.% @.$.$.$.@.% @.$.$.$.@.% @.% % % @.% % % @.% % % % % % % @.% @.% % % @.% @.% % % % % $.% % % $.% @.$.$.$.% % @.$.$.$.@.% @.$.$.$.@.% @.$.$.$.@.% @.$.$.$.@.% @.$.$.$.@.% @.$.$.$.@.% @.% % % @.% @.% % % @.% @.% % % @.% @.% % % @.% @.% % % @.% @.$.$.$.@.% ",
"% $.% % % $.% $.% % % $.% $.% % % % % $.% % % $.% $.% % % % % $.% % % % % $.% % % % % $.% % % $.% % % $.% % % % % % % $.% $.% % % $.% $.% % % % % $.$.% $.$.% $.% % % $.% $.% % % $.% $.% % % $.% $.% % % $.% $.% % % $.% $.% % % % % % % $.% % % $.% % % $.% $.% % % $.% $.% % % $.% $.% % % $.% $.% % % $.% % % % % $.% ",
"% $.% % % $.% $.% % % $.% $.% % % % % $.% % % $.% $.% % % % % $.% % % % % $.% % % % % $.% % % $.% % % $.% % % % % % % $.% $.% % $.%.% $.% % % % % $.% $.% $.% $.% % % $.% $.% % % $.% $.% % % $.% $.% % % $.% $.% % % $.% $.% % % % % % % $.% % % $.% % % $.% $.% % % $.% $.% % % $.% %.$.% $.%.% $.% % % $.% % % % $.%.% ",
"% @.$.$.$.@.% @.$.$.$.% % @.% % % % % @.% % % @.% @.$.$.$.% % @.$.$.$.% % @.%.$.$.@.% @.$.$.$.@.% % % @.% % % % % % % @.% @.$.$.%.% % @.% % % % % @.% % % @.% @.% % % @.% @.% % % @.% @.$.$.$.@.% @.$.% % @.% @.$.$.$.% % @.$.$.$.@.% % % @.% % % @.% % % @.% @.% % % @.% @.% % % @.% % %.$.%.% % @.$.$.$.@.% % %.$.%.% % ",
"% $.% % % $.% $.% % % $.% $.% % % % % $.% % % $.% $.% % % % % $.% % % % % $.% % % $.% $.% % % $.% % % $.% % % % % % % $.% $.% % $.%.% $.% % % % % $.% % % $.% $.% % % $.% $.% % % $.% $.% % % % % $.% $.% $.% $.% % % $.% % % % % $.% % % $.% % % $.% % % $.% $.% % % $.% $.% $.% $.% %.$.% $.%.% % % % % $.% %.$.% % % % ",
"% $.% % % $.% $.% % % $.% $.% % % % % $.% % % $.% $.% % % % % $.% % % % % $.% % % $.% $.% % % $.% % % $.% % % % % % % $.% $.% % % $.% $.% % % % % $.% % % $.% $.% % % $.% $.% % % $.% $.% % % % % $.% % $.$.% $.% % % $.% % % % % $.% % % $.% % % $.% % % $.% $.% % % $.% $.$.% $.$.% $.% % % $.% % % % % $.% $.% % % % % ",
"% @.% % % @.% @.$.$.$.% % @.$.$.$.@.% $.$.$.$.% % @.$.$.$.@.% $.% % % % % @.$.$.$.@.% @.% % % @.% % % $.% % % @.$.$.$.@.% @.% % % @.% @.$.$.$.%.% @.% % % @.% $.% % % $.% @.$.$.$.@.% @.% % % % % @.$.$.$.@.% @.% % % @.% @.$.$.$.@.% % % @.% % % %.$.$.$.$.% % $.$.$.% % $.% % % $.% @.% % % $.% @.$.$.$.@.% @.$.$.$.@.% ",
"% %.#.#.#.%.% $.#.#.#.% % $.#.#.#.$.% $.#.#.#.% % $.#.#.#.$.% $.#.#.#.$.% $.#.#.#.$.% $.% % % $.% % % $.% % % % % % % $.% $.% % % $.% $.% % % % % #.% % % #.% $.#.#.#.% % $.#.#.#.$.% $.#.#.#.$.% $.#.#.#.$.% $.#.#.#.$.% $.#.#.#.$.% $.#.#.#.$.% $.% % % $.% $.% % % $.% $.% % % $.% $.% % % $.% $.% % % $.% $.#.#.#.$.% ",
"% #.% % % #.% #.% % % #.% #.% % % % % #.% % % #.% #.% % % % % #.% % % % % #.% % % % % #.% % % #.% % % #.% % % % % % % #.% #.% % % #.% #.% % % % % #.#.% #.#.% #.% % % #.% #.% % % #.% #.% % % #.% #.% % % #.% #.% % % #.% #.% % % % % % % #.% % % #.% % % #.% #.% % % #.% #.% % % #.% #.% % % #.% #.% % % #.% % % % % #.% ",
"% #.% % % #.% #.% % % #.% #.% % % % % #.% % % #.% #.% % % % % #.% % % % % #.% % % % % #.% % % #.% % % #.% % % % % % % #.% #.% % #.%.% #.% % % % % #.% #.% #.% #.% % % #.% #.% % % #.% #.% % % #.% #.% % % #.% #.% % % #.% #.% % % % % % % #.% % % #.% % % #.% #.% % % #.% #.% % % #.% %.#.% #.%.% #.% % % #.% % % % #.%.% ",
"% $.#.#.#.$.% $.#.#.#.% % $.% % % % % $.% % % $.% $.#.#.#.% % $.#.#.#.% % $.%.#.#.$.% $.#.#.#.$.% % % $.% % % % % % % $.% $.#.#.%.% % $.% % % % % $.% % % $.% $.% % % $.% $.% % % $.% $.#.#.#.$.% $.#.% % $.% $.#.#.#.% % $.#.#.#.$.% % % $.% % % $.% % % $.% $.% % % $.% $.% % % $.% % %.#.%.% % $.#.#.#.$.% % %.#.%.% % ",
"% #.% % % #.% #.% % % #.% #.% % % % % #.% % % #.% #.% % % % % #.% % % % % #.% % % #.% #.% % % #.% % % #.% % % % % % % #.% #.% % #.%.% #.% % % % % #.% % % #.% #.% % % #.% #.% % % #.% #.% % % % % #.% #.% #.% #.% % % #.% % % % % #.% % % #.% % % #.% % % #.% #.% % % #.% #.% #.% #.% %.#.% #.%.% % % % % #.% %.#.% % % % ",
"% #.% % % #.% #.% % % #.% #.% % % % % #.% % % #.% #.% % % % % #.% % % % % #.% % % #.% #.% % % #.% % % #.% % % % % % % #.% #.% % % #.% #.% % % % % #.% % % #.% #.% % % #.% #.% % % #.% #.% % % % % #.% % #.#.% #.% % % #.% % % % % #.% % % #.% % % #.% % % #.% #.% % % #.% #.#.% #.#.% #.% % % #.% % % % % #.% #.% % % % % ",
"% $.% % % $.% $.#.#.#.% % $.#.#.#.$.% #.#.#.#.% % $.#.#.#.$.% #.% % % % % $.#.#.#.$.% $.% % % $.% % % #.% % % $.#.#.#.$.% $.% % % $.% $.#.#.#.%.% $.% % % $.% #.% % % #.% $.#.#.#.$.% $.% % % % % $.#.#.#.$.% $.% % % $.% $.#.#.#.$.% % % $.% % % %.#.#.#.#.% % #.#.#.% % #.% % % #.% $.% % % #.% $.#.#.#.$.% $.#.#.#.$.% ",
"% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ",
"% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ",
"% % ........% % % . . . .&.% &.........#.% &.........&.% &. . . . .&.% &.........&.% &.........#.% &.........&.% &.........#.% &.........#.% % % % % % % ........% % % ........% % % % % % % ........% % % ........% % % % . . . .% % % . . . .% % % % % % % . . . .% % % . . . .% % % % $. . . .$.% ",
"% ..% % % % ..% .% % % % ..% .% % % % ..% .% % % % ..% ..% % % % ..% ..% % % % .% ..% % % % .% .% % % % ..% ..% % % % ..% ..% % % % ..% % ..% % % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..% % .% % % % .% .% % % % .% % .% % .% % % % .% .% % % % .% % $.% $.% $. .% ",
"% ..% % % % ..% .% % % % ..% .% % % % ..% .% % % % ..% ..% % % % ..% ..% % % % .% ..% % % % .% .% % % % ..% ..% % % % ..% ..% % % % ..% % ..% % % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..% % .% % % % .% .% % % % .% % .% % .% % % % .% .% % % % .% % .$.% $.% .% ",
"% ..% % % % ..% .% % % % ..% .% % % % ..% .% % % % ..% ..% % % % ..% ..% % % % .% ..% % % % .% .% % % % ..% ..% % % % ..% ..% % % % ..% % % % % % ..% % % % ..% ..% % % % ..% % % % % ..% % % % ..% ..% % % % ..% % .% % % % .% .% % % % .% % % % % .% % % % .% .% % % % .% % .% $.% $. .% ",
"% ..% % % % ..% .% % % % ..% .% % % % ..% .% % % % ..% ..% % % % ..% ..% % % % .% ..% % % % .% .% % % % ..% ..% % % % ..% ..% % % % ..% % % % % % ..% % % % ..% ..% % % % ..% % % % % ..% % % % ..% ..% % % % ..% % .% % % % .% .% % % % .% % % % % .% % % % .% .% % % % .% % .$.% $.% $.% ",
"% &. . . . .&.% % . . . .&.% &.........&.% &.........&.% &.........&.% &.........&.% &.........&.% % . . . .&.% &.........&.% &.........&.% % % % % % &. . . . .&.% &. . . . .&.% % % % % &. . . . .&.% &. . . . .&.% % % . . . .% % % . . . .% % % % % % % . . . .% % % . . . .% % % $. . . .$.% % ",
"% % ........% % % . . . .&.% &.........@.% &.........&.% &. . . . .&.% &.........&.% &.........@.% &.........&.% &.........@.% &.........@.% % % % % % % ........% % % ........% % % % % % % ........% % % ........% % % % . . . .% % % . . . .% % % % % % % . . . .% % % . . . .% % % % #. . . .#.% ",
"% ..% % % % ..% .% % % % ..% .% % % % ..% .% % % % ..% ..% % % % ..% ..% % % % .% ..% % % % .% .% % % % ..% ..% % % % ..% ..% % % % ..% % ..% % % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..% % .% % % % .% .% % % % .% % .% % .% % % % .% .% % % % .% % #.% #.% #. .% ",
"% ..% % % % ..% .% % % % ..% .% % % % ..% .% % % % ..% ..% % % % ..% ..% % % % .% ..% % % % .% .% % % % ..% ..% % % % ..% ..% % % % ..% % ..% % % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..% % .% % % % .% .% % % % .% % .% % .% % % % .% .% % % % .% % .#.% #.% .% ",
"% ..% % % % ..% .% % % % ..% .% % % % ..% .% % % % ..% ..% % % % ..% ..% % % % .% ..% % % % .% .% % % % ..% ..% % % % ..% ..% % % % ..% % % % % % ..% % % % ..% ..% % % % ..% % % % % ..% % % % ..% ..% % % % ..% % .% % % % .% .% % % % .% % % % % .% % % % .% .% % % % .% % .% #.% #. .% ",
"% ..% % % % ..% .% % % % ..% .% % % % ..% .% % % % ..% ..% % % % ..% ..% % % % .% ..% % % % .% .% % % % ..% ..% % % % ..% ..% % % % ..% % % % % % ..% % % % ..% ..% % % % ..% % % % % ..% % % % ..% ..% % % % ..% % .% % % % .% .% % % % .% % % % % .% % % % .% .% % % % .% % .#.% #.% #.% ",
"% &. . . . .&.% % . . . .&.% &.........&.% &.........&.% &.........&.% &.........&.% &.........&.% % . . . .&.% &.........&.% &.........&.% % % % % % &. . . . .&.% &. . . . .&.% % % % % &. . . . .&.% &. . . . .&.% % % . . . .% % % . . . .% % % % % % % . . . .% % % . . . .% % % #. . . .#.% % ",
"% ..% % % % ..% .% % % % ..% ..% % % % .% .% % % % ..% .% % % % ..% .% % % % ..% ..% % % % ..% .% % % % ..% ..% % % % ..% .% % % % ..% % % % % % ..% % % % ..% ..% % % % ..% % % % % ..% % % % ..% ..% % % % ..% % .% % % % .% .% % % % .% % % % % .% % % % .% .% % % % .% % .% % % % .% ",
"% ..% % % % ..% .% % % % ..% ..% % % % .% .% % % % ..% .% % % % ..% .% % % % ..% ..% % % % ..% .% % % % ..% ..% % % % ..% .% % % % ..% % % % % % ..% % % % ..% ..% % % % ..% % % % % ..% % % % ..% ..% % % % ..% % .% % % % .% .% % % % .% % % % % .% % % % .% .% % % % .% % $.$.$.$.$. .% ",
"% ..% % % % ..% .% % % % ..% ..% % % % .% .% % % % ..% .% % % % ..% .% % % % ..% ..% % % % ..% .% % % % ..% ..% % % % ..% .% % % % ..% % ..% % % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..% % .% % % % .% .% % % % .% % .% % .% % % % .% .% % % % .% % $.% % % $.$.% ",
"% ..% % % % ..% .% % % % ..% ..% % % % .% .% % % % ..% .% % % % ..% .% % % % ..% ..% % % % ..% .% % % % ..% ..% % % % ..% .% % % % ..% % ..% % % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..% % .% % % % .% .% % % % .% % .% % .% % % % .% .% % % % .% % $.% % % $.$.% ",
"% % ........% % % . . . .&.% &.........&.% &.........&.% % . . . .&.% &.........&.% &.........&.% % . . . .&.% &.........&.% &.........&.% % % % % % % ........% % % ........% % % % % % % ........% % % ........% % % % . . . .% % % . . . .% % % % % % % . . . .% % % . . . .% % % $.$.$.$.$.% % ",
"% ..% % % % ..% .% % % % ..% ..% % % % .% .% % % % ..% .% % % % ..% .% % % % ..% ..% % % % ..% .% % % % ..% ..% % % % ..% .% % % % ..% % % % % % ..% % % % ..% ..% % % % ..% % % % % ..% % % % ..% ..% % % % ..% % .% % % % .% .% % % % .% % % % % .% % % % .% .% % % % .% % #.#.#.#.#. .% ",
"% ..% % % % ..% .% % % % ..% ..% % % % .% .% % % % ..% .% % % % ..% .% % % % ..% ..% % % % ..% .% % % % ..% ..% % % % ..% .% % % % ..% % ..% % % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..% % .% % % % .% .% % % % .% % .% % .% % % % .% .% % % % .% % #.% % % #.#.% ",
"% ..% % % % ..% .% % % % ..% ..% % % % .% .% % % % ..% .% % % % ..% .% % % % ..% ..% % % % ..% .% % % % ..% ..% % % % ..% .% % % % ..% % ..% % % ..% % % % ..% ..% % % % ..% % ..% % ..% % % % ..% ..% % % % ..% % .% % % % .% .% % % % .% % .% % .% % % % .% .% % % % .% % #.% % % #.#.% ",
"% % ........% % % . . . .&.% &.........&.% &.........&.% % . . . .&.% &.........&.% &.........&.% % . . . .&.% &.........&.% &.........&.% % % % % % % ........% % % ........% % % % % % % ........% % % ........% % % % . . . .% % % . . . .% % % % % % % . . . .% % % . . . .% % % #.#.#.#.#.% % ",
"% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % "};

View file

@ -36,7 +36,7 @@
#include "libacpi.h"
#include "wmacpi.h"
#define WMACPI_VER "2.2rc1"
#define WMACPI_VER "2.2rc3"
/* main pixmap */
#ifdef LOW_COLOR
@ -61,6 +61,7 @@ struct dockapp {
int bell; /* bell on critical low, or not? */
int scroll; /* scroll message text? */
int scroll_reset; /* reset the scrolling text */
int percent;
};
/* globals */
@ -113,7 +114,7 @@ static void clear_time_display(void)
/* set time display to -- -- */
static void invalid_time_display(void)
{
copy_xpm_area(122, 13, 31, 11, 7, 32);
copy_xpm_area(122, 14, 31, 11, 7, 32);
}
static void reset_scroll(void) {
@ -195,7 +196,7 @@ static void scroll_text(void)
static int start, end, stop;
int x = 6; /* x coord of the start of the text area */
int y = 50; /* y coord */
int width = 52; /* width of the text area */
int width = 51; /* width of the text area */
int height = 7; /* height of the text area */
int tw = dockapp->tw; /* width of the rendered text */
int sx, dx, w;
@ -298,10 +299,18 @@ static void render_text(char *string)
scroll_text();
}
static void clear_percentage(void)
{
/* clear the number */
copy_xpm_area(95, 47, 21, 9, 37, 16);
/* clear the bar */
copy_xpm_area(66, 18, 54, 8, 5, 5);
dockapp->percent = -1;
}
static void display_percentage(int percent)
{
static int op = -1;
static unsigned int obar;
unsigned int bar;
int width = 54; /* width of the bar */
float ratio = 100.0/width; /* ratio between the current percentage
@ -310,7 +319,7 @@ static void display_percentage(int percent)
if (percent == -1)
percent = 0;
if (op == percent)
if (dockapp->percent == percent)
return;
if (percent < 0)
@ -318,6 +327,9 @@ static void display_percentage(int percent)
if (percent > 100)
percent = 100;
if (dockapp->percent == -1)
copy_xpm_area(127, 28, 5, 7, 52, 17);
if (percent < 100) { /* 0 - 99 */
copy_xpm_area(95, 48, 8, 7, 37, 17);
if (percent >= 10)
@ -325,17 +337,13 @@ static void display_percentage(int percent)
copy_xpm_area((percent % 10) * 6 + 67, 28, 5, 7, 46, 17);
} else
copy_xpm_area(95, 37, 21, 9, 37, 16); /* 100% */
op = percent;
dockapp->percent = percent;
bar = (int)((float)percent / ratio);
if (bar == obar)
return;
copy_xpm_area(66, 0, bar, 8, 5, 5);
if (bar < 54)
copy_xpm_area(66 + bar, 18, 54 - bar, 8, bar + 5, 5);
obar = bar;
}
static void display_time(int minutes)
@ -446,19 +454,12 @@ static void set_power_panel(global_t *globals)
}
}
if (binfo->charge_state == CHARGE)
blink_power_glyph();
if (globals->battery_count > 0) {
if (binfo->charge_state == CHARGE)
blink_power_glyph();
if ((binfo->state == CRIT) && (ap->power == BATT))
blink_battery_glyph();
if (binfo->state == HARD_CRIT) {
really_blink_battery_glyph();
/* we only do this here because it'd be obnoxious to
* do it anywhere else. */
if (dockapp->bell) {
XBell(dockapp->display, 100);
}
if ((binfo->state == CRIT) && (ap->power == BATT))
blink_battery_glyph();
}
}
@ -489,6 +490,7 @@ void reset_scroll_speed(void) {
* appropriate right now, and then decide within them.
*/
enum messages {
M_NB, /* no batteries */
M_NP, /* not present */
M_AC, /* on ac power */
M_CH, /* battery charging */
@ -505,6 +507,16 @@ static void set_message(global_t *globals)
battery_t *binfo = globals->binfo;
adapter_t *ap = &globals->adapter;
if (globals->battery_count == 0) {
if (state != M_NB) {
state = M_NB;
reset_scroll_speed();
render_text("no batteries");
}
return;
}
/* battery not present case */
if (!binfo->present) {
if (state != M_NP) {
@ -533,12 +545,6 @@ static void set_message(global_t *globals)
scroll_faster(0.75);
render_text("critical low battery");
}
} else if (binfo->state == HARD_CRIT) {
if (state != M_HCB) {
state = M_HCB;
scroll_faster(0.5);
render_text("hard critical low battery");
}
} else if (binfo->state == LOW) {
if (state != M_LB) {
state = M_LB;
@ -557,6 +563,11 @@ static void set_message(global_t *globals)
void set_time_display(global_t *globals)
{
if (globals->battery_count == 0) {
invalid_time_display();
return;
}
if (globals->binfo->charge_state == CHARGE)
display_time(globals->binfo->charge_time);
else if (globals->binfo->charge_state == DISCHARGE)
@ -565,12 +576,17 @@ void set_time_display(global_t *globals)
invalid_time_display();
}
void clear_batt_id_area(void)
{
copy_xpm_area(125, 40, 7, 11, 51, 32);
}
void set_batt_id_area(int bno)
{
int w = 7; /* Width of the number */
int h = 11; /* Height of the number */
int dx = 50; /* x coord of the target area */
int dy = 31; /* y coord of the target area */
int dy = 32; /* y coord of the target area */
int sx = (bno + 1) * 7; /* source x coord */
int sy = 76; /* source y coord */
@ -628,6 +644,16 @@ void cli_wmacpi(global_t *globals, int samples)
return;
}
battery_t *switch_battery(global_t *globals, int battno)
{
globals->binfo = &batteries[battno];
pinfo("changing to monitor battery %s\n", globals->binfo->name);
set_batt_id_area(battno);
dockapp->update = 1;
return globals->binfo;
}
int main(int argc, char **argv)
{
char *display = NULL;
@ -642,7 +668,7 @@ int main(int argc, char **argv)
int scroll_count = 0;
enum rtime_mode rt_mode = RT_RATE;
int rt_forced = 0;
battery_t *binfo;
battery_t *binfo = NULL;
global_t *globals;
DAProgramOption options[] = {
@ -717,8 +743,7 @@ int main(int argc, char **argv)
globals->rt_forced = rt_forced;
if (battery_no > globals->battery_count) {
pfatal("Battery %d not available for monitoring.\n", battery_no);
exit(1);
pinfo("Battery %d not available for monitoring.\n", battery_no);
}
/* check for cli mode */
@ -744,13 +769,17 @@ int main(int argc, char **argv)
/* get initial statistics */
acquire_all_info(globals);
binfo = &batteries[battery_no];
globals->binfo = binfo;
pinfo("monitoring battery %s\n", binfo->name);
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);
}
clear_time_display();
set_power_panel(globals);
set_message(globals);
set_batt_id_area(battery_no);
/* main loop */
while (1) {
@ -773,14 +802,14 @@ int main(int argc, char **argv)
case ButtonPress:
break;
case ButtonRelease:
if (globals->battery_count == 0)
break;
/* cycle through the known batteries. */
battery_no++;
battery_no = battery_no % globals->battery_count;
globals->binfo = &batteries[battery_no];
binfo = globals->binfo;
pinfo("changing to monitor battery %s\n", binfo->name);
set_batt_id_area(battery_no);
dockapp->update = 1;
binfo = switch_battery(globals, battery_no);
break;
case ClientMessage:
/* what /is/ this crap?
@ -834,6 +863,20 @@ int main(int argc, char **argv)
* 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) {
batt_count = 0;
reinit_batteries(globals);
/* battery appeared */
if (globals->battery_count > 0) {
if (battery_no > globals->battery_count)
battery_no = 0;
binfo = switch_battery(globals, battery_no);
}
}
acquire_all_info(globals);
/* we need to be able to reinitialise batteries and adapters, because
@ -872,7 +915,13 @@ int main(int argc, char **argv)
set_time_display(globals);
set_power_panel(globals);
set_message(globals);
display_percentage(binfo->percentage);
if (globals->battery_count == 0) {
clear_percentage();
clear_batt_id_area();
} else
display_percentage(binfo->percentage);
scroll_text();
/* redraw_window, if anything changed - determined inside