[Pkg-acpi-devel] ACPI "acpitool -B" on debian-unstable
Aliaksandr Kotseleu
a.kotelev at gmail.com
Fri Mar 12 15:42:27 UTC 2010
Hello,
On my notebook Asus S1300N acpitool doesn't show correct information
about battery:
System:
Debian unstable
acpitool 0.5-7
sync2:/# acpitool -B
Battery #1 : present
Remaining capacity : unknown, nan%
Design capacity : unknown
Last full capacity : unknown, -1.00% of design capacity
Capacity loss : 101.%
Present rate : 0 mA
Charging state : Discharging
Battery type : Li-ion, Battery
Model number : BA-02
sync2:/sys/class/power_supply/BAT0# cat uevent
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_TYPE=Battery
POWER_SUPPLY_STATUS=Discharging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=14800000
POWER_SUPPLY_VOLTAGE_NOW=17099000
POWER_SUPPLY_CURRENT_NOW=0
POWER_SUPPLY_CHARGE_FULL_DESIGN=4320000
POWER_SUPPLY_CHARGE_FULL=4320000
POWER_SUPPLY_CHARGE_NOW=2845000
POWER_SUPPLY_MODEL_NAME=BA-02
POWER_SUPPLY_MANUFACTURER=ASUSTek
POWER_SUPPLY_SERIAL_NUMBER=
As i understand acpitool doesn't process POWER_SUPPLY_CHARGE_* parameters.
--- acpitool-0.5-orig/src/battery.cpp 2010-03-12 17:17:32.000000000 +0200
+++ acpitool-0.5/src/battery.cpp 2010-03-12 17:18:20.000000000 +0200
@@ -638,17 +638,29 @@ int Get_Battery_Info_from_Sys(const int
value = atoi(temp) / 1000;
snprintf(temp, sizeof(temp), "%i mA", value);
strncpy(bat_info->Charge_Now, temp, 12);
+ snprintf(temp, sizeof(temp), "%i mAh", value);
+ strncpy(bat_info->Remaining_Cap, temp, 9);
}
else if (strcmp(attr,"POWER_SUPPLY_ENERGY_FULL_DESIGN")==0) {
value = atoi(temp) / 1000;
snprintf(temp, sizeof(temp), "%i mWh", value);
strncpy(bat_info->Design_Cap, temp, 9);
}
+ else if (strcmp(attr,"POWER_SUPPLY_CHARGE_FULL_DESIGN")==0) {
+ value = atoi(temp) / 1000;
+ snprintf(temp, sizeof(temp), "%i mAh", value);
+ strncpy(bat_info->Design_Cap, temp, 9);
+ }
else if (strcmp(attr,"POWER_SUPPLY_ENERGY_FULL")==0) {
value = atoi(temp) / 1000;
snprintf(temp, sizeof(temp), "%i mWh", value);
strncpy(bat_info->LastFull_Cap, temp, 9);
}
+ else if (strcmp(attr,"POWER_SUPPLY_CHARGE_FULL")==0) {
+ value = atoi(temp) / 1000;
+ snprintf(temp, sizeof(temp), "%i mAh", value);
+ strncpy(bat_info->LastFull_Cap, temp, 9);
+ }
else if (strcmp(attr,"POWER_SUPPLY_ENERGY_NOW")==0) {
value = atoi(temp) / 1000;
snprintf(temp, sizeof(temp), "%i mWh", value);
This patch fixed this issue.
acpitool-0.5/src$ ./acpitool -B
Battery #1 : present
Remaining capacity : 2845 mAh, 65.86%
Design capacity : 4320 mAh
Last full capacity : 4320 mAh
Present rate : 0 mA
Charging state : Discharging
Battery type : Li-ion, Battery
Model number : BA-02
With best regards,
Aliaksandr Kotseleu
More information about the Pkg-acpi-devel
mailing list