diff options
author | Michael Stapelberg <michael+x200@stapelberg.de> | 2009-04-09 19:15:18 +0200 |
---|---|---|
committer | Michael Stapelberg <michael+x200@stapelberg.de> | 2009-04-09 19:15:18 +0200 |
commit | 5fc9e2ffb247f1e95c57c5f4640837fe78aea24d (patch) | |
tree | d8aeb20e0033e88c3631749b1746e5e45bcb338b /wmiistatus.c | |
parent | 02b4992e9d3b63bd5eb397d7bbed9936bd2004c4 (diff) |
Display the information we have
Diffstat (limited to 'wmiistatus.c')
-rw-r--r-- | wmiistatus.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/wmiistatus.c b/wmiistatus.c index cba4d8b..e1b8097 100644 --- a/wmiistatus.c +++ b/wmiistatus.c @@ -307,7 +307,10 @@ static char *get_battery_info() { last = walk+1; (void)close(fd); - if ((full_design != -1) && (remaining != -1) && (present_rate > 0)) { + if ((full_design != 1) && (remaining != -1)) + return part; + + if (present_rate > 0) { float remaining_time; int seconds, hours, minutes; if (status == CS_CHARGING) @@ -327,6 +330,11 @@ static char *get_battery_info() { (status == CS_DISCHARGING ? "BAT" : "FULL")), (((float)remaining / (float)full_design) * 100), hours, minutes, seconds); + } else { + (void)snprintf(part, sizeof(part), "%s %.02f%%", + (status == CS_CHARGING ? "CHR" : + (status == CS_DISCHARGING ? "BAT" : "FULL")), + (((float)remaining / (float)full_design) * 100)); } return part; } |