ThinkPad T520/W520, NVIDIA, Wide Gamuts, and You!

Update: Linking to a better color profile below.

Update 2: I narrowed down the ACPI issues, and have a better solution.

I recently purchased a brand new, maxed out ThinkPad T520. My old laptop was 4 years old, and while I absolutely loved it (and still do!), an opportunity came up to get a T520 with a nice discount. So I took advantage of that. I like large screen resolutions, as I tend to have a few thousand windows on screen at any given point in time, so I went with the 1920×1080 option, and put Ubuntu Linux on it.

And let me tell you, for an Ubuntu-certified laptop, it sure didn’t work out of the box.

Optimus!

It took a lot of effort to get Ubuntu working, due to some hardware problems. The biggest issue was the display adapter. The T520/W520 (and I believe the T420, etc.) come with two graphics chipsets: An Intel something-or-other, and an NVidia 4200M. By default, this is in “Optimus” mode, meaning that the OS can essentially switch between the cards for performance/power savings reasons, depending on use.

Not surprisingly, this does not work on Linux.

Your system will try to use the Intel card. You won’t have any 3D, and try as you might, that NVIDIA card just will not work. It’s maddening, but there’s a solution. One with its own set of problems, but at least it gets you there..

The trick, it turns out, is to go into the BIOS, go into the video settings, and switch to “Discrete Graphics” and disable auto-detection of Optimus. Once you do this, your NVIDIA card will work! You’ll get 3D, and it’ll be fast and smooth and so wonderful.

If you can boot, that is.

Once I switched over, I found I could no longer boot. Now this was 4:30 in the morning and my brain stopped functioning, so I wasn’t making all the connections. All I know is that booting locked up, and when I went into recovery mode, I started seeing I/O errors on my brand new 160GB SSD. Figuring it was just my luck, I decided I’d call Lenovo in the morning and get a new one. If this sounds at all familiar, stay calm! It’s not your SSD, and your system is not hosed. It’s ACPI.

(Of course it’s ACPI… Nobody ever said it was the Year of the Linux Laptop.*)

Update: I previously said that passing acpi=off in grub would fix things. That disabled battery and other stuff, though. The new solution below is far better. Suspend/resume and brightness work!

So, to fix that, go back to Intel graphics, edit your /etc/default/grub file, and set GRUB_CMDLINE_LINUX_DEFAULT to:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi=noirq"

Unfortunately, you won’t get Suspend/Resume, and I think the battery monitor is busted, but you’ll get Hibernate. It’ll mostly work. Sometimes. It’s Linux, afterall.

I’m not sure if this is needed anymore, but you may also need to add this to the “Device” section in your xorg.conf:

Option "RegistryDwords" "EnableBrightnessControl=1"

Once you have a working X/Unity/Compiz/3D/Minecraft setup working, you may notice some problems with colors….

Wide Gamut

The T520/W520/T420/etc. line of ThinkPads have a new 95% Wide Gamut LED display. It makes everything all bright and nice. And it butchers your colors.

Applications that support color management should in theory compensate for this. Not all apps do, though. What bothered me was my web browsing experience. Every color was broken, and as someone who writes webapps, I needed accurate colors. I was about to throw out this laptop before I managed to figure out a solution.

Modern Ubuntus should come with a Color Profiles control panel under System -> Preferences. From here, you can load ICM profiles and get things working. That will solve some of your issues, so let’s start there. Note that this is in Ubuntu 11.04 (I think), but I’m running 10.10 (I thought originally 11.04 was the source of my problems), so for me I had to:

apt-get install gnome-color-manager

And here, I the Color Profiles applet was causing problems, and I couldn’t directly use it, so I installed dispcalGUI, which allowed me to load in a profile and install it into Color Profiles, and activate it.

On some site, I found a working color profile (ICM file). I don’t know where I originally found it, but you can download it here. Note that this is only tested on my 1920×1080 display, so YMMV.

I’m not confident that this profile is 100% correct, but it’s close. At least as far as I can tell.

You’re free to try that profile, but I found a better one which preserves the crispness of the display with the actual accuracy you’d want on the web. WordPress is even looking correct now.

NotebookCheck’s review of the ThinkPad W520 links to a color profile that works much better.

Firefox Color Profiles

Now, you’ll still notice problems with Firefox and Google Chrome. Chrome doesn’t seem to understand color profiles, but Firefox does. You just have to tweak it.

In Firefox, go to about:config. In there, search for gfx.color_management. Set gfx.color_management.mode to 1, and then set gfx.color_management.display_profile to the path of that ThinkPad ICM file I linked to earlier.

Restart Firefox. You should now see more or less correct colors!

Now it’s not perfect. The ThinkPad screen is very bright, and some things can get a bit washed out and perhaps slightly tinted. As I type this, I’m noticing that the WordPress UI is a bit off, and things blend together more than they should (lots of light grays on a bright screen). But it should be much better than it was!

If you use a T520/W520/T420/etc. and have other solutions or tips for color management on Linux, I’d love to hear about them! And hopefully this saved someone else hours or days of rage.

* Thanks to James Farwell for the “Year of the Linux Laptop” snark.

Sentience discovered in the Linux kernel

Ladies and gentlemen, after much experimentation, I have made a remarkable discovery. Perhaps the very first case of a sentient AI has been discovered, sitting right under our noses, in the Linux Kernel. With such a complicated codebase that has evolved greatly over the years, there are certainly more surprising places for it to spring up, but it’s still quite unexpected.

And where, specifically, has this sentience manifested itself? The suspend/resume code.

See now, like many of you, I’ve dealt with the instabilities of suspend/resume. I’ve considered it to just be buggy, unreliable, and possibly incompatible with my hardware. That is, until I realized that there’s a pattern. One that began to make a sort of sense.

A couple months back, I gave suspend/resume another shot, and to my surprise it worked. I figured that Ubuntu 10.04 finally fixed it, but it still wasn’t perfect. I still noticed problems.

The first thing I noticed was that when I unsuspended at work, I couldn’t use my volume keys. Everything else was fine, but my laptop’s volume keys didn’t register as a key press on anything. If I suspended again and brought it back home, the keys would work fine. If I suspended at home and resumed at home, I wouldn’t have the volume key problem. Weird, but just buggy, right?

It was a couple weekends ago when I suspended my laptop to take it somewhere. It wouldn’t suspend at all. Just hard-locked. This continued until the week, when it worked again. Last weekend? Same problem, couldn’t suspend. Monday, it worked fine.

It was then that I realized suspend/resume was breaking deliberately! See, my laptop feels more comfortable at home, less so at work but it tolerates it (with some complaining), but absolutely doesn’t want to leave during the weekend. It’s like a cat that just wants to be in a familiar environment, selfishly vying for your attention through mischievous acts. Look at it hard enough and the pattern emerges. It’s undeniable.

That got me thinking. What other possible instances of AI have we been misconstruing as bugs or random glitches? All those inter-connected street lights that occasionally shut off as you walk underneath them? Maybe they’re just shy, or they hate you. Maybe NES cartridges just found being blown stimulating.

So remember guys. Windows suspend/resume may work just fine. Mac too. But Linux’s suspend/resume isn’t a buggy pile of crap. It’s an intelligent buggy pile of crap, that just wants to be loved.

Vista’s gremlins, now on Linux

Vista is an interesting operating system. They have done a number of very cool things with it, and yet it has confused and frustrated me in all new ways. I have been running Vista in a VM for a little while now. I think in many ways it is a better operating system. And there is one thing Vista comes with that beats us hands-down.

It has a Gremlin clock.

Vista's Gremlin skin

The little clock applet on the side has several skins, and one of them is a pink, furry gremlin. I fell in love with this little guy and decided that we must have a Gremlin clock skin ourselves. So I set out to create one, using MacSlow’s cairo-clock. After a couple hours of work, I ended up with this:

I think it’s a cute little thing. I hope others like it too. Just download it and untar into $HOME/.cairo-clock/themes or /usr/share/cairo-clock/themes.

A couple of notes about the theme. cairo-clock doesn’t tend to like themes with different widths and heights and expects the clock face to be in the center of the images. Since the clock face on the Gremlin theme is a bit lower, near the bottom of the gremlin, the theme images had to be made to give a lot of whitespace below the clock. The actual gremlin is on the upper-half of the images. This is not a huge problem except that there appears to be a bug where you can click and drag the clock on parts of the lower region, where it’s completely transparent. Hopefully this isn’t a big problem for most people.

Oh, and MacSlow, if you want to bundle this as part of cairo-clock, I’d be all for it 😉

Now we’re on par with Vista. Yep.

Just A Little Easier, Please – Networks

The Linux desktop has progressed quite a bit in recent years. Ubuntu, out of the box, mainly just worked. I was able to quickly set up a nice desktop for my girlfriend using it. It was really nice to see the little things all fit together. For example, when we took a pic with her new camera and plugged it into the USB port, a dialog popped up asking us if we want to import the pictures. Now obviously, I expected that, and it’s not like that was invented in Linux, but it’s one of those nice touches that just makes life a little bit easier. Still, there is so much room for improvement.

I’ve been trying to think about what specifically I find annoying in day to day usage of Linux. I think my biggest gripe right now is how much of a pain it is just to move my laptop from network to network. I have five networks I tend to use. The first is my home network through my wireless router. The second is also the home network, but wired, through another router. The third is the network at work. The fourth is the wireless network back at my parents’ house, and the fifth is the wireless network at my grandparents’ house, which is next to my parents’ house.

Now, I don’t visit my parents that often, and I don’t connect to the wired portion of my network often either. However, I do switch twice a day between the wireless network at home and the wired network at work. And every time I do, I have to switch network interfaces, re-enable/disable the proxy servers, and change my Gaim account configurations (port numbers for going through the proxies, accounts I wish to auto-login, proxy settings, etc.). It’s just enough of a chore where I think to myself, “Ugh, must do this again.”

When I plug in a Windows computer into a wired network, a little bubble pops up saying that the Ethernet is connected, and it (usually) tries to configure my network settings. It doesn’t always work right, but hey, it’s an effort. It would be nice if we had such a thing in Linux. Maybe we do and I just don’t know about it, but if that’s the case, then we need an easier way for users to discover it and to configure it. Basically, when I plug in a network cable, I want my wifi connection to go down, my wired connection to go up, and a DHCP server to be scanned for. Now the wired-only portion of my network at home doesn’t use DHCP (yet), so it’d be nice for some kind of auto-discovery magic to happen, but really I should be using DHCP here anyway.

The little network selector in my panel is a nice start, really. It’s been buggy here, but it mostly works. However, it’d be much nicer if I could also configure proxy servers for each interface and network. Not tied to that applet, mind you. It would have to be a layer below it somewhere. When I change networks on the command line, the same magic should happen.

The Gaim auto-reconfiguration could happen via a Gaim plugin, which I’m very tempted to write. I don’t know what the easiest way would be to determine when a network changes on an interface, and when interfaces change. Perhaps some kind of D-BUS layer somewhere could intelligently broadcast this information in an easy-to-use form.

I don’t imagine a lot of this would be difficult to develop, and it’s largely a matter of putting the small pieces together (once written). It would certainly make this one aspect of my daily usage a lot easier. I’m sure I’m not the only one frustrated by this. I don’t know if there is work going on in this area or not, but hopefully someone will get the motivation to hack on a piece or two.