ThinkPad R50e

This is a little guide how to tweak an already installed Linux distribution to support all the features the ThinkPad has.

This site remains here for legacy reasons and will not be updated! All the other articles are probably still available but not linked any more. Start page.

Table of Contents

  1. Specifications
  2. X Server
  3. CPU Frequency Scaling
  4. CD Burner
  5. Suspend to Disk (S4)
  6. ACPI
  7. Sound
  8. TPB
  9. Special Keys
  10. Wireless LAN
  11. Controlling the Fan
  12. Feedback

Specifications

Processor:Intel Celeron M 1500MHz
RAM:512 MB
LCD:15" XGA
Graphics:Intel 82852/855GM
Ports:2x USB, 1x PCMCIA-Slot, Ethernet, Modem, CRT, Parport, Power
Harddrive:30 GB 80 GB, 5400rpm
Drive:DVD-R/CD-RW
WiFi:Intel Pro Wireless 2200 (802.11b/g)

Here's the output of the lspci command:

0000:00:00.0 Host bridge: Intel Corp. 82852/855GM Host Bridge (rev 02)
0000:00:00.1 System peripheral: Intel Corp. 855GM/GME GMCH Memory I/O Control Registers (rev 02)
0000:00:00.3 System peripheral: Intel Corp. 855GM/GME GMCH Configuration Process Registers (rev 02)
0000:00:02.0 VGA compatible controller: Intel Corp. 82852/855GM Integrated Graphics Device (rev 02)
0000:00:02.1 Display controller: Intel Corp. 82852/855GM Integrated Graphics Device (rev 02)
0000:00:1d.0 USB Controller: Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 01)
0000:00:1d.1 USB Controller: Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 01)
0000:00:1d.2 USB Controller: Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 01)
0000:00:1d.7 USB Controller: Intel Corp. 82801DB/DBM (ICH4/ICH4-M) USB 2.0 EHCI Controller (rev 01)
0000:00:1e.0 PCI bridge: Intel Corp. 82801 PCI Bridge (rev 81)
0000:00:1f.0 ISA bridge: Intel Corp. 82801DBM LPC Interface Controller (rev 01)
0000:00:1f.1 IDE interface: Intel Corp. 82801DBM (ICH4) Ultra ATA Storage Controller (rev 01)
0000:00:1f.3 SMBus: Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 01)
0000:00:1f.5 Multimedia audio controller: Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 01)
0000:00:1f.6 Modem: Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Modem Controller (rev 01)
0000:02:00.0 CardBus bridge: Texas Instruments PCI1510 PC card Cardbus Controller
0000:02:02.0 Network controller: Intel Corp. PRO/Wireless 2200BG (rev 05)
0000:02:08.0 Ethernet controller: Intel Corp. 82801BD PRO/100 VE (MOB) Ethernet Controller (rev 81)

X Server

In order to get the X server running you'll have to use the i810 module in /etc/X11/{XF86Config-4,xorg.conf}. There is though, if you do so, a bug in the driver: When you want to redirect screen output to an attached projector (Fn+F7) and back to the LCD there appears a ca. 100 pixels high bar of garbled pixels at the top of the display. It is neither supported to have the screen output on both the LCD and the beamer.

There are two possibilities to avoid the first problem:

Back when I got my R50e I was rather surprised to see that it was not possible any more to view videos with mplayer which was configured to use the xv (X Video) output driver but just when using the svga driver which opened a new virtual console. When I discovered that, the problem was easy to solve. You have to modify your X server config as follows:

Section "Device"
    Identifier  "Intel Corp. 82852/855GM Integrated Graphics Device"
    Driver      "i810"
    Option      "XVideo" "true"
EndSection

As /usr/share/doc/xserver-xfree86/README.i810 confirms the i810 driver has no 3D accelleration. But to enable hardware accelleration nevertheless you have to load the kernel module i915.

CPU Frequency Scaling

The built in Intel Celeron M 1500MHz can be throttled to seven different speed levels:

In order to do that you have to load the following kernel modules: p4_clockmod, cpufreq_userspace and speedstep_lib. Best is to add these modules to /etc/modules.

After that you can either set the CPU frequency manually, by echo'ing the MHz values in one of the files placed under /sys/devices/system/cpu/cpu0/cpufreq. It is however much handier to use a governor or a daemon for this. I used to use cpufreqd to do that. Now I use the kernel governor ondemand to do that job.

I have written a little script I placed under /etc/init.d/cpufreqondemand. When started the script enables the governor, loads the module if not already loaded and sets a minimum clock speed of 562MHz.

#!/bin/sh

case "$1" in
    start)
        modprobe cpufreq_ondemand
        echo 562000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
        echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    ;;

    stop)
        echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    ;;

    *)
        echo "Usage: /etc/init.d/cpufreqondemand start"
        exit 1
    ;;
esac

CD Burner

CD-RW drive works great. With 2.6 kernels you have to load the ide-cd kernel module of course.

Suspend to Disk (S4)

Suspend to Disk worked out of the box for me. I downloaded the Software Suspend version 2 kernel patches (Note: On 2.6.14 kernels, you have to deselect SMP support!) and the hibernate script. You can configure the script through the file /etc/hibernate/hibernate.conf. The following lines are the most imprtant part you have to set up:

UseSwsusp2 yes
Reboot no
SaveClock yes
SwitchToTextMode yes

To go into suspend mode I use the following script (to stop XMMS and kill ESD):

#!/usr/bin/zsh

# stop XMMS
if [[ -e /tmp/xmms_julius.0 ]] then
  su julius -c 'xmms --pause'
fi

# kill ESD
su julius -c 'killall esd'

# Power-Down
sudo /usr/sbin/hibernate

# restart ESD
su julius -c 'esd -nobeeps &'

I bound the execution of that script to the blue "Access IBM" button. Suspend approximately takes 15 seconds, as well as the resume. Be careful in silent environments, if not configured differently in the BIOS the ThinkPad beeps on a resume! ;-)

Unlike with some other ThinkPad models after resume WiFi and USB works correctly, you don't have to reload any modules after all.

To make the suspend and resume a lot faster I recommend enabling LZF compression. With this compression you get smaller images which can be written do disk much faster (at my box a performance increase of more than a 100%!).

To enable LZF compression you have to reconfigure your kernel. make menuconfig, navigate to the CryptoAPI list of modules, and select "LZF compression" to be compiled to the kernel (not as a module!). The specific entry in the .config looks like this: CONFIG_CRYPTO_LZF=y.

You then have to add the following modules to your hibernate script config file:

ProcSetting compressor lzf
ProcSetting disable_encryption 1
ProcSetting expected_compression 50

Suspend2 UI

The name "suspend2ui" refers to a program which replaces the normal suspend messages printed to the console and the flickering by a nice scrollbar in a little ASCII box.

There are two available versions of this program, one for FBsplash users and a standard text version.

To install the suspend2ui_text program, download the suspend2-userui-0.6.1.tar.gz tarball and unpack it. Now run "make suspend2ui_text" (unless you want the fbsplash version—don't know nothing about that) and copy the resulting binary to /usr/local/bin/. chmod 755 the file and make root the owner. Now switch to a tty and run the program with the -t parameter. If that test works well, there is just one thing left to do: Tell Suspend2 to use this program.

Add the following lines to your /etc/hibernate/hibernate.conf:

ProcSetting userui_program /usr/local/sbin/suspend2ui_text
ProcSetting userui_progress_granularity 10
ProcSetting disable_textmode_support 1

ACPI

ACPI works quite well with the R50e. Load the modules button, thermal, processor, fan, battery und ac to be able to retrieve some info about your hardware, eg. how much battey power you have left or how hot the CPU runs. With acpid you can also bind certain ACPI events (such as the closing of the lid) to shell scripts, eg. to go to suspend.

If you load the ibm-acpi module (integrated in kernels more recent than 2.6.11) you retrieve and set some ThinkPad-specific Settings. You can, for example, turn on the ThinkLight with the command echo on > /proc/acpi/ibm/light.

You can also retrieve the current CPU throttling state using ACPI. For that, you have to load the module acpi-cpufreq.

Sound

Sound works out of the box, no problems.

I haven't tested wheter a microphone works correctly or not yet.

TPB

tpb is a really nice program. You can easily install it via sudo aptitude install tpb. The program creates a file /etc/X11/Xsession.d/90tpb so that it is always started when you start an X server.

You can change the configuration file /etc/tpbrc to bind special ThinkPad buttons to programs. For example:

THINKPAD    /usr/bin/sudo /usr/bin/hibernate.zsh

With that entry I tell tpb to execute the Suspend to Disk script when I press the blue "Access IBM" button.

Special Keys

The volume buttons, "Access IBM", the brightness controller and the ThinkLight key work out of the box.

The keys Fn+F3 (Blank Screen), Fn+F4 (ACPI Sleep) and Fn+F12 (Hibernate) don't work out of the box, they first have to be enabled. To do that, load the module ibm-acpi. echo enable > /proc/acpi/ibm/hotkey to activate these keys.

Start the program acpi_listen to gather information about which ACPI events occur when you press a certain key or close the lid. You can then edit the /etc/acpi/events to define certain actions on certain events. Example:

# This file /etc/acpi/events/hibernate
event=ibm/hotkey HKEY 00000080 0000100c
action=/usr/bin/hibernate.zsh

Wireless LAN

There is no Intel Pro Wireless 2200 support in the kernel by default. Therefore you have to install the ieee802.11 subsystem and the firmware.

Install the firmware by un-packing the contents of the archive to the hotplug directory.

shell% cd /usr/lib/hotplug/firmware
shell% tar xfvz ~/downloads/tarballs/ipw2200-fw-2.3.tgz
shell% rm LICENSE

Then restart the hotplug daemon: sudo /etc/init.d/hotplug restart.

You have to download, un-pack, compile and install the ieee80211 source package.

You then have to download the sources for the ipw2200 module. Compile them with make and install them with make install. You can then modprobe ipw2200 and WiFi should work.

In the most recent versions of the ipw2200 drivers the RFMon mode (monitor mode) is finally supported. With that it is now possible to use Kismet. The version 2005.06.R1 can be used with ipw2200 modules >=1.0.4. You have to replace the old source line in your kismet.conf with this one: source=ipw2200,eth0,name.

Controlling the Fan

With the most recent IBM-ACPI drivers included in the kernel (0.12a in 2.6.14.3) and this little patch it is no problem to control the fan. Make sure you compile IBM-ACPI support as a module, not builtin!

Now add the following line to your /etc/modules file to load the module every bootup: ibm_acpi experimental=1. Alternatively, you can also load the module via modprobe ibm_acpi experimental=1 as root.

Now you have a directory /proc/acpi/ibm. In there are several files. These files are sort of a interface with the kernel. Using cat you can find out what the specific file does, which values it accepts and what the current status is. For example:

root@deepthought:/proc/acpi/ibm# cat fan
status:         enabled
speed:          3247
level:          auto
commands:       enable, disable, level 
                ( is 0-7, auto or disengaged)

It is not possible to set the speed directly, but the driver offers 8 levels of speed and the ability to enable or disable the fan completely. I have written a little script to control the fan without cat and echo.

#!/bin/sh

IBM_ACPI=/proc/acpi/ibm

help() {
    echo Little Fan Control Script
    echo
    echo Usage:
    echo '% fan [show|set <n>|disable|enable]'
    echo
}

show() {
    cat $IBM_ACPI/fan | grep level: | \
    sed -e 's/\s//;s/^/current /';
}

setspeed() { sudo su -c "echo level $1 > $IBM_ACPI/fan"; }
enable()   { sudo su -c "echo enable   > $IBM_ACPI/fan"; }
disable()  { sudo su -c "echo disable  > $IBM_ACPI/fan"; }

if [[ -z $1 ]]
    then
    help;
    show;
fi

case $1 in
    show)          show ;;
    set|setspeed|level|setlevel)
                   setspeed $2 ;;
    disable)       disable ;;
    enable)        enable ;;
    auto)          setspeed auto ;;
esac

# vim:set ft=sh et sw=4:

Just save this script and make it executable. Then you can do thigs such as:

BE CAREFUL! DO NOT BURN YOUR R50e! DO NOT FORGET TO SWITCH THE FAN ON AGAIN WHEN HEAT GOES UP!

Feedback

Questions? Suggestions? Write me an email!
TuxMobil - Linux on Laptops, Notebooks, PDAs and Mobile Phones

© 2005-2006 Julius Plenz
$Id: thinkpad_R50e.php 76 2006-03-06 15:32:41Z feh $