Ash Milsted wrote:
> Hello,
>
> I just tried out the new RC on my laptop system, initially neglecting
> to enable ACPI_PROCFS support. Thus I was thrust into using the new
> sysfs interface for the battery.c driver. ..
>
> Unfortunately the charge values etc do not seem to update periodically
> - only (un)plugging the AC power updates the status if ACPI_PROCFS is
> disabled.
> If ACPI_PROCFS is enabled then a read to /proc/acpi/battery/state gets
> the up-to-date data, and a subsequent read to the sysfs equivalents
> gives the same results - otherwise sysfs stays stale.
>
> If you need any more info please say so - this is on an ageing Toshiba
> Satellite 1110.
Could you please test this patch?
>
> Thanks,
>
> Ash
> -
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to [EMAIL PROTECTED]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
ACPI: battery: run acpi_battery_update from sysfs read
From: Alexey Starikovskiy <[EMAIL PROTECTED]>
Update battery information at sysfs read.
Signed-off-by: Alexey Starikovskiy <[EMAIL PROTECTED]>
---
drivers/acpi/battery.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 681e26b..02a396d 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -130,6 +130,8 @@ static int acpi_battery_technology(struct acpi_battery *battery)
return POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
}
+static int acpi_battery_update(struct acpi_battery *battery);
+
static int acpi_battery_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
@@ -139,6 +141,7 @@ static int acpi_battery_get_property(struct power_supply *psy,
if ((!acpi_battery_present(battery)) &&
psp != POWER_SUPPLY_PROP_PRESENT)
return -ENODEV;
+ acpi_battery_update(battery);
switch (psp) {
case POWER_SUPPLY_PROP_STATUS:
if (battery->state & 0x01)