Sunday, January 26, 2014

Install Thinkpad tools on Ubuntu 12.04

I own a T400 for 51/2 years now, and it has been treating me very well. I haven't still replaced my original battery, it still holds up 90% of its original capacity. Great Job Lenovo ! One possible reason is that I am using Battery Thresholding since the first few weeks of buying this machine, and made sure that this Thresholding works on all the OS I use. I use Ubuntu around 95% of my time using my PC (lets not talk about the other 5% time I spend editing the Word / PPTs on the crappy OS).  Thinkpad provides Battery driver software for Windows, but doesn't provide any drivers for Linux. Luckily drivers exist, and I found it on this link

The installation steps are very easy, I am reproducing here from the above link.

1. sudo apt-get install tp-smapi-dkms
2. sudo modprobe tp-smapi
3. Verify that the module is installed, using lsmod | grep smapi
4. Enable the superuser (su) mode on the terminal and do
echo 30 > /sys/devices/platform/smapi/BAT0/start_charge_thresh
echo 80 > /sys/devices/platform/smapi/BAT0/stop_charge_thresh

5. Make sure that the module loads on startup. Add the following line in /etc/modules

tp_smapi

6. To set the threshold settings at startup, Add the following lines in the tail of /etc/sysfs.conf  file

devices/platform/smapi/BAT0/start_charge_thresh = 50
devices/platform/smapi/BAT0/stop_charge_thresh = 80
EOF

Thats it. I focused only on battery thresholding, but there are many other tools that this module provides. Just check the files in /sys/devices/platform/smapi/BAT0/*