Buying a freedom-respecting USB wifi card for a Lenovo laptopPublished on Tue 18 February 2014.
I received a second-hand Lenovo ThinkPad R400. It’s compatible with Trisquel GNU/Linux 6.0.1 except for its Intel wifi card that needs nonfree firmware (while its fingerprint reader needs an updated userspace driver). I decided to buy a compatible card, since it’s more practical than getting a longer Ethernet cable.
Replacing it with another internal miniPCIe card would be difficult: Lenovo laptops have an antifeature preventing the use of internal wireless cards from other vendors (my other article discussed this and other freedom issues in laptops). I don’t know if an available card would work in this ThinkPad model (all cards that it is shipped with need nonfree firmware) nor how much effort I would need to work around this restriction. These cards are also much harder to buy here than external USB ones. So I decided to buy one in a local shop with an online catalog.
Choosing chipset and device
There are two important aspects of a wifi card: chipset and protocol support. (Appearance and size too is important for external cards, while it is a clearly marketed feature that all shops and vendors show.) I looked for 802.11bgn devices working at 2.4 GHz channels, since 802.11n brings better coverage and performance. Dualband 2.4 and 5.0 GHz devices are harder to find here and much more expensive, while they could be more useful at home with an appropriate AP.
There are practically only two modern chipsets that meets my criteria: Atheros AR9271 and AR7010 using the ath9k_htc driver with free firmware. There are other chipsets used in USB devices that work without nonfree firmware using rtl8187 or carl9170 drivers, while the devices using them are older and not widely available now, and they have technical issues (rtl8187 is for 802.11bg only, carl9170 is for an older version of 802.11n). (I use the word ‘chipset’ for both a single chip and a group of chips working together, this not completely correct usage is common here.)
Which available device has this chipset? An easy solution is to buy one from ThinkPenguin or Tehnoetic, since they offer only devices compatible with free software and they supported freeing AR9271 firmware for their FSF-endorsed cards. (Their single-band cards have higher prices than ones from other vendors, while it might be a worthy cost for supporting development of free software and certainty of the device being supported.) Partially due to lack of local ThinkPenguin shops (leading to much longer and more expensive delivery), I decided to look for a different device in a local shop catalog.
There was no information on what chipsets these devices have, except for some with non-Atheros chipsets that won’t work without nonfree firmware. There was also no information on which versions these devices were: vendors often put completely different chipsets in different versions of the device without changing its name nor making it visible in marketing data.
WikiDevi has information on many devices with versions and chipsets. It allowed me to quickly filter out many useless devices. I’m not sure if this information is complete: vendors release new versions with different chipsets. All devices that I checked were listed and the one that I bought had no other version.
There is another way to learn this: vendors offer nonfree drivers for nonfree operating systems, separately for each device version. These drivers often are ZIP archives that can be browsed without running the included software and contain a .inf file which names the chipset used. If there is any device version that has a driver for an unsupported chipset, don’t buy such a device unless you know it is of a working version. If all versions have listed the AR9271 USB vendor and product identifiers (the modinfo ath9k_htc command lists aliases with identifiers of devices that have a supported chipset), buy it.
Using these methods I found a supported device: TP-Link TL-WN722N that worked out of the box with Trisquel 6.0.1 using the 3.11.0-15-generic kernel. (It needed downloading external free firmware and updating kernel on older 6.0 installations.)
What’s needed to use an internal card with free software?
While the external card works well, having a supported internal one would be better. Why it doesn’t work out of the box and how can this issue be solved?
Intel doesn’t publish sources of their wifi firmware nor documentation needed to understand or reimplement it. They falsely claim that it would be illegal due to FCC software-defined radio regulations, while this doesn’t prevent Atheros from having free firmware (Software Freedom Law Center published an opinion supporting the use of free software with such devices). (It’s not the only area where Intel releases blobs where other companies provide free source code and documentation: they provide sourceless blobs for memory initialization of chipsets used in coreboot and claim that no company provides documentation or source allowing making a free implementation, while companies like AMD and Intel release similar free code for some of their chipsets.)
Lenovo uses a similar argument for the whitelist antifeature, while laptops from some other vendors work with any such cards with probably no legal issues. There is a different argument that might be true: they want users to buy cards with their branding. (If only these were available here…)
What real and complete solutions are possible? There are non-technical solutions: we could convince Intel to free their firmware or release documentation allowing a free reimplementation and make removing the whitelist more profitable for Lenovo than their monopoly on replacement cards. How can this be done?
Reverse engineering by free software hackers gave us free firmware for NVIDIA GPUs and free drivers for many devices, including 802.11bg Atheros chipsets (802.11n devices have a free driver developed by Atheros, 802.11ac have nonfree firmware). Can Intel wifi firmware be reverse engineered and replaced? This is probably very hard, since there are multiple big blobs (more than 300 KiB of binary sent to the device) in an unknown instruction set. There is no project doing it now. Maybe there are other wifi chipsets in devices shipped with Lenovo laptops that have easier to replace firmware, while there are no projects for them yet.
Since it’s hard to make the default card work, can we fix the boot firmware to allow using a different card? The best way would be to port coreboot, the free boot firmware, to the laptop. It is hard, practically impossible if the chipset isn’t supported, easier if it’s similar to a supported device. Even if there is coreboot support for the laptop, it is hard and risky for users to flash and much work needs to be redone for each different laptop model. It’s a good solution if vendors sell many laptops of the same model with preinstalled coreboot and a free wifi card, like Gluglug does for their FSF-endorsed X60.
A simpler and more widely discussed approach is to modify the nonfree boot firmware to change or remove the whitelist. This way has similar flashing risks as coreboot installation and requires using or adapting nonfree software, making results less useful for recommending to others.
It might be also possible to change how a freedom-compatible card identifies itself, to make it accepted by unmodified boot firmware. This requires using a different laptop without the whitelist and might need changing the driver to handle the renamed card. While there are free tools for reading and writing EEPROM of Atheros cards that I have, none of them is able to write it and there is no documentation of how these identifiers are stored there.
Only USB wifi cards work everywhere. We should recommend buying freedom-friendly ones: there are many ways to do it with varied difficulty and reliability. While we should promote laptop vendors selling hardware without such restrictions, it is important to support freeing systems that users already have.
Thanks to icarious for suggesting several workarounds for the Lenovo whitelist. Thanks to FreeNode users AimHere, Calinou, jxself and oitofelix for advice and encouragement related to recommending compatible USB cards.
Submit comments on this post to <firstname.lastname@example.org>.