Centos 6 & Thinkpad T530: Prolong battery life with tpacpi-bat

Number of battery experts claims that Li-Ion battery life can be prolonged if battery is not fully charged during use. Windows 7 has this option too in it’s Power Manager. In order to have that option, OS has to have correct drivers for battery ACPI calls. In order for CentOS to be able to do that same thing, there is a acpi_call kernel module.

You can find module here: git://github.com/mkottman/acpi_call.git.
By using this module and few scripts you can set your battery to stop charging at i.e. 70% and start charging again at 40%. You can also force battery discharging, inhibit charging…

There are few easy steps to make it work:
1. go to shell and install tpacpi-bat perl script

[root@thinkpad ~]# cd /usr/src/
[root@thinkpad src]# wget https://github.com/teleshoes/tpacpi-bat/archive/v1.0.tar.gz
[root@thinkpad src]# mv v1.0 v1.0.tgz
[root@thinkpad src]# tar xzvf v1.0.tgz
[root@thinkpad src]# mv ./tpacpi-bat-1.0/tpacpi-bat /usr/bin/

2. Download and run install.pl script (wrapper that installs acpi_call kernel module)

[root@thinkpad src]# cd tpacpi-bat-1.0
[root@thinkpad tpacpi-bat-1.0]# wget https://github.com/teleshoes/tpacpi-bat/blob/master/install.pl
[root@thinkpad tpacpi-bat-1.0]# perl install.pl

3. Setup config file for your battery

[root@thinkpad tpacpi-bat-1.0]# cd /tmp
[root@thinkpad tmp]# wget http://smitran.com/downloads/battery-conf.tgz
[root@thinkpad tmp]# tar xzvf battery-conf.tgz
[root@thinkpad tmp]# mv battery.conf /etc/
[root@thinkpad tmp]# rm -f battery-conf.tgz

There are few options inside but they are all commented

4. Download init script

[root@thinkpad etc]# cd /tmp
[root@thinkpad tmp]# wget http://smitran.com/downloads/battery-init.tgz
[root@thinkpad tmp]# tar xzvf battery-init.tgz
[root@thinkpad tmp]# rm -f battery-init.tgz

5. Set battery init script to start automatically

[root@thinkpad init.d]# chkconfig --add battery

That’s it.

Note:

If battery values are above start treshold and below stop treshold, battery will not be charged or discharged. If you want to force battery discharge use this command:

/usr/bin/tpacpi-bat forceDischarge 1 1

If you want to inhibit charging you can use this command:

/usr/bin/tpacpi-bat inhibitCharge 1 1

Have a long battery life 🙂

Leave a Reply