— my toolbox is filled with perl, javascript, css and html

thorsen.pm

The Lenovo Thinkpad x240 is awful, but...

Saturday, September 27, 2014

Worst x-series laptop

The thinkpad has an awful touchpad. Or even worse: it’s a clickpad! A clickpad is a touchpad without physical buttons. This means that it seems like you only have one big super-sensitive button in Linux. You do actually have two buttons, but they are at the bottom of the clickpad, and not at the top, where you would probably think the buttons are.

Clickpad

(Credits http://mydevelopedworld.wordpress.com/2013/11/30/how-to-configure-new-lenovo-x240-touchpad-on-ubuntu-13-10/)

As shown on the image above, the clever hardware designers at Lenovo has decided to put the “Print Screen” button at the bottom of the keyboard. I mean… How often do you really need to print the screen?

The most anoying part is probably not Lenovo’s mistake, but simple bad Linux drivers: WiFi. 5GHz works, but rather poorly. It’s super laggy if you want to work over SSH. Even browsing might seem broken from time to time. Why? Because the powersave feature for the wifi driver mess things up. I’m not absolutely sure what’s going on, but I’m surprised it’s not fixed after reading ~ one million bug reports about it.

The battery is not great. I haven’t really tested it in Windows, but I suspect it’s Linux eating resources.

Improve clickpad (touchpad)

So… This isn’t perfect, but it has stopped me from accidently dropping the laptop. The config below will make the clickpad saner. It also includes some fixes for the trackpoint and touchscreen, but it’s not really working as I hope.

sudo mkdir /etc/X11/xorg.conf.d;
curl -L http://thorsen.pm/attachments/xorg-thinkpad-x240.txt \
  | sudo tee /etc/X11/xorg.conf.d/50-thinkpad-x240.conf;

Improve WiFi

The WLAN works pretty well on 2.4GHz, but I’ve experienced drops and disconnects while connected to 5GHz. Seeing lines like this in syslog:

Apr 30 16:51:32 laptop kernel: [656.876012] wlan0: deauthenticating from aa:bb:cc:dd:ee:ff by local choice (Reason: 3=DEAUTH_LEAVING)
Apr 30 16:51:32 laptop wpa_supplicant[1302]: wlan0: CTRL-EVENT-DISCONNECTED bssid=aa:bb:cc:dd:ee:ff reason=3 locally_generated=1

I’ve tried several things to fix this. A lot of ubuntu threads suggest turning off power save, but this didn’t do the trick for me:

sudo iwconfig wlan0 power off

The current solution that works for me, is to load the iwlwifi driver with wd_disable=0:

sudo perl -ni.bak -e 's/options iwlwifi.*/options iwlwifi wd_disable=0/ and $i++;print;print "options iwlwifi wd_disable=0\n" if eof and !$i' /etc/modprobe.d/iwlwifi.conf

I’m usin the current iwlwifi driver in Linux 3.19.0-15-generic, but you might also want to download a newer version of the iwlwifi driver. Example:

# one of:
TAR_GZ="http://wireless.kernel.org/en/users/Drivers/iwlwifi?action=AttachFile&do=get&target=iwlwifi-7260-ucode-22.24.8.0.tgz";
TAR_GZ="http://wireless.kernel.org/en/users/Drivers/iwlwifi?action=AttachFile&do=get&target=iwlwifi-7260-ucode-25.222.9.0.tgz";

UCODE_FILE=$(curl -s -L $TAR_GZ | tar vxz --wildcards --no-anchored '*.ucode');
echo "Downloaded $UCODE_FILE";
sudo mv $UCODE_FILE /lib/firmware/;
sudo chown root.root /lib/firmware/iwlwifi-7260*;

Improve battery time

I ran powertop and extracted most of the suggested settings into /usr/lib/pm-utils/power.d/thinkpad-x240:

curl -L http://thorsen.pm/attachments/power-d-thinkpad-x240.txt \
  | sudo tee /usr/lib/pm-utils/power.d/thinkpad-x240
sud chmod +x /usr/lib/pm-utils/power.d/thinkpad-x240

The battery isn’t as good as they suggest in the spec, but at least it got better.

Turn off touchscreen

The touchscreen is not the worst, but people just can’t keep their fingers off it, so I decided to turn it off.

# The quick hack
echo 0000:00:1d.0 | sudo tee /sys/bus/pci/drivers/ehci-pci/unbind;

The weird thing is that it keeps turning it self on (!) To avoid that, I’m using single and crontab to keep if off:

curl -L https://raw.githubusercontent.com/jhthorsen/app-single/master/script/single \
  | sudo tee /usr/local/bin/single;
sudo chmod +x /usr/local/bin/single
sudo -i crontab -e

Add this line to root’s crontab:

* * * * * /usr/local/bin/single "while sleep 2; do echo 0000:00:1d.0 > /sys/bus/pci/drivers/ehci-pci/unbind; done" 2>/dev/null 1>/dev/null

Fix brightness

You need to change grub settings to fix the brightness up/down keys. By default, it’s only possible to change between four levels, but when changing the “acpi_backlight” setting, it behaves as expected.

To do this manually, you can edit the “/etc/default/grub” file, look for “GRUB_CMDLINE_LINUX_DEFAULT” and add “acpi_backlight=vendor” to the list. If you’re a bit more adventurous, you can run the line below:

sudo perl -pi -e's/^(GRUB_CMDLINE_LINUX_DEFAULT)=.*/$1="quiet splash acpi_backlight=vendor"/' /etc/default/grub
sudo update-grub

Note: Reboot is required after this.

Summary

Even with all the changes above, I would still not suggest buying an Lenovo Thinkpad x240 to anyone. Not even my worst enemy.

If you want to run all the commands in one go, you can run this:

curl -L http://thorsen.pm/attachments/thinkpad-x240-all.txt | bash -

But…Didn’t your mother tell you not to pipe HTTP output into the a shell command?

blog comments powered by Disqus