Setting up Wi-Fi on Kindle, 2

25.02.2013 20:12

In my previous post I've mentioned that Kindle's AR6002 wireless chip set seems to work fine with the configuration tools that come with Debian.

Such setup however has an annoying problem. The wireless interface doesn't see packets addressed to the MAC broadcast address (even in promiscuous mode with tcpdump). This means that the kernel on Kindle won't see things like ARP requests (but will see ARP replies) and pings of the broadcast IP. The former means that IP connections initiated from other machines on the network mostly won't work, unless these machines already have Kindle's MAC address in their ARP cache. You can work around that by adding a manual entry for Kindle in the ARP cache or making Kindle establish a connection first, but these are ugly workarounds.

It turns out that the AR6002 driver that was shipped by Kindle kind of implements standard Linux wireless extensions, but not really. Kindle OS uses a modified wpa_supplicant that uses some kind of a proprietary ioctl interface to talk to the kernel module and using that the broadcasts work correctly.

Since WPA supplicant comes under the BSD license, Amazon didn't feel the need to provide the source to the modified version in their GPL-compliance package (aren't permissive licenses great?). Hence I've again lifted the binaries from the Kindle OS image and created another Debian package, similar to the firmware-ar6002 I mentioned in the last post.

The wpasupplicant-ar6002 package is available here and of course will only install on the armel architecture. It uses a bit of dpkg-divert and shell scripting magic to transparently add a ar6000 driver to wpa_supplicant. This means that you can simply use the wpa-driver directive in the interfaces and the system will use Amazon's patched binary instead of the one shipped with Debian.

The full /etc/network/interfaces snippet for Kindle's wireless network now looks like this:

auto wlan0
iface wlan0 inet static
        pre-up wmiconfig -i wlan0 --power maxperf


        wpa-driver ar6000
        wpa-ssid xxx
        wpa-psk xxx
Posted by Tomaž | Categories: Code

Add a new comment

(No HTML tags allowed. Separate paragraphs with a blank line.)