1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 12:10:03 +00:00

battery probs

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@544 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2006-03-07 01:49:51 +00:00
parent 1d6a4ddde9
commit fdb633ce95
2 changed files with 10 additions and 5 deletions

View File

@ -1,5 +1,8 @@
# $Id$
2006-03-06
* Fixed battery problems when charged
2006-03-05
* Added patch to make $cpu stuff work on alpha (thanks Thomas Cort)
http://bugs.gentoo.org/show_bug.cgi?id=122637#c3

View File

@ -1087,6 +1087,7 @@ void get_battery_stuff(char *buf, unsigned int n, const char *bat)
{
static int rep, rep2;
char acpi_path[128];
int design_capacity;
snprintf(acpi_path, 127, ACPI_BATTERY_BASE_PATH "/%s/state", bat);
/* don't update battery too often */
@ -1119,11 +1120,12 @@ void get_battery_stuff(char *buf, unsigned int n, const char *bat)
char b[256];
if (fgets(b, 256, fp) == NULL)
break;
if (sscanf
(b, "last full capacity: %d",
&acpi_last_full) != 0)
if (sscanf(b, "design capacity: %d", &design_capacity) != 0) {
continue;
}
if (sscanf(b, "last full capacity: %d", &acpi_last_full) != 0) {
break;
}
}
fclose(fp);
@ -1188,7 +1190,7 @@ void get_battery_stuff(char *buf, unsigned int n, const char *bat)
&& remaining_capacity != acpi_last_full)
sprintf(last_battery_str, "charged %d%%",
remaining_capacity * 100 /
acpi_last_full);
design_capacity);
else
strcpy(last_battery_str, "charged");
}