mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-13 03:11:16 +00:00
freebsd battery patch
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@613 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
e8c9f49594
commit
c4bf55b542
1
AUTHORS
1
AUTHORS
@ -128,6 +128,7 @@ Pascal Eberhard <pascal dor eberhard at gmail dot com>
|
|||||||
|
|
||||||
Petr Holub <hopet@users.sourceforge.net>
|
Petr Holub <hopet@users.sourceforge.net>
|
||||||
fix autotools on FreeBSD in autogen.sh
|
fix autotools on FreeBSD in autogen.sh
|
||||||
|
Improved battery readout on FreeBSD
|
||||||
|
|
||||||
Philip Kovacs <pkovacs at users dot sourceforge dot net>
|
Philip Kovacs <pkovacs at users dot sourceforge dot net>
|
||||||
tcp port monitor with hashing functionality
|
tcp port monitor with hashing functionality
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
2006-03-25
|
2006-03-25
|
||||||
* Added XMMS2 patch 1456203 from Lassi Selander
|
* Added XMMS2 patch 1456203 from Lassi Selander
|
||||||
|
* Added FreeBSD battery patch 1456008 from Petr Holub
|
||||||
|
|
||||||
2006-03-21
|
2006-03-21
|
||||||
* Fixed ${top(_mem)} related code on FreeBSD (with help of Petr
|
* Fixed ${top(_mem)} related code on FreeBSD (with help of Petr
|
||||||
|
@ -347,17 +347,41 @@ get_acpi_temperature(int fd)
|
|||||||
void
|
void
|
||||||
get_battery_stuff(char *buf, unsigned int n, const char *bat)
|
get_battery_stuff(char *buf, unsigned int n, const char *bat)
|
||||||
{
|
{
|
||||||
int battime;
|
int battime, batcapacity, batstate, ac;
|
||||||
|
|
||||||
if (GETSYSCTL("hw.acpi.battery.time", battime))
|
if (GETSYSCTL("hw.acpi.battery.time", battime))
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
"Cannot read sysctl \"hw.acpi.battery.time\"\n");
|
"Cannot read sysctl \"hw.acpi.battery.time\"\n");
|
||||||
|
if (GETSYSCTL("hw.acpi.battery.life", batcapacity))
|
||||||
|
(void) fprintf(stderr,
|
||||||
|
"Cannot read sysctl \"hw.acpi.battery.life\"\n");
|
||||||
|
|
||||||
|
if (GETSYSCTL("hw.acpi.battery.state", batstate))
|
||||||
|
(void) fprintf(stderr,
|
||||||
|
"Cannot read sysctl \"hw.acpi.battery.state\"\n");
|
||||||
|
|
||||||
|
if (GETSYSCTL("hw.acpi.acline", ac))
|
||||||
|
(void) fprintf(stderr,
|
||||||
|
"Cannot read sysctl \"hw.acpi.acline\"\n");
|
||||||
|
|
||||||
|
if (batstate == 1) {
|
||||||
|
if (battime != -1)
|
||||||
|
snprintf(buf, n, "remaining %d%% (%d:%2.2d)",
|
||||||
|
batcapacity, battime / 60, battime % 60);
|
||||||
|
else
|
||||||
|
/* no time estimate available yet */
|
||||||
|
snprintf(buf, n, "remaining %d%%",
|
||||||
|
batcapacity);
|
||||||
|
if (ac == 1)
|
||||||
|
(void) fprintf(stderr, "Discharging while on AC!\n");
|
||||||
|
} else {
|
||||||
|
snprintf(buf, n, batstate == 2 ? "charging (%d%%)" : "charged (%d%%)", batcapacity);
|
||||||
|
if (batstate != 2 && batstate != 0)
|
||||||
|
(void) fprintf(stderr, "Unknow battery state %d!\n", batstate);
|
||||||
|
if (ac == 0)
|
||||||
|
(void) fprintf(stderr, "Charging while not on AC!\n");
|
||||||
|
}
|
||||||
|
|
||||||
if (battime != -1)
|
|
||||||
snprintf(buf, n, "Discharging, remaining %d:%2.2d",
|
|
||||||
battime / 60, battime % 60);
|
|
||||||
else
|
|
||||||
snprintf(buf, n, "Battery is charging");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user