jamie.lentin.co.uk

Lenovo Thinkpad X201s & Debian Linux

They essentially built the smallest thinkpad you could whilst still using the full-sized Thinkpad keyboard. As a result it's very nice to use, my main complaint is the lack of HDMI port.

The following page details some of the weirder bits you'd encounter whilst installing Debian (or another linux) on the X201s. If you need a more general guide on installing Debian, then I suggest going elsewhere first and come back for specifics.

Hardware

Replacing HDD

The HDD is a regular 2.5" SATA drive, and easily replacable (pull out, replace 2 screws).

BIOS Setup

To enter the BIOS, hold down F1.

Intel AMT

This is a system to remotely administer your machine, whilst you may not have a need for this, it has to be enabled for temperature sensing to work. In theory you should also be able to use this to give the system a virtual CD drive too.

Installation

Partitions on the HDD

There are 3 partitions by default on the HDD:-

Hidden SYSTEM_DRV partition:
Alternative windows install with diagnostic programs, triggered by holding down ThinkVantage. Whilst the BIOS prompts for this, this is only because it is written on the splashscreen. The switch is done by a custom MBR, without it there will be a boot menu. Thinkwiki has more.
Windows:
The main windows partition, nothing interesting.
Hidden install media partition:
A partition containing WIM (tar-like) images of the first 2 partitions. A preinstalled utility allows you to burn these onto any install media. Virtual CD can be used to "write" these onto bootable DVD ISOs.

All are safe to remove if you don't want them.

Booting

Since generally you will not have a CD drive, follow these instructions to make a bootable USB stick (or SD card, since the SD slot is USB connected and can be booted from).

Kernel

The stock Debian kernel will just work generally here.

Graphics configuration

Xorg - intel

Generally works with modesetting. An xorg.conf isn't necessarily required, however I have one to set monitor positions, etc at startup.

Powersaving/ACPI configuration

There are a bundle of changes that PowerTOP suggests:

echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs

CPU Frequency Scaling

ACPI-compatible frequency scaling will alter the frequency from 1.1Ghz to 2.1Ghz. Install cpufrequtils and the ondemand govenor will be enabled on startup.

Sleep States

Suspend to RAM and suspend to disk all seem to work fine out of the box.

Input devices

Keyboard

The keyboard is ace, being a thinkpad. There are 2 keyboard devices, a regular PS/2 keyboard and the "ThinkPad Extra Buttons" provided by thinkpad_acpi. Both should just work with a newish kernel.

Making Fn-F5 disable bluetooth

The new udev mappings by default make Fn-F5 KEY_WLAN. As of 2.6.31 this causes rfkill to disable the wireless for you. This is fairly useless since there is already an rfkill switch. Remapping it to KEY_BLUETOOTH causes it to toggle bluetooth, which is much more useful. Create a /etc/udev/rules.d/x201s_bluetooth.rules containing:

ENV{DMI_VENDOR}=="LENOVO*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Buttons", RUN+="keymap $name /etc/udev/keymaps/module-lenovo"

And a new keymap /etc/udev/keymaps/module-lenovo containing:

0x4 bluetooth # Fn+F5

An easier way to do this would be nice.

Programming the rest of the Thinkpad keys

Every other key should just be available as a key to Xorg, I use kbindkeys to then map them to s2ram, etc. For example, .xbindkeysrc contains:

###### Hardware volume keys
"/usr/bin/amixer -q set Master toggle"
 XF86AudioMute
"/usr/bin/amixer -q set Master 5%-"
 XF86AudioLowerVolume
"/usr/bin/amixer -q set Master 5%+"
 XF86AudioRaiseVolume

###### Hardware media keys
"/usr/bin/mocp --stop"
 XF86AudioStop
"/usr/bin/mocp --toggle-pause"
 XF86AudioPlay
"/usr/bin/mocp --previous"
 XF86AudioPrev
"/usr/bin/mocp --next"
 XF86AudioNext

Trackpoint

The trackpoint is a regular PS/2 mouse, I haven't got a touchpad so have no idea how that might be wired.

Bluetooth

The bluetooth is internally a USB dongle. thinkpad_acpi lets you plug it in and remove it (turning the light on/off in the process) and registers with rfkill to control it. To do this yourself use the rfkill tool:

# rfkill list
8: tpacpi_bluetooth_sw: Bluetooth
        Soft blocked: no
        Hard blocked: no
# rfkill block 8

Whilst you can also control it with /proc/acpi/ibm/bluetooth, this causes rfkill to go out of sync. You can also turn it off on startup with the following in /etc/rc.local:

rfkill list | awk '/tpacpi_bluetooth_sw/ { gsub(/:$/,"",$1); print $1 }' | xargs rfkill block

Fingerprint Reader

The fingerprint reader is supported by the upeke2 driver in fprint. Not the upeksonly driver despite having the same USB ID. Installing fprint_demo will let you play with it. It seems to only support recognising a single predefined image, i.e. it can't tell you which of your fingers you scanned.

Accelerometer

The accelerometer is supported by the tp_smapi module (not the mainlined hdaps module). This will also give you access to further battery settings too. To play with it:

# m-a -t a-i tp-smapi
# modprobe tp_smapi
# modprobe hdaps # NB: This isn't the same as mainline hdaps, but a modified version to work with tp_smapi)
# evtest /dev/input/eventX # Where X is the new devices that appeared

Other bits

HDA Sound and system beep

Mostly works, however the PC speaker beep is handled by the BIOS out of the box, which mutes the normal output whilst beeping in a jarring way. This can be disabled (and save some power) by making /etc/modprobe.d/snd_hda_intel.conf:

# The pc speaker mutes other sound output, which is really annoying
blacklist pcspkr
options snd_hda_intel power_save=1 bdl_pos_adj=0