How to check charged percentage of battery and to adjust its thresholds?

  1. I was wondering how to check the current charged percentage of battery on my Lenovo T400?

  2. I forgot which program I used to control the battery to stop charging at 60% and start charging at 40%.

    Now I want to adjust the thresholds. So I wonder how to do that?


Solution 1:

1: In general, the directory /proc/acpi/battery/ should have a host of information about your battery. So cat /proc/acpi/battery/info should bring up original manufacturing information and cat /proc/acpi/battery/state should bring up current information, including the charging status.

More specifically, since you have a Lenovo, I think these commands might work as well (maybe these will work and the above ones won't):

cat /sys/devices/platform/smapi/BAT0/state
cat /sys/devices/platform/smapi/BAT0/remaining_percent
cat /sys/devices/platform/smapi/BAT0/remaining_running_time
cat /sys/devices/platform/smapi/BAT0/remaining_charging_time
cat /sys/devices/platform/smapi/BAT0/remaining_capacity

2: I think this is what you're after:

Set starting charge at 40%:

echo 40 > /sys/devices/platform/smapi/BAT0/start_charge_thresh

Set stopping charge at 70%:

echo 70 > /sys/devices/platform/smapi/BAT0/stop_charge_thresh

Display charging thresholds:

cat /sys/devices/platform/smapi/BAT0/*_charge_thresh

There's a whole host more features, commands and information here.