wmacpi: Bump to wmacpi-ng version 0.99.
Source obtained from http://sourceforge.net/projects/wmacpi/files/. 2003 September 26 0.99 Fix the last of the old wmacpi code oddities (specifically, the APMInfo struct, which was a completely inappropriate name given we no longer deal with APM, and because of the various code refactoring). I think this is probably as good as I can make it without getting more feedback and the like, so I'm going to make this version 0.99, preliminary to either wmacpi-ng 1.0 or wmacpi 2.0 (depending which direction I go with that).
This commit is contained in:
parent
df54026a62
commit
310714058f
|
@ -1,3 +1,14 @@
|
||||||
|
2003 September 26 0.99
|
||||||
|
Fix the last of the old wmacpi code oddities (specifically, the
|
||||||
|
APMInfo struct, which was a completely inappropriate name given we
|
||||||
|
no longer deal with APM, and because of the various code
|
||||||
|
refactoring).
|
||||||
|
|
||||||
|
I think this is probably as good as I can make it without getting
|
||||||
|
more feedback and the like, so I'm going to make this version
|
||||||
|
0.99, preliminary to either wmacpi-ng 1.0 or wmacpi 2.0 (depending
|
||||||
|
which direction I go with that).
|
||||||
|
|
||||||
2003 September 23 0.92
|
2003 September 23 0.92
|
||||||
Fix a few more bugs, and include an option to allow the user to
|
Fix a few more bugs, and include an option to allow the user to
|
||||||
specify how often to sample the ACPI data - some BIOSes disable
|
specify how often to sample the ACPI data - some BIOSes disable
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
|
|
||||||
#include "libacpi.h"
|
#include "libacpi.h"
|
||||||
|
|
||||||
#define ACPI_NG_VER "0.90"
|
#define ACPI_NG_VER "0.99"
|
||||||
|
|
||||||
APMInfo *apminfo;
|
global_t *globals;
|
||||||
|
|
||||||
void usage(char *name)
|
void usage(char *name)
|
||||||
{
|
{
|
||||||
|
@ -84,7 +84,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apminfo = (APMInfo *) malloc(sizeof(APMInfo));
|
globals = (global_t *) malloc(sizeof(global_t));
|
||||||
|
|
||||||
power_init();
|
power_init();
|
||||||
/* we want to acquire samples over some period of time, so . . . */
|
/* we want to acquire samples over some period of time, so . . . */
|
||||||
|
@ -95,7 +95,7 @@ int main(int argc, char *argv[])
|
||||||
usleep(sleep_time);
|
usleep(sleep_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
ap = &apminfo->adapter;
|
ap = &globals->adapter;
|
||||||
if(ap->power == AC) {
|
if(ap->power == AC) {
|
||||||
printf("On AC Power");
|
printf("On AC Power");
|
||||||
for(i = 0; i < batt_count; i++) {
|
for(i = 0; i < batt_count; i++) {
|
||||||
|
@ -118,9 +118,9 @@ int main(int argc, char *argv[])
|
||||||
printf(", Battery %s at %d%%", binfo->name,
|
printf(", Battery %s at %d%%", binfo->name,
|
||||||
binfo->percentage);
|
binfo->percentage);
|
||||||
}
|
}
|
||||||
if(apminfo->rtime >= 0)
|
if(globals->rtime >= 0)
|
||||||
printf("; %d:%02d remaining", apminfo->rtime/60,
|
printf("; %d:%02d remaining", globals->rtime/60,
|
||||||
apminfo->rtime%60);
|
globals->rtime%60);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
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
|
wmacpi-ng (0.92-1) unstable; urgency=low
|
||||||
|
|
||||||
* New upstream version.
|
* New upstream version.
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include "libacpi.h"
|
#include "libacpi.h"
|
||||||
|
|
||||||
extern char *state[];
|
extern char *state[];
|
||||||
extern APMInfo *apminfo;
|
extern global_t *globals;
|
||||||
/* temp buffer */
|
/* temp buffer */
|
||||||
char buf[512];
|
char buf[512];
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ int init_ac_adapters(void)
|
||||||
{
|
{
|
||||||
DIR *acdir;
|
DIR *acdir;
|
||||||
struct dirent *adapter;
|
struct dirent *adapter;
|
||||||
adapter_t *ap = &apminfo->adapter;
|
adapter_t *ap = &globals->adapter;
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
acdir = opendir("/proc/acpi/ac_adapter");
|
acdir = opendir("/proc/acpi/ac_adapter");
|
||||||
|
@ -166,7 +166,7 @@ power_state_t get_power_status(void)
|
||||||
FILE *file;
|
FILE *file;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
char *val;
|
char *val;
|
||||||
adapter_t *ap = &apminfo->adapter;
|
adapter_t *ap = &globals->adapter;
|
||||||
|
|
||||||
if ((file = fopen(ap->state_file, "r")) == NULL) {
|
if ((file = fopen(ap->state_file, "r")) == NULL) {
|
||||||
snprintf(buf, 1024, "Could not open state file %s", ap->state_file);
|
snprintf(buf, 1024, "Could not open state file %s", ap->state_file);
|
||||||
|
@ -385,7 +385,7 @@ static int calc_charge_time(int batt)
|
||||||
void acquire_batt_info(int batt)
|
void acquire_batt_info(int batt)
|
||||||
{
|
{
|
||||||
battery_t *binfo;
|
battery_t *binfo;
|
||||||
adapter_t *ap = &apminfo->adapter;
|
adapter_t *ap = &globals->adapter;
|
||||||
|
|
||||||
get_battery_info(batt);
|
get_battery_info(batt);
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ void acquire_batt_info(int batt)
|
||||||
binfo->percentage = 0;
|
binfo->percentage = 0;
|
||||||
binfo->valid = 0;
|
binfo->valid = 0;
|
||||||
binfo->charge_time = 0;
|
binfo->charge_time = 0;
|
||||||
apminfo->rtime = 0;
|
globals->rtime = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,10 +403,10 @@ void acquire_batt_info(int batt)
|
||||||
|
|
||||||
/* set the battery's capacity state, based (at present) on some
|
/* set the battery's capacity state, based (at present) on some
|
||||||
* guesstimated values: more than 75% == HIGH, 25% to 75% MED, and
|
* guesstimated values: more than 75% == HIGH, 25% to 75% MED, and
|
||||||
* less than 25% is LOW. Less than apminfo->crit_level is CRIT. */
|
* less than 25% is LOW. Less than globals->crit_level is CRIT. */
|
||||||
if (binfo->percentage == -1)
|
if (binfo->percentage == -1)
|
||||||
binfo->state = BS_ERR;
|
binfo->state = BS_ERR;
|
||||||
if (binfo->percentage < apminfo->crit_level)
|
if (binfo->percentage < globals->crit_level)
|
||||||
binfo->state = CRIT;
|
binfo->state = CRIT;
|
||||||
else if (binfo->percentage > 75)
|
else if (binfo->percentage > 75)
|
||||||
binfo->state = HIGH;
|
binfo->state = HIGH;
|
||||||
|
@ -416,7 +416,7 @@ void acquire_batt_info(int batt)
|
||||||
binfo->state = LOW;
|
binfo->state = LOW;
|
||||||
|
|
||||||
/* we need to /know/ that we've got a valid state for the
|
/* we need to /know/ that we've got a valid state for the
|
||||||
* apminfo->power value . . . .*/
|
* globals->power value . . . .*/
|
||||||
ap->power = get_power_status();
|
ap->power = get_power_status();
|
||||||
|
|
||||||
if ((ap->power != AC) && (binfo->charge_state == DISCHARGE)) {
|
if ((ap->power != AC) && (binfo->charge_state == DISCHARGE)) {
|
||||||
|
@ -451,7 +451,7 @@ void acquire_global_info(void)
|
||||||
float rcap = 0;
|
float rcap = 0;
|
||||||
float rate = 0;
|
float rate = 0;
|
||||||
battery_t *binfo;
|
battery_t *binfo;
|
||||||
adapter_t *ap = &apminfo->adapter;
|
adapter_t *ap = &globals->adapter;
|
||||||
static float rate_samples[SAMPLES];
|
static float rate_samples[SAMPLES];
|
||||||
static int j = 0;
|
static int j = 0;
|
||||||
static int sample_count = 0;
|
static int sample_count = 0;
|
||||||
|
@ -507,7 +507,7 @@ void acquire_global_info(void)
|
||||||
rtime = 0;
|
rtime = 0;
|
||||||
out:
|
out:
|
||||||
eprint(0, "time rem: %d\n", rtime);
|
eprint(0, "time rem: %d\n", rtime);
|
||||||
apminfo->rtime = rtime;
|
globals->rtime = rtime;
|
||||||
|
|
||||||
/* get the power status.
|
/* get the power status.
|
||||||
* note that this is actually reported seperately from the
|
* note that this is actually reported seperately from the
|
||||||
|
|
|
@ -77,7 +77,7 @@ typedef struct {
|
||||||
int timer; /* how long been on battery? */
|
int timer; /* how long been on battery? */
|
||||||
int crit_level; /* anything below this is critical low */
|
int crit_level; /* anything below this is critical low */
|
||||||
battery_t *binfo; /* pointer to the battery being monitored */
|
battery_t *binfo; /* pointer to the battery being monitored */
|
||||||
} APMInfo;
|
} global_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note that there are some serious problems with this: firstly, handling of
|
* Note that there are some serious problems with this: firstly, handling of
|
||||||
|
@ -119,7 +119,7 @@ int batt_count;
|
||||||
|
|
||||||
/* check if apm/acpi is enabled, etc */
|
/* check if apm/acpi is enabled, etc */
|
||||||
int power_init(void);
|
int power_init(void);
|
||||||
/* fill APMInfo with data */
|
/* fill global_t with data */
|
||||||
void acquire_batt_info(int);
|
void acquire_batt_info(int);
|
||||||
void acquire_all_batt_info(void);
|
void acquire_all_batt_info(void);
|
||||||
void acquire_global_info(void);
|
void acquire_global_info(void);
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include "libacpi.h"
|
#include "libacpi.h"
|
||||||
#include "wmacpi-ng.h"
|
#include "wmacpi-ng.h"
|
||||||
|
|
||||||
#define WMACPI_NG_VER "0.90"
|
#define WMACPI_NG_VER "0.99"
|
||||||
|
|
||||||
/* main pixmap */
|
/* main pixmap */
|
||||||
#ifdef LOW_COLOR
|
#ifdef LOW_COLOR
|
||||||
|
@ -66,7 +66,7 @@ char *state[] = { "AC", "Charging", "High", "Low", "Crit" };
|
||||||
|
|
||||||
/* globals */
|
/* globals */
|
||||||
Dockapp *dockapp;
|
Dockapp *dockapp;
|
||||||
APMInfo *apminfo;
|
global_t *globals;
|
||||||
int count = 0; /* global timer variable */
|
int count = 0; /* global timer variable */
|
||||||
int noisy_critical = 0; /* ring xbell annoyingly if critical? */
|
int noisy_critical = 0; /* ring xbell annoyingly if critical? */
|
||||||
|
|
||||||
|
@ -449,8 +449,8 @@ static void blink_battery_glyph(void)
|
||||||
static void set_power_panel(void)
|
static void set_power_panel(void)
|
||||||
{
|
{
|
||||||
enum panel_states power = PS_NULL;
|
enum panel_states power = PS_NULL;
|
||||||
battery_t *binfo = apminfo->binfo;
|
battery_t *binfo = globals->binfo;
|
||||||
adapter_t *ap = &apminfo->adapter;
|
adapter_t *ap = &globals->adapter;
|
||||||
|
|
||||||
if (ap->power == AC) {
|
if (ap->power == AC) {
|
||||||
if (power != PS_AC) {
|
if (power != PS_AC) {
|
||||||
|
@ -504,8 +504,8 @@ enum messages {
|
||||||
static void set_message(void)
|
static void set_message(void)
|
||||||
{
|
{
|
||||||
static enum messages state = M_NULL;
|
static enum messages state = M_NULL;
|
||||||
battery_t *binfo = apminfo->binfo;
|
battery_t *binfo = globals->binfo;
|
||||||
adapter_t *ap = &apminfo->adapter;
|
adapter_t *ap = &globals->adapter;
|
||||||
|
|
||||||
/* battery not present case */
|
/* battery not present case */
|
||||||
if (!binfo->present) {
|
if (!binfo->present) {
|
||||||
|
@ -563,7 +563,7 @@ void set_time_display(void)
|
||||||
if (binfo->charge_state == CHARGE)
|
if (binfo->charge_state == CHARGE)
|
||||||
display_time(binfo->charge_time);
|
display_time(binfo->charge_time);
|
||||||
else if (binfo->charge_state == DISCHARGE)
|
else if (binfo->charge_state == DISCHARGE)
|
||||||
display_time(apminfo->rtime);
|
display_time(globals->rtime);
|
||||||
else
|
else
|
||||||
invalid_time_display();
|
invalid_time_display();
|
||||||
}
|
}
|
||||||
|
@ -622,10 +622,10 @@ int main(int argc, char **argv)
|
||||||
battery_t *binfo;
|
battery_t *binfo;
|
||||||
|
|
||||||
dockapp = calloc(1, sizeof(Dockapp));
|
dockapp = calloc(1, sizeof(Dockapp));
|
||||||
apminfo = calloc(1, sizeof(APMInfo));
|
globals = calloc(1, sizeof(global_t));
|
||||||
|
|
||||||
dockapp->blink = 1;
|
dockapp->blink = 1;
|
||||||
apminfo->crit_level = 10;
|
globals->crit_level = 10;
|
||||||
battery_no = 1;
|
battery_no = 1;
|
||||||
|
|
||||||
/* see if whatever we want to use is supported */
|
/* see if whatever we want to use is supported */
|
||||||
|
@ -641,10 +641,10 @@ int main(int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
if (optarg) {
|
if (optarg) {
|
||||||
apminfo->crit_level = atoi(optarg);
|
globals->crit_level = atoi(optarg);
|
||||||
if ((apminfo->crit_level < 0) || (apminfo->crit_level > 100)) {
|
if ((globals->crit_level < 0) || (globals->crit_level > 100)) {
|
||||||
fprintf(stderr, "Please use values between 0 and 100%%\n");
|
fprintf(stderr, "Please use values between 0 and 100%%\n");
|
||||||
apminfo->crit_level = 10;
|
globals->crit_level = 10;
|
||||||
fprintf(stderr, "Using default value of 10%%\n");
|
fprintf(stderr, "Using default value of 10%%\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -712,7 +712,7 @@ int main(int argc, char **argv)
|
||||||
/* get initial statistics */
|
/* get initial statistics */
|
||||||
acquire_all_info();
|
acquire_all_info();
|
||||||
binfo = &batteries[battery_no];
|
binfo = &batteries[battery_no];
|
||||||
apminfo->binfo = binfo;
|
globals->binfo = binfo;
|
||||||
fprintf(stderr, "monitoring battery %s\n", binfo->name);
|
fprintf(stderr, "monitoring battery %s\n", binfo->name);
|
||||||
clear_time_display();
|
clear_time_display();
|
||||||
set_power_panel();
|
set_power_panel();
|
||||||
|
@ -742,8 +742,8 @@ int main(int argc, char **argv)
|
||||||
/* cycle through the known batteries. */
|
/* cycle through the known batteries. */
|
||||||
battery_no++;
|
battery_no++;
|
||||||
battery_no = battery_no % batt_count;
|
battery_no = battery_no % batt_count;
|
||||||
apminfo->binfo = &batteries[battery_no];
|
globals->binfo = &batteries[battery_no];
|
||||||
binfo = apminfo->binfo;
|
binfo = globals->binfo;
|
||||||
fprintf(stderr, "changing to monitor battery %d\n", battery_no + 1);
|
fprintf(stderr, "changing to monitor battery %d\n", battery_no + 1);
|
||||||
set_batt_id_area(battery_no);
|
set_batt_id_area(battery_no);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue