diff options
| author | Andres Salomon <dilinger@debian.org> | 2008-09-04 15:13:37 -0400 |
|---|---|---|
| committer | Andres Salomon <dilinger@debian.org> | 2008-09-04 15:13:37 -0400 |
| commit | 222f7583b4602355bf507280ff466a9c19090729 (patch) | |
| tree | 494f121c03ed41f0f099b22f2e84ff96666a2f5f /drivers/power | |
| parent | de9342825d8b15a107e262ed719fe559157d834b (diff) | |
| download | lwn-222f7583b4602355bf507280ff466a9c19090729.tar.gz lwn-222f7583b4602355bf507280ff466a9c19090729.zip | |
OLPC: power_supply: add an 'error' property that displays raw errors
Grab the error code from EC_BAT_ERRCODE and let the user see it (rather
than attempting to decode it as we do with PROP_HEALTH).
Signed-off-by: Andres Salomon <dilinger@debian.org>
Diffstat (limited to 'drivers/power')
| -rw-r--r-- | drivers/power/olpc_battery.c | 8 | ||||
| -rw-r--r-- | drivers/power/power_supply_sysfs.c | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/drivers/power/olpc_battery.c b/drivers/power/olpc_battery.c index d79cd31cd074..c5e94f3c8d25 100644 --- a/drivers/power/olpc_battery.c +++ b/drivers/power/olpc_battery.c @@ -246,6 +246,13 @@ static int olpc_bat_get_property(struct power_supply *psy, } break; + case POWER_SUPPLY_PROP_ERROR: + ret = olpc_ec_cmd(EC_BAT_ERRCODE, NULL, 0, &ec_byte, 1); + if (ret) + return ret; + val->intval = ec_byte; + break; + case POWER_SUPPLY_PROP_MANUFACTURER: ret = olpc_bat_get_mfr(val); if (ret) @@ -328,6 +335,7 @@ static enum power_supply_property olpc_bat_props[] = { POWER_SUPPLY_PROP_TEMP, POWER_SUPPLY_PROP_TEMP_AMBIENT, POWER_SUPPLY_PROP_ACCUM_CURRENT, + POWER_SUPPLY_PROP_ERROR, POWER_SUPPLY_PROP_MANUFACTURER, POWER_SUPPLY_PROP_SERIAL_NUMBER, }; diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c index 9818250f8d67..f4a935bedfe9 100644 --- a/drivers/power/power_supply_sysfs.c +++ b/drivers/power/power_supply_sysfs.c @@ -114,6 +114,7 @@ static struct device_attribute power_supply_attrs[] = { POWER_SUPPLY_ATTR(time_to_full_now), POWER_SUPPLY_ATTR(time_to_full_avg), POWER_SUPPLY_ATTR(accum_current), + POWER_SUPPLY_ATTR(error), /* Properties of type `const char *' */ POWER_SUPPLY_ATTR(model_name), POWER_SUPPLY_ATTR(manufacturer), |
