char *attrib_value,
struct battery_status *status)
{
- if ( strstr(attrib_name, "charging state") )
+ if ( strstr(attrib_name, "charging state") )
{
- /* Check this, below is half baked */
- if ( strstr(attrib_value, "charged") )
- status->state = 0;
- else
- status->state = 1;
+ if ( strstr(attrib_value, "charging/discharging") )
+ status->state |= 0x3;
+ else if ( strstr(attrib_value, "discharging") )
+ status->state |= 0x1;
+ else if ( strstr(attrib_value, "charging") )
+ status->state |= 0x2;
+ return;
+ }
+
+ if ( strstr(attrib_name, "capacity state") )
+ {
+ if ( strstr(attrib_value, "ok") )
+ status->state |= 4;
return;
}