Showing posts with label ThinkPad. Show all posts
Showing posts with label ThinkPad. Show all posts

Sunday, March 20, 2011

Energy management in Linux: kernel version

UPDATE here.

Continuing from this post I want to show how the choice of a kernel version can have an important impact on the energy consumed by a computer (in my case, a Lenovo x200s).

I've been working on the battery quite often lately and I have noticed that the power consumption can vary quite a bit from kernel to kernel. This was of course a very subjective appreciation as the load could vary, the number of firefox tabs, the task I was doing or even how fast did I type.

The other day, however, after updating to kernel 2.6.38 i realized that idling, the computer barely went under 7W. I remember perfectly that "before", it could idle at aroung 6.0W, even with the wifi on, and now it was off. I decided to try an older version, and decided for 2.6.34. This is because from 2.6.35 to 2.6.37 there has been a very nasty bug that prevented my Intel Wifi 5300 agn card from injecting packets do to the famous -1 bug. Yes, I do audit my own wifi very often, why you ask? ;)

So I hacked the PKGBUILD file a bit and installed a custom 2.6.34.8 kernel along with my custom 2.6.38 one. I booted the laptop, turned the wifi off, closed Dropbox (powertop doesn't like it) and let it sit idle for a while. After a few minutes I closed the lid, previously deactivating sleep-on-close, to see how turning the screen completely off affects thigs. You can see the results on the following graph:

Energy consumption on a Lenovo x200s, KDE 4.6.1, WiFi & Bluetooth off, SSD disk, Screen 6/15 -> off
.

The result was so different that I used the .config from the 2.6.34 kernel to recompile the .38 and see maybe I missed something. As you can see from the blue line, that is not the case, the .38 kernel just consumes consistently 1W (~20%) more than the .34 version...

Take this results as they are: two different kernel versions with a particular custom configuration on a particular hardware.

I am NOT saying that kernel 2.6.34 is more energy-efficient than 2.6.38 as a general rule.
I AM saying that some kernel versions are more efficient than others on some hardware - test your versions on your hardware and pick the one that works best for you.

Wednesday, April 1, 2009

Servicio técnico de Lenovo

Hoy es uno de esos días en los que no voy a despotricar contra nada, sin que sirva de precedente. De hecho todo lo contrario.

La historia emieza como las novelas policiacas: con una muerte. En este caso la del disco duro del Thinkpad. No se si justificada, por que aunque lo uso mucho no creo que le de tanta caña como para que el disco muera a los 2 meses... En cualquier caso, que le disco tuvo una muerta lenta y agónica. Primero al iniciar Vista (seamos buenos y demos por hecho que Vista esta vez no tiene la culpa) se empezaron a instalar unas actualizaciones, a velocidad superlenta. Luego se quedo pillado en 16% y al reiniciar daba error en todas las opciones. Al iniciar Linux daba error al montar la partición /home, de sector de superbloque dañado. Mal rollo. Intenté arreglarlo con el spinrite, pero tras dia y medio de forzar lecturas, el disco dijo basta y empezó a hacer unos clics muy poco saludables. En efecto, a la hora de arrancar la BIOS me da el pésame.

Pues a llamar a Lenovo. No tengo la transcripción exacta, pero la conversación fue mas o menos así:
- Buenos días, le atiende XXXX, ¿en que puedo ayudarle?
- Buenas. Verá, tengo un portatil Thinkpad y se le ha estropeado el disco duro, asi que quiero llevarlo a la garantía.
- Muy bien, deme sus datos de contacto.
- [Datos de contaco]
- Y necesito el "Type" y el "Serial Number" del portátil para verificar la garantía.
- [Datos del portátil]
- Me decía que falla el disco duro, ¿verdad? ¿Podría meterse en la BIOS y verificar el mensaje de error?
- El error es el 2100: initialization failed.
- Muy bien, parece que en efecto el disco duro ha fallado. ¿Le parece bien que le mandemos uno nuevo por mensajero a la dirección de contacto?
- Perfecto.
- En la caja le vendrán las instrucciones para enviar el estropeado de vuelta. ¿Alguna otra consulta?
- No, eso era todo. Muchas gracias.
- A usted, que tenga un buen día.

Tiempo total de conversación: menos de 3 minutos. Problema solucionado. Un 10 para IBM/Lenovo por el soporte técnico, así da gusto.

PD: aprovechando que este finde me he hecho cuantas en facebook y tuenti, he subido mi foto al perfil de blogger. Quién sabe, puede que incluso un día me presente y cuente algo sobre mí en el recuadro de "Acerca de mí". Quizás.

Friday, March 27, 2009

Energy management in Linux

Nota: este post es una continuación de este otro. Para más info, mirar ahí.
Note: this article is a follow-up of this one. Please take a look at it for extended info.
____________________________________________________

UPDATE: Check this post for related info.

I've been concerned about the energy consumption of my Thinkpad X200s for a while now. It's not that electricity is that expensive or I am sooo worried about global warming, it's more about squeezing the most out of the battery while trying not to damage it. My X200s has the 9cell battery which means 13 hours Lenovo-stated battery time. I'm going to use that twice in it's whole life. The point is in maximizing the long-time battery health. Lithium-ion batteries don't like to be deep-discharged too often, so my goal is to (almost) never let the charge drop below 20%. If someone only needs 2-3 hours of battery time and can charge it back to 100% after that, there is nothing to worry about. There is no way to burn 80% of the battery in that time with this laptop. Of course, if someone travels a lot and can't plug the laptop for a whole day, it makes sense to spend as few watts as possible.

Now, about battery life and energy consumption. Lenovo has made some serious effort to optimize the power drain in software and their Vista drivers are as of now unbeatable. In Vista, the minimum I've seen was 5.2W, in Linux 5.9W or 5.8W. Maybe 0.6W doesn't seem too much, but we are talking about more than 10% here! I've discussed this issue here with some folks, I recommend reading it.

First of all, use common sense. Don't expect 13 hours of number crunching, full-brightness video watching, usb-gadget powering or high-speed downloading. Turn down/off everything you don't use. If you are in a dark room, lower the screen brightness. If you are not listening to music, mute the volume. If you are, use headphones or set the volume a tad lower. Kill all the daemons you don't need. You got it, right?

Second point, my main source of info for all this stuff was this website. Follow all the steps you can. Make sure you have a tickless kernel. Turn on laptop-mode to spin down your hard drive when idle (ONLY if you have a SPINNING drive, you'll gain nothing if you have a SSD). Activate processor energy management and set the cpu frequency governor to ondemand or conservative. When you are familiar with all the goals, keep reading.

Now we are going to get our hands dirty. I'll explain this things for Arch Linux, the exact configuration files / paths may be located in a slightly different place in you distribution, use "locate" command or google to find them.

- General powersaving settings, aka laptop mode: Install and then activate laptop-mode editing the file "/etc/laptop-mode/laptop-mode.conf". After that, check all the files in "/etc/laptop-mode/conf.d/*" and activate all the things you can. Except maybe cpufreq, I rather let cpufreqd do that job, it's much simpler. Start laptop-mode with "/etc/rc.d/laptop-mode start" and add it to your daemon list in your rc.conf file. In case you skip something here, I'll probably mention it anyway, but laptop-mode comes in handy for automating it.

- Cpu frequency scaling. I recommend using cpufreqd, it is very very simple. Install it, do a "echo ondemand > /etc/conf.d/cpufreq" and start the daemon as shown above, also adding it to the daemon list.

- Turn off the video outputs. It sounds weird, but with the xorg 1.5 and the old intel 2.4 drivers, the video chipset doesn't detect the outputs right and turns on HDMI. The newer xorg 1.6 and intel driver 2.6 didn't have this problem when I tried them, but check it anyway. You can do it with "xrandr". If you see a star ( * ) on some line, that output is active. Turn it off with "xrandr --output HDMI-2 --off". You should check again on restart.

- Turn down the wifi power. This is a real power hog, it can drain more than 1.5W doing nothing. The control file is "/sys/class/net/wlan0/device/power_level". With "echo 5 > file" you maximize powersaving. Obviously, "cat file" gives you the wifi status. I've noticed some misbehavior lately, if you are not connected and with some network manager daemon running, it keeps going back to level 0 (maximum power usage). I usually fix it with:
# killall wicd-manager
# /etc/rc.d/wicd stop
# killall wpa_supplicant
# ifconfig wlan0 up
# echo 5 > /sys/class/net/wlan0/device/power_level
# ifconfig wlan0 down
# cat /sys/class/net/wlan0/device/power_level

If the last command shows a "INDEX:5", it'll probably stay that way, but checking it some time later would be good. As usual, let a script do that for you. If it is not 5 but 0, repeat the previous 3 steps. If you are conncected to some network, it usually stays at level 5 without any issue after a simple echo.

- Turn off bluetooth if you are not using it. As easy as "echo disable > /proc/acpi/ibm/bluetooth". Sometimes it doesn't want to wake up again, try a "lsusb" after re-enabling it. Again, acpid is a great way to handle it, here is a chunk of my handler:
*1005)
if [ "$(cat /var/local/bluetooth)" = "disabled" ]; then
echo "enable" > /proc/acpi/ibm/bluetooth
echo "enabled" > /var/local/bluetooth
lsusb > /dev/null
logger "ACPI bluetooth on"
else
echo "disable" > /proc/acpi/ibm/bluetooth
echo "disabled" > /var/local/bluetooth
logger "ACPI bluetooth off"
fi
;;



- Turn on SATA link powersaving. This one is pretty straightforward: "for i in /sys/class/scsi_host/host*/link_power_management_policy; do echo min_power > $i; done". Once every power cycle. If you connect the power plug and disconnect it, only one link file will go back to powersave, so you have to execute it every time you go on battery. Acpid, again, is a great way to do that.

- Turn on PCIe powersaving. The control file is "/sys/module/pcie_aspm/parameters/policy". You can "echo powersave" to it to turn it on and "echo performance" to turn it off. As always, cat will tell you the actual status.

- Activate the sound auto-suspend. Echo the timeout to "/sys/module/snd_hda_intel/parameters/power_save". If you are not using the sound at all, mute it with the hardware button, just in case.

- This one may be VERY DANGEROUS. You can turn off the fan if you are going to do lightweight work and you trust your programs to be infinite-loop-free, so firefox is out of the question here. You have to load the thinkpad_acpi module with "fan_control=1" parameter and then manage the control file "/proc/acpi/ibm/fan". Again, "echo" stuff to set the fan on/off, "cat" to get info. I HIGHLY recommend to use the watchdog function and some script to make sure the processor won't melt. You can read the temperatures at "/proc/acpi/ibm/thermal", "/sys/class/thermal/thermal_zone*/temp" and "/sys/bus/platform/devices/coretemp.*/temp1_input", among others. Google is your friend ;)

- If hal is polling you nonexistent (on a X200) CD drive, kill it.

- If you are not using it, close firefox. The diffrerence may be 1W. If you plan on use it later, a simple "killall -STOP firefox" will do the trick. When you are going to use it again, "killall -CONT firefox". Bind it to a hotkey if you want.

- Also, "ifconfig eth0 down" sure doesn't hurt if you are not using the good ol' ethernet interface.

- Unloading modules doesn't usually work, but you may try it (and post a comment with your findings!). Some people unloads uhci, snd_hda_intel, or iwlagn. I haven't seen any difference trying, but your mileage may vary. You can also take one core of the cpu offline, but it seems to cause to actually consume MORE power than sitting idle. I haven't measured it myself, so if you do, please let me know! The control file is "/sys/devices/system/cpu/cpu1/online", 0 takes it offline, 1 brings it back to work.

- Last but not least: install and run powertop. It's a wise program. Follow it's suggestions. I use it to activate USB autosuspend and see which programs and wreaking havoc. Firefox, amarok2 and any java-based ones are on top positions, but some other programs may be broken and causing the processor to work more than it should. Knotify4 in KDE 4.1 had a 100Hz timer, for instance.

If I remember any other tweak, I'll post it here, stay tuned.

With all these tricks, brightness at minimum, everything off and doing _nothing_, the X200s drains 5.8W. With wifi on, brightness 5/15, browsing and programming (without heavy compiling), it goes at around 6.5W. On full brightness, no wifi, just above 7W. Full brighness + wifi it's under 7.5W. You have to do some pretty heavy stuff to take it above 10W, watching HD movies at full volume and brightness will do it, but anyway, at 10W the battery still lasts more than 8 hours. If you want me to try any specific combination, let me know.

Finally, for more info, try these:
http://www.nabble.com/X200-Battery-Life-td20188937.html
http://www.nabble.com/Linux-Thinkpad-f13633.html
http://www.mail-archive.com/ibm-acpi-devel@lists.sourceforge.net/
Or ask a question in the comments.

Saturday, December 6, 2008

Installing Arch Linux on a Lenovo ThinkPad X200s

Nota: para una explicación sobre el cambio de idoma, ver el final del post.
___________________________________________________

LAST UPDATE: March 20th, 2011
- Some things have changed: now almost everything works fine out of the box
- Graphics no longer present problems, Urban Terror is playable with no complaints and composition in KDE 4.6 works smoothly.
- Backlight adjustment works in console and graphic mode out of the box.
- Using x86_64, no problems with that.
- X input has switched back to xorg.conf. You have to add your configuration to xorg.conf.d/10-evdev.conf instead of the fdi file. (described in the Trackpoint section below)
- Energy management: check this post for a comparison between two different kernel versions.
- Fingerprint reader still doesn't have drivers.
- Suspension works out of the box. Don't use hibernation - can't comment on that.
- Microphone works (was "not tested" before)


April 7th 2009
- I've tested VGA out, results are in the video section.
- New update @ noise: check this out. I recommend the "rmmod uhci_hcd", as it also _might_ improve battery life. I've found it when looking for this other problem. As of now, running ktorrent keeps the drive busy ;)
- I've added a GRUB section.
- There has been a BIOS update which fixed the conflict that was going on. The tp_smapi module now loads fine.

April 3rd 2009
I just completed a fresh install, and I have good news! Some of the tricky things work without any intervention now:
- Backlight adjusting works out of the box with KDE4.2, I believe it is PowerDevil's work here. Can't say anything about other DEs, if it's behaving strangely you may still need the workaround described in the backlightt section.
- Trackpoint scrolling no longer needs user-compiled drivers, the standard evdev will do just fine.
- Suspend and hibernate also seem to work OK with the default settings.
I didn't experience the noise or video issues mikar described in the comments, so I can't help much with that. Check that you load the proper snd modules and you have the xf86-video-intel drivers installed and no xorg.conf file, it's the only think I can think of.

April 2nd 2009
- If you experience an annoying high-pitched noise, mikar suggests a workaround: enabling USB autosuspend makes it go away.
- There is a new BIOS available from Lenovo which adresses some unproper resource claiming. It may fix the thinkpad_ec problem, but I haven't tested it yet.
- My hard drive failed and I have to make the whole installation process again. If anything changes, I'll update the guide.

March 27th 2009
- Here you can find a energy saving guide for the laptop. Any feedback will be appreciated!
- The 3D performance with the new intel drivers is improved, but the 2D kinda sucks. Switching tabs or text files in kate is so laggy (1 second or more) that I went back to the 2.4 drivers. Also, the CPU usage of the X server is higher with the new ones. Clearly something is not ready yet, but looks promising. Maybe with 2.6.29 kernel and modesetting the whole thing is gonna start to work, but right now it's broken. I'll update the .config file as soon as I update my kernel to 2.6.29.

March 12th 2009
- With testing versions of some packages, now 3D effects seem to be working, check the Video section below for more details.
- Arch has been providing img install files with a new kernel for a while, you should absolutely use those for a new setup.

Feb 26th 2009
- Just let you know, KDE 4.2 (powerdevil actually) manages the screen brightness pretty well, the only problem it's that it is not aware of brightness changes via acpi handler. Maybe there is a way to make the handler notify powerdevil of the key press trough dbus and let powerdevil change the brightness...
- The graphic system doesn't work very well, I dont know if it's something with the intel xf86 driver or with the kernel. I tried svn versions of the packages involved and I saw no improvement whatsoever, so I'm clueless at this point. KDE4 works, but not as fast as KDE3 and Civilization4 on wine is not playable (2-3 fps).

Jan 19th 2009
- New kernel config for 2.6.28.
- Sound configuration update.
- tp_smapi 0.40 now works with a little tweak
- SD card is tested, works ok.

Previous updates: not listed (sorry)

________________________________________________________

I'm going to explain my experience installing i686 Arch Linux on a Lenovo ThinkPad X200s.

The process is a little tricky due to the specific hardware configuration of the laptop. Sorry in advance for any mistakes in the text, English is not my first language!

Hardware
:
Here are the guts of this little monster:
  • Intel Core 2 Duo SL9400
  • 2GiB RAM DDR3 (in 1 module)
  • 250Gb SATA 5400rpm HDD
  • Intel GM45 Chipset
  • Intel X4500HD graphic Adapter
  • 12'1 inch, WXGA+ (1440x900) LCD panel
  • Intel 5300AGN Wi-Fi Card
  • Intel 82567LM Gigabit Network Adapter
  • 5 in 1 card reader
  • Modem
  • TPM module
  • Lenovo keyboard + TrackPoint
  • ThinkLight
  • Broadcom bluetooth module
UPDATE: here are some useful snippets. They are hosted at pastebin.com so if they are offline let me know and I'll paste them somewhere else.
  • lspci
  • lsusb with bluetooth enabled
  • kernel .config
  • A little howto in Spanish about enabling console framebuffer with intelfb to get native resolution consoles. I think the code is pretty easy to follow and I'll answer any questions. In the end, you have to give the kernel the parameter vga=874 in grub and you'll get 1440x900 fb console.
  • xorg.conf
  • trackpoint.fdi for scrolling with input hotplugging
  • Acpi event handler.sh
  • Grub's menu.lst
If anything else interesting comes out, I'll update this section.

Preparing:
To make room for linux, Vista must get shrunk, obviously. First make sure to backup Vista with the recovery media tool from Lenovo, it may come in handy in the future. Then use any tool you like to shink and optionally move the Vista partition. My tool of choice is sysreccd, a small live-cd based on gentoo, but even PartitionMagic on Vista should do the job. I shrunk it to 50GB and moved it to the end of the disk, so I had the faster parts at the beginning of the disk free for linux. Since the laptop has no optical drive and I didn't feel like buying a usb one just for this purpuose, I went with the usb thumbdrive option. I used unetbootin (great tool) to create a live-usb from the iso image and gparted to do the actual work.
UPDATE Dec-11: when you move and shrink Vista, it may stop booting. Use a Vista boot DVD (NOT the lenovo tools, they will mess your disk. You have been warned!) and choose the "Rescue system" and then "fix boot" option. You may have to do this a couple of times since it reboots after fixing every single problem and there may be more than one. Yes, this time you have no choice but to get a USB DVD drive, try borrowing one from a friend.

Usual way:

Again, no optical drive, we have to make a bootable thumbdrive with Arch install. There are several ways to do this, though. You can either use unetbootin to create it from an iso image, create the bootable usb manually with syslinux or grab a ready to use usb image from the Arch website.
First, I tired to download the ftp image for usb thumbdrives.
# dd if=image_file of=/dev/sd[whatever letter you usb drive is]
ThinkVantage key and F12 to select boot media. Arch boots and then our first nasty surprise: no network interfaces. If I understand it right, the build is from June this year, so before the e1000e bug. Maybe it was just too early and there was no support for this card in the kernel. Anyway, no net = no ftp install = crap.
UPDATE (March 12th 2009): The newer ftp img (torrent, mirrors)from feb09 comes with a nice 2.6.28 kernel with support for both the ethetnet and the intel 5300 wifi card. You should definitely go this way to install a new system.

Alternative way (NOT NEEDED ANYMORE):

Lucky for me, there is a solution on the wiki, download the usb image from Tobias Powalowski's page and it comes with a new shiny 2.6.27 kernel with support for the ethernet AND the wireless card, BUT if you want to use the WiFi to perform the installation, you better go download the firmware for your card, because it may not be on the image. In my case, the 2008.10 image was "firmwareless".
If you follow the usual steps, the whole thing is going to blow up, because the installer loads a i686 kernel (GOOD) but detects the Core2Duo as a 64bit proc and installs the x86_64 packages (BAD). It ends up with an infinite loop of errors when chrooting to create the root password. To avoid this, you have to edit the mirrorlist. Anytime you want (the sooner the better) switch to another terminal and type this:
# cd /etc/pacman.d/
# sed -e 's/x86_64/i686/g' mirrorlist > 686
# mv 686 mirrorlist
If you want to install over the WiFi you also have to:
# mount /dev/sd[whatever your usb is] /mnt
# cp /mnt/path/to/your_firmware /lib/firmware
# ifconfig wlan0 up
# iwconfig [whatever]
In case you have a WPA[2] network, replace the iwconfig command with the appropiate wpa_supplicant equivalent.
Switch back to the installation menu and you're good to go, no more specific X200s problems from here (almost). Don't forget to select you firmware in the package selection screen!
The only thing to remember is to check the modules in rc.conf. If the snd-pcsp module is listed before snd-hda-intel, sound will fail most of the time, so swap them if you need. NOTE: as the kernel 2.6.28 config suggest, you shouldn't use pcsp at all. I just removed the module from the kernel config so I don't have the module in my system. No pcsp module, no problem.
Reboot, and welcome to your new shiny Arch system!

What works out of the box:

In Arch? That would be... the keyboard. And that's the point!
Actually, a couple more things work out of the box.
  • The Wifi should work if you installed the firmware. With kernel 2.6.28 it works in monitor mode WITH packet injection support.
  • The ethernet card works.
  • The Thinkpad goodies (ThinkLight, Brightness, Sensors...) also work without any intervention.
  • The brightness has a weird one-press-lag: if you are reducing the brightness and then press the brightness up key, it will reduce the brightness one more step before starting to bring it up as it should (not in KDE4.2).
  • The SATA hard drive works.
  • The USB ports work.
  • The fan is controlled automatically, it is possible to override it but there are some notes not to mess with it so I don't. It works well speeding up and slowing down as needed.
  • The card reader works and hal notifies the insertion.
It's important to keep in mind that Arch offers a very bare-bones installation of linux and it's up to the user to install further programs and utilities as he wants.

First step:
I personally wanted to mantain /etc backup in subversion based on this method, so I installed subversion and made a first backup before anything, and another one after each step, just in case.

GRUB configuration
GRUB does its job fine, but you may want to improve it with some fancy. You have the whole config file above, but here are the details:
  • Add a graphical background to the menu with grub-gfx. This splash is the one I chose.
  • Set the console framebuffer to native resolution with "vga=874" parameter to the kernel. If you know Spanish, you can take a look at my howto, if not, you can google for it or just read the commands.
  • Allow hibernation/suspend-to-disk, adding the parameter "resume=/dev/YOUR_SWAP_PARTITION" to the kernel line.

CPU frequency scaling:

Works as soon as you install and configure cpufrequtils:
# pacman -S cpufrequtils
Edit /etc/rc.conf and add "acpi-cpufreq cpufreq-ondemand" to MODULES and cpufreq to DAEMONS
Edit /etc/conf.d/cpufreq and edit frequencies to something that makes sense for you, or even comment them out, as it works perfectly autodetected.

Sound:

If you checked that snd_hda_intel is loaded before snd_pcsp (or you don't have the pcsp module at all) sound should be working but muted.
# pacman -S alsa-utils
# alsamixer
# aplay /usr/share/sounds/alsa/Front_Center.wav
If you still don't hear anything, check /proc/acpi/ibm/volume, make sure it is not muted (gets muted with the mute key, in case you were wondering). You can unmute it either by pressing vol up/down key or:
# echo -n up > /proc/acpi/ibm/volume
If you only hear noise or very distorted sounds its probably because the audio devices got mixed up. Unload the kernel modules and load them again in the right order, prefferably load only the intel one. Also, don't forget to enable the alsa daemon as noted by the official guide.
BTW: microphone works too.

Video:
The video should work without any issues even without any xorg.conf file, autodetecting the correct parameters. One extra step is necessary to install xf86-video-intel. Of course, it's always safer to follow the steps in the guide and make sure the intel driver is actually used. The new xorg server uses input hotplugging, so remember to start hal before doing any test, or override the policy in xorg.conf. If you do this, remove the Input configuration lines since the hotplugging behavior ignores them. Native 1400x900 resolution is detected flawlessly as well.
VGA-out also works, but with the suboptimally. My guess is the driver is a bit messed up with this also, as it also detects two HDMI "connected", one of them active. Anyway, with 2.4 intel drivers, you need to specify the total resolution with a "Virtual XXXX YYYY" line in your xorg.conf's display subsection, and you may need to specify the resolution you want on your external display with a Modeline in xrandr. This is an example:
$ xrandr --newmode "1920x1080" 172.798 1920 2040 2248 2576 1080 1081 1084 1118 -hsync -vsync
$ xrandr --addmode VGA "1920x1080"
$ xrandr --output VGA --mode "1920x1080"
For the usual VGA, SVGA, etc, resolutions you don't need to do the latter. You can check the detected resolutions with a plain "xrandr". I believe this will change with the new modesetting+xorg+intel pack, maybe even with xorg+intel alone. Feel free to try.

UPDATE (March 12th 2009): With xorg-server 1.6.0, xf86-video-intel 2.6.3, and intel-dri 7.3, now the 3D part seem to be working, but the 2D performance is somewhat laggy, specially in Qt4 apps. For example: with several text files open in kate, when you try to switch from one to another, it takes about one second to show the second file contents since you click on its name in the toolbar, and it shows up in "chunks" of the screen. It's nothing serious, but it's certainly annoying. That 2D glithes are kind of weird, but at least glxgears now gives a decent 1140 fps. Since it seems to be a Qt4 problem, I'll try to update Qt to 4.5.0 (now in testing) and then see how things work out.
NOTE: Qt didn't help. I don't use 3D apps so I went back to the old drivers.
To install all these packages, try to compile the new xf86-video-intel module from abs/testing and it'll start complaining about dependencies, so install/build all of those. You'll end up with a small dependency-hell with xorg-server and xf86-input-evdev depending on each other, since xorg is a compile dependency for evedev, force the xorg build with the "-d" switch, install xorg (in my case with "-df" since it complained about both evdev and some existing files) and then build and install the evdev driver.

Backlight adjustment:
UPDATE (April 3rd 2009):
Backlight adjustment works just fine in KDE4, without any intervention, but doesn't work at all in console mode. Use the following instructions if you really need them!

The backlight adjusting with Fn+PgUp/PgDown almost work out of the box. The problem is that for some reason, the "video" acpi module has a one key press lag. Say the brightness is 9. You press down a few times to get it to 5. Now, if you press UP, it will go DOWN to 4 and THEN it'll start to go up, with the next key press. So if you went from 9 to 5 and now you want to go up a notch, you will have to press up three times, as the brightness goes trough 5->4->5->6. If you, like me, are annoyed by this, it has a workaround.
First, install acpid:
# pacman -S acpid
Start it at boot and now:
# $EDITOR /etc/rc.conf -> DAEMONS += "@acpid"
# /etc/rc.d/acpid start
Configure the thinkpad_acpi module to take care of brightness:
# rmmod video
# rmmod thinkpad_acpi
# modprobe thinkpad_acpi brightness_enable=1
# cat /sys/devices/platform/thinkpad_acpi/hotkey_all_mask > /sys/devices/platform/thinkpad_acpi/hotkey_mask
And edit /etc/acpi/handler.sh to make the adjustment for you:
[...]
ibm/hotkey)
case "$4" in
[...]
*1011)
echo down > /proc/acpi/ibm/brightness ;;
*1010)
echo up > /proc/acpi/ibm/brightness ;;
[...]
NOTE: you have the whole file linked in the files section above.
Now it should be working as it have. Beware, however, that this is an ugly hack and you should look for a a fixed version of the video acpi module any day soon and use some nice gui like the now broken kde's powerdevil to handle all of this.

Desktop environment:
This one is up to everyone's personal preferences, so you should know how to do it. I use KDE, so kdemod is my choice.

Multimedia Keys:
They pretty much work out of the box. Just assign them to the actions you want. However, remember that the mute key works by muting the /proc/acpi/ibm/volume, not the soundcard, so you will have to unmute it as mentioned above. Almost all the other keys work sending the appropiate XF86Whatever keycode. Fn+F3,F8,F9 send an unmapped scancode, so you can map it to whatever you fancy using Xmodmap. Mute, Fn+F5,Spacebar and Fn + the keys with no blue image send nothing; maybe is a way to fix this playing with the thinkpad-acpi key mask but I haven't looked into it yet.

TrackPoint scrolling with input hotplugging and evdev:
UPDATE (March 20th 2011): The system now got back to xorg.conf instead of fdi files. Add this to /etc/X11/xorg.conf.d/10-evdev.conf:
Section "InputClass"
    Identifier  "Trackpoint Wheel Emulation"
    MatchProduct            "TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device"
    MatchDevicePath         "/dev/input/event*"
    Option              "EmulateWheel"          "true"
    Option              "EmulateWheelButton"    "2"
    Option              "Emulate3Buttons"       "false"
    Option              "XAxisMapping"   "6 7"
    Option              "YAxisMapping"  "4 5"
EndSection

UPDATE (April 3rd 2009): The stock driver you can install with pacman already works, no need to compile it anymore. You still have to add the fdi file, though.
According to this thread in the Arch forums, the problem with wheel emulation is the xf86-input-evdev version. It should be rebuilt using ABS and the TrackPoint should work without any config tweak. Note: as stated in the gentoo wiki, march should be "native" if gcc>=4.3 and not using distcc. This is the most common scenario, so chances are you should use it. Install and configue ABS, go to /var/abs/extra/xf86-input-evdev, copy to your build dir and edit the PKGBUILD changing:
  • pkgver->2.1.0
  • md5sums->a6070ead29b2d81b5b386a96df2661b8 (here is the source if you want to md5 it yourself)
Save the PKGBUILD and install the new evdev driver with:
$ makepkg
# pacman -U xf86-input-evdev-2.1.0-1-i686.pkg.tar.gz
Restart the X server and try. It may work you automatically, but in my case, the autoconf didn't work. Reading /var/log/Xorg.0.log I figured out that it was trying to emulate the wheel with button 4, not 2. To fix this, create "/etc/hal/fdi/policy/trackpoint.fdi" and paste something like this (sorry for the broken indentation, blogger sucks for not including some [code] label. If you want the nice version, check out the snippet section):
<?xml version="1.0" encoding="utf-8"?>
<deviceinfo version="0.2">
<device>
<match key="info.product" contains="TrackPoint">
<merge key="input.x11_options.Emulate3Buttons" type="string">on</merge>
<merge key="input.x11_options.Emulate3TimeOut" type="string">50</merge>
<merge key="input.x11_options.EmulateWheelTimeOut" type="string">200</merge>
<merge key="input.x11_options.ZAxisMapping" type="string">4 5</merge>
<merge key="input.x11_options.EmulateWheel" type="string">on</merge>
<merge key="input.x11_options.EmulateWheelButton" type="string">2</merge>
<merge key="input.x11_options.YAxisMapping" type="string">4 5</merge>
<merge key="input.x11_options.XAxisMapping" type="string">6 7</merge>
</match>
</device>
</deviceinfo>
Then, restart hal with:
# /etc/rc.d/hal restart
Restart the X server (yep, again) and your scrolling should be working perfectly now.

Suspend and Hibernate:
UPDATE (April 3rd 2009): It's hard to tell, but using the 2.6.28 kernel, suspend seems to work fine out of the box, both in Xx and console. Hibernate didn't fail either. I just tested it a few times, so I you run into trouble, use the old workaround....
It's pretty broken out of the box, usually with the resume part. Fortunately workarounds do exist to fix this. First, check you have pm-utils to try to suspend.
# pacman -S pm-utils
Just in case it work, try to both suspend and hibernate. It's a feature that's changing very fast, so by the time you read this it may be working.
# pm-suspend
[...]
# pm-hibernate
[...]
If it doesn't work, try this solution. For me, it worked perfectly, with a 2.6.27-7 kernel, 1.5.3-3 xorg server and 2.4.3 intel driver. I tried to build the 2.5.1 intel driver with ABS as I did with evdev, but it depends on libdrm>=2.4.0, I have 2.3.1 and I don't want to rush too many updates so I left it with the workaround for now.

UPDATE: As of 2.6.28 kernel and 2.6.3 intel driver, I still use this solution, I just havent tried to suspend without the workaround, since it doesn't have any unwanted effects.

Fingerprint Reader:
The laptop comes with the new AuthenTec reader, so right now there is no driver for it, but it's being working on. In the future I'll pay it more attention, but right now I don't really need it, so I just let it be there. Besides, it's a pretty weak system.

Bluetooth:
The bluetooth is enabled/disabled via /proc/acpi/ibm/bluetooth file. When enabled, the device appears as a usb adapter. No Arch driver recognizes the hardware though. It's supposed to be supported by the btusb module, which isn't provided with Arch, despite it is in the official kernel source. Definetly something possible to resolve.
UPDATE Dec-9: once recompiled the kernel with the .config linked in the first section, bluetooth is listed in hciconfig and it's possible to scan for other devices with hcitool. No further testing was performed because bluetooth (among others) is pretty broken in KDE4.1.
UPDATE Dec-11: using the acpi handler script above, you can enable/disable bluetooth with Fn-F5.

SMAPI module:
IMPORTANT: Lenovo released a BIOS update that solves the conflict. If you haven't, you should update you BIOS and won't have any problem. If not, keep reading.
The tp_smapi module (AUR) version 0.39 can't load, with the error: thinkpad_ec: cannot claim io ports 0x1600-0x161f. Seems like unsupported hardware for now, have to wait for a new version. Accordingly, neither the accelerometer nor the advanced battery load configuration does work.

UPDATE: The tp_smapi 0.40 allows to force loading the module:
# modprobe tp_smapi
FATAL: Error inserting tp_smapi (/lib/modules/2.6.28-ranger/extra/tp_smapi.ko): Unknown symbol in module, or unknown parameter (see dmesg)
# dmesg
[...]
thinkpad_ec: cannot claim IO ports 0x1600-0x161f... consider using force_io=1.
[...]
# modprobe thinkpad_ec force_io=1
# modprobe tp_smapi
#
And now you can adjust the fan and use the accelerometer as in any thinkpad.


Does NOT work:
The laptop is amazing but there are some broken things.

The graphic 3D acceleration is almost usless, due to a lack of synchronization between the intel driver guys and the kernel developers. In 2.6.28 kernel should be working again. Don't use compiz or switch back to older versions. As soon as I have some spare time I'll take a look at that.
UPDATE (March 20th 201): video works in 3D and 2D without any major issues.
UPDATE (March 12th 2009): 3D acceleration works with testing versions of xorg, intel, drm, dri and a whole lot more stuff, but now 2D has some issues in Qt4 apps (see Video section above). Anyway, it seems to be solved soon.

The fingerprint reader is another one, but I already mentioned that.

Not tested:
These are things that I don't use, so I have no special interest in them.
  • Microphone input, Integrated Microphone Tested, works
  • Modem (might work, some Lenovo come with real modems)
  • TPM module (no idea about this one)
Well, I think it's pretty much everything. If you have any questions don't hesitate to ask in the comments, either in English, Spanish or almost any language you want (google translation rulez). I will update this page as soon as something new develops. I'm planning to recompile the kernel to get bluetooth support as well as include some modules built into the kernel to gain some boot speed, so I'll come back to let you know how it works out.
If you need further info on installing various linux distributions on similar hardware (X200), check out the reports at tuxmobil.
___________________________________________________

Este post está en inglés, por si le es útil a alguien el mundo más allá de paises hispanohablantes. Dado que este portátil no ha llegado aún a España (ni tiene pinta de que lo haga en varios meses), dudo mucho de su utilidad ahora mismo para nadie aquí. En caso de no entender algo, aclararé cualquier duda. Dejo para un posterior post una pequeña review del portátil, porque realmente es una peazo máquina.


TuxMobil - Linux on Laptops, Notebooks, PDAs and Mobile Phones