Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.
  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?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

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.

share|improve this answer
    
Thanks! My system does not have directory smapi under /sys/devices/platform/smapi. It does not have the files supposed to be under smapi, such as remaining_percent, remaining_charging_time, start_charge_thresh. –  Tim Aug 27 '11 at 2:40
    
And I take it you don't have /proc/acpi/battery as well? –  Kris Harper Aug 27 '11 at 3:45
    
I have /proc/acpi/battery/BAT0/ . But I cannot find in the three files alarm, info and state the information about how much percentage has been charged. –  Tim Aug 27 '11 at 3:49
    
Is there anything in the /BAT0 directory? –  Kris Harper Aug 27 '11 at 4:26
    
There are three files alarm, info and state. –  Tim Aug 27 '11 at 11:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.