[ltp] tp_smapi does not report status correctly when using battery charge control features

Darren Hoo linux-thinkpad@linux-thinkpad.org
Mon, 6 Jul 2009 18:41:32 +0800


On Mon, Jul 6, 2009 at 4:04 PM, Richard Hughes<hughsient@gmail.com> wrote:
> 2009/7/6 Darren Hoo <darren.hoo@gmail.com>:
>> I've got a thinkpad T60 and have battery charge control features enabled=
:
>> =A0 =A0# echo 40 > /sys/devices/platform/smapi/BAT0/start_charge_thresh
>> =A0 =A0# echo 100 > /sys/devices/platform/smapi/BAT0/stop_charge_thresh
>> upon this setup,when the battery =A0capacity is about say 80% and AC pow=
er
>> is on, the battery is in a state of =A0 not charging nor fully charged.t=
hus
>> g-p-m applet shows an warning icon.This is not as g-p-m 2.24 has worked.
>>
>> line 131 of =A0src/gpm-devicekit.c says:
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} else if (state =3D=3D DKP_DEVICE_STATE_=
UNKNOWN && percentage > 95.0f) {
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0egg_warning ("fixing up u=
nknown %f", percentage);
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0filename =3D g_strdup_pri=
ntf ("gpm-%s-charged", prefix);
>>
>> I think here the percentage > 95.0f =A0here is too strict and unnecessar=
y.
>
> Well, the battery state is unknown, so g-p-m can't really do anything
> sensible here. I think part of the problem is that ACPI exposes two
> values, is_charging and is_discharging, and so it's tricky to map them
> to a sane number of states.
>
> What's the value of state in the correct device in
> /sys/class/power_supply? If this is fixed in the kernel, it'll just
> work in g-p-m. Just lowering the threshold is not a good idea at all,
> and I'll probably remove that hack from g-p-m altogether.
>
Hi,Richard and tp_smapi developers,
Thanks,

$ cat /sys/class/power_supply/BAT0/status
Unknown

So the status is unknown.The kernel module I use is tp_smapi which is
not in the  mainstream kernel yet .
If you don't mind I've cc'ed this mail to tm_smapi developer's mailing-list=
.
I would like to see what are their  opinions on this.