mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-13 11:15:27 +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:
parent
1d6a4ddde9
commit
fdb633ce95
@ -1,5 +1,8 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
2006-03-06
|
||||||
|
* Fixed battery problems when charged
|
||||||
|
|
||||||
2006-03-05
|
2006-03-05
|
||||||
* Added patch to make $cpu stuff work on alpha (thanks Thomas Cort)
|
* Added patch to make $cpu stuff work on alpha (thanks Thomas Cort)
|
||||||
http://bugs.gentoo.org/show_bug.cgi?id=122637#c3
|
http://bugs.gentoo.org/show_bug.cgi?id=122637#c3
|
||||||
|
12
src/linux.c
12
src/linux.c
@ -1087,6 +1087,7 @@ void get_battery_stuff(char *buf, unsigned int n, const char *bat)
|
|||||||
{
|
{
|
||||||
static int rep, rep2;
|
static int rep, rep2;
|
||||||
char acpi_path[128];
|
char acpi_path[128];
|
||||||
|
int design_capacity;
|
||||||
snprintf(acpi_path, 127, ACPI_BATTERY_BASE_PATH "/%s/state", bat);
|
snprintf(acpi_path, 127, ACPI_BATTERY_BASE_PATH "/%s/state", bat);
|
||||||
|
|
||||||
/* don't update battery too often */
|
/* don't update battery too often */
|
||||||
@ -1119,12 +1120,13 @@ void get_battery_stuff(char *buf, unsigned int n, const char *bat)
|
|||||||
char b[256];
|
char b[256];
|
||||||
if (fgets(b, 256, fp) == NULL)
|
if (fgets(b, 256, fp) == NULL)
|
||||||
break;
|
break;
|
||||||
|
if (sscanf(b, "design capacity: %d", &design_capacity) != 0) {
|
||||||
if (sscanf
|
continue;
|
||||||
(b, "last full capacity: %d",
|
}
|
||||||
&acpi_last_full) != 0)
|
if (sscanf(b, "last full capacity: %d", &acpi_last_full) != 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
@ -1188,7 +1190,7 @@ void get_battery_stuff(char *buf, unsigned int n, const char *bat)
|
|||||||
&& remaining_capacity != acpi_last_full)
|
&& remaining_capacity != acpi_last_full)
|
||||||
sprintf(last_battery_str, "charged %d%%",
|
sprintf(last_battery_str, "charged %d%%",
|
||||||
remaining_capacity * 100 /
|
remaining_capacity * 100 /
|
||||||
acpi_last_full);
|
design_capacity);
|
||||||
else
|
else
|
||||||
strcpy(last_battery_str, "charged");
|
strcpy(last_battery_str, "charged");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user