Thinkpad E320 and Fedora 17 · uwot.eu
another meaningless subtitle

Thinkpad E320 and Fedora 17

· by fabio · Read in about 7 min · (1414 Words)
acpi e320 edge fan fedora linux power saving thinkpad thinkpad_acpi

First of all, forget everything about the myth: “Loonix, it just werks”. Close to nothing “werks” out of the box, tho with a good amount of patience and a bit of tinkering there are good chances to make the whole thing working in a decent manner.
First of all, the box I’ve here is a Thinkpad Edge 320 – 12983RG and I’ve installed Fedora 17 x64 with XFCE as DE.
It comes with the integrated Intel HD3000, no discrete graphic card and UMTS module (I didn’t tested if it’s working or not).

[mafio@mafio-ltp ~]$ uname -a
Linux mafio-ltp 3.6.10-2.fc17.x86_64 #1 SMP Tue Dec 11 18:07:34 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

A good point where to start is installing rpmfusion repository which will come handy because the official Fedora repository doesn’t include any kind of non free software.
Since I’m using Fedora 17 I had to type:

su -c 'yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm'

More information at rpmfusion.org/Configuration.

Since we are working with rpmfusion it could be a good idea to install a bunch of non-free audio codecs (out of the box there is no MP3 codec for example).

sudo yum install gstreamer-plugins-bad gstreamer-plugins-ugly gstreamer-ffmpeg
sudo yum install gstreamer-{ffmpeg,plugins-{good,ugly,bad{,-free,-nonfree}}}

At least with this specific combination of distro and desktop environment, there are more than a couple of things that aren’t working correctly just out of the box:

  1. Trackpoint special functions are broken (vertical scrolling, horizontal scrolling and so on);
  2. Touchpad edge scrolling isn’t working and touchpad area is messed up (it includes the two buttons);
  3. Monitor brightness always at 100% after every reboot;
  4. Bluetooth always starting after every reboot;
  5. Sata link power management disabled;
  6. WIFI power management disabled;
  7. USB devices power saving not working;
  8. Graphic card C-states not working correctly (which is the most annoying issue because it literally kills the battery autonomy and makes the whole PC a lot warmer and louder);
  9. Realtek Card Reader not working;
  10. – extra – fan control.

1. Trackpoint

Here the solutions is quite simple, create a “.scripts” folder in /home/-USER-/, then, inside this folder create a script called “trackpad.sh”, we will use it to store the setting we want to be applied at startup.
Open another terminal window and use the following commands to find out the names of the installed input peripherals and the corresponding configuration options:

xinput     # lists the input peripherals
xinput list-props "TPPS/2 IBM TrackPoint"     # lists the configuration options

What follows is my trackpoint configuration script:

#!/bin/bash

# vertical scrolling
xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation" 8 1
xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Button" 8 2
xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Timeout" 8 200

# horizontal scrolling
xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Axes" 8 6 7 4 5

For more info refer to thinkwiki.org – trackpoint configuration.

2. Touchpad

Touchpad configuration is really similar, also in this case we refer to xinput to tweak the configuration to better suit our needs.
Here is my script:

#!/bin/bash

# edge vertical scrolling
xinput set-prop "SynPS/2 Synaptics TouchPad" "Synaptics Edge Scrolling" 1 0 0

# adjust area
xinput set-prop "SynPS/2 Synaptics TouchPad" "Synaptics Area" 0 0 0 4200

# set tap action
xinput set-prop "SynPS/2 Synaptics TouchPad" "Synaptics Tap Action" 0 0 0 0 1 2 3

For more info refer to thinkwiki.org – touchpad configuration.

3. Brightness

To set brightness at 40% at startup we just have to write what follows in another .sh file:

#!/bin/bash

xbacklight -set 40%

For more information open DuckDuckGo.com and search for “xbacklight”.

4. Bluetooth

Bluetooth always automatically starts at system start up and there seems to be no way to stop it doing so, one solution could be disable it in the BIOS, another solution to the problem would be use “rfkill” command to power it of at startup.
Here is the script:

#!/bin/bash
rfkill block bluetooth
# OR IF IT DOESN'T WORK
echo disable > /proc/acpi/ibm/bluetooth

At least on my system “rfkill” wasn’t installed by default but it should be available in the repository, so just install it with “yum install rfkill”.
These first 4 scripts (note that you should put everything in a single file) need to be executed at system start up, the easiest way to do it in XFCE is go to the “Session and startup” menu and add them to the startup applications list.

5, 6 & 7

These 3 points are well accredited for being a PITA, luckily Jewtel decided to support the development of an opensource free tool called “powertop”.
It is an enhanced version of the command “top” and it comes very handy because it lets us monitor power usage, CPU and GPU power states and frequency and it also highlight a number of tweaks that can help to reduce the power consumption.
I’m not sure if it is or not in the repository, before going through the hassle of a manual installation just type “yum install powertop” and hope for the best.
If it isn’t in the repository go to the official site, download the archive, extract it, compile and install it (likely additional libraries installation will be required).
When done with the installation type:

cd /home/-USER-/Desktop
sudo powertop --html=report.html

The precedent commands will create a file called “report.html” and place it on the Desktop, it will contains a number of suggested tweaks we can apply to reduce the power consumption.
To automatically apply the tweaks at system start up we have to put them in the “/etc/rc.local” file, if it doesn’t exists create it (here is a guide).
In my case the suggested tweaks are what follows:

#!/bin/sh

# wifi power save on
iw dev wlan0 set power_save on

# audio power save on
echo '10' > '/sys/module/snd_hda_intel/parameters/power_save';

# VM writeback timeout at 1500
echo '1500' > '/proc/sys/vm/dirty_writeback_centisecs';

# NMI watchdog turned off
echo '0' > '/proc/sys/kernel/nmi_watchdog';

# autosuspend F5521gw
echo 'auto' > '/sys/bus/usb/devices/2-1.6/power/control';

# unknown Runtime PM for PCI Device (null)
echo 'auto' > '/sys/bus/pci/devices/0000:02:00.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:02.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:16.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1b.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.1/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1a.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.2/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1d.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.5/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.2/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:08:00.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:03:00.1/power/control';

# SATA power saving
echo 'min_power' > '/sys/class/scsi_host/host0/link_power_management_policy';
echo 'min_power' > '/sys/class/scsi_host/host1/link_power_management_policy';
echo 'min_power' > '/sys/class/scsi_host/host2/link_power_management_policy';
echo 'min_power' > '/sys/class/scsi_host/host3/link_power_management_policy';
echo 'min_power' > '/sys/class/scsi_host/host4/link_power_management_policy';
echo 'min_power' > '/sys/class/scsi_host/host5/link_power_management_policy';

To check rc-local current status and set it to start at system startup use the following commands:

systemctl status rc-local.service     # check rc-local.service status
systemctl enable rc-local.service     # enable rc-local.service at startup

8. Graphic card

Here is the biggest issue, the graphic card not being able to slow down to lower the power consumption.
The solution is modify grub configuration file, first of all we need to know what to add, so:

modinfo i915

This command gives a list of parameters we can tweak, in my case this is what I added to grub config file:

quiet splash rhgb i915.powersave=1 i915.modeset=1 i915.semaphores=1 i915.i915_enable_rc6=7 i915.i915_enable_fbc=1 i915.lvds_downclock=1 i915_enable_ppgtt=1

Then, we need to rebuild grub configuration, in my case this is the command:

grub2-mkconfig -o /boot/grub2/grub.cfg

For more info refer to fedoraproject.org – grub2 configuration.

9. Realtek Card Reader not working

Card Reader is also not working out of the box, but at least when typing “lspci” it appears to be recognised by the system.
Check the card reader ID number (in my case it’s 5209) and download the appropriate archive from the Realtek site.
Extract what’s inside and follow the instructions written in the “README” file.

10. – extra – fan control

Since kernel version 2.6.something thinkpad_acpi module is already installed, it’s very important because it controls FN+Fx shortcuts and gives the user the ability to control low level settings like fan speed and so on.
To manually control fan speed create a file /etc/modprobe.d/thinkfan.conf, open it and write:

options thinkpad_acpi fan_control=1

Then type what follows to reload the thinkpad_acpi module:

sudo modprobe -r thinkpad_acpi && sudo modprobe thinkpad_acpi

To view fan speed, temperatures and so on type “sensors” in the terminal.
Another useful command is “cat /proc/acpi/ibm/fan”, when executed it will prompt all the configuration values for fan speed; then, to adjust fan speed type:

echo level 0 | sudo tee /proc/acpi/ibm/fan     # fan off - DANGEROUS
echo level <0-to7> | sudo tee /proc/acpi/ibm/fan     # higher for more speed
echo level auto | sudo tee /proc/acpi/ibm/fan     # auto for automatic control - default value
sudo modprobe -r thinkpad_acpi && sudo modprobe thinkpad_acpi

After had made these tweaks battery life increased of more than 2 hours.

Cheers
Fabio