mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-21 19:42:24 +01:00
45004f6b09
Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
31 lines
1.2 KiB
Diff
31 lines
1.2 KiB
Diff
From 93d9373574fcb0ed63cc4be7807343b018daad1a Mon Sep 17 00:00:00 2001
|
|
From: Marty Jack <martyj@linux.local>
|
|
Date: Thu, 19 Aug 2010 22:52:44 -0400
|
|
Subject: [PATCH] Battery percentage incorrectly always evaluates as 100 percent (Bug3006059)
|
|
|
|
---
|
|
src/plugins/batt/batt_sys.c | 4 ++--
|
|
1 files changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/plugins/batt/batt_sys.c b/src/plugins/batt/batt_sys.c
|
|
index 3c325b8..2ece803 100644
|
|
--- a/src/plugins/batt/batt_sys.c
|
|
+++ b/src/plugins/batt/batt_sys.c
|
|
@@ -150,7 +150,7 @@ void battery_update( battery *b ) {
|
|
b->state = "available";
|
|
}
|
|
else if ( strcmp("energy_now", sys_file ) == 0 ) {
|
|
- b->remaining_capacity = get_unit_value((gchar*) file_content) / 1000;
|
|
+ b->remaining_energy = get_unit_value((gchar*) file_content) / 1000;
|
|
if (!b->state)
|
|
b->state = "available";
|
|
}
|
|
@@ -215,7 +215,7 @@ void battery_update( battery *b ) {
|
|
if (b->last_capacity < MIN_CAPACITY)
|
|
b->percentage = 0;
|
|
else
|
|
- b->percentage = b->remaining_capacity * 100 / b->last_capacity;
|
|
+ b->percentage = ((float) b->remaining_energy * 100.0) / (float) b->last_capacity_unit;
|
|
|
|
if (b->percentage > 100)
|
|
b->percentage = 100;
|