Attaching a WiFi Dongle to an AR Drone 2.0 (a.k.a. Compiling Drivers for ARM Based Devices)

Correction (4/24/2014): for your driver to work the AR Drone 2.0 you have to compile the kernel version provided by Parrot which can be found here https://devzone.parrot.com/projects/show/oss-ardrone2

One of the down sides of "out of the box" AR Drone 2.0 is that you can't control multiple drones from the same machine. Another down side is that you can't attach USB devices except flash memories and some other predefined devices due to the limited nature of the busybox deployed on the drone. To over come the first down side without manipulating the WiFi configurations of the built-in WiFi card (i.e. you don't want to mess up your new drone), you will need to overcome the second problem (i.e. install a WiFi dongle and its driver manually). In this tutorial, I try to walk you through the steps to do just that.

I assume that you are working a Linux machine (seriously we are not going to compile drivers on Windows). Ubuntu is preferable !

Because the Drone has an ARM processor, we will need to compile the driver using an ARM compiler against a Linux kernel compiled for ARM. The first step would be to Install arm compiler
:~$ sudo apt-get install  gcc-arm-linux-gnueabi
Then you will need to get and compile a linux kernel with the same version as the one on the ARM machine.  You can know that information using the uname command (in the case of AR Drone 2.0 that's 2.6.32).
:# uname -a
Linux uclibc 2.6.32.9-g4190abb #1 PREEMPT Fri Jul 20 14:10:11 CEST 2012 armv7l GNU/Linux
Notice the extraversion .9-g4190abb, we will need to edit the makefile of the kernel to match the extraversion. To actually get the kernel source code:
:~$ wget https://www.kernel.org/pub/linux/kernel/v2.5/linux-2.6.32.9.tar.bz2
:~$ tar xjvf linux-2.6.32.9.tar.bz2
Open the makefile and edit the "EXTRAVERSION" to whatever extraversion your ARM machine has. The next step will be to configure the kernel:
:~$ export ARCH=arm
:~$ export CROSS_COMPILE=arm-linux-gnueabi-
Then, for AR Drone 2.0, get the kernel.config file from here. Open the arch/asm/configs directory in the kernel and put the configuration file there and rename it to "ardroine_defconfig" and compile the kernel:
:~$ make ardrone_defconfig:~$ make

Now it's time to compile the driver. First, you will need to know which driver to get for the specific WiFi dongle you are using. To do that, connect the WiFi dongle to the AR Drone and telnet the drone:

:~$ telnet 192.168.1.1 

:# lsusbBus 001 Device 002: ID 050d:1102 Belkin Components 
Bus 001 Device 001: ID 1d6b:0002 
Search online for a driver that matches the vendor:id pair (050d:1102 in my case) which requires the RTL8188USC driver. After you download the driver's source code, edit its makefile to use

CROSS_COMPILE := arm-linux-gnueabi-
LINUX_SRC = location of kernel
LINUX_SRC_MODULE = (location of kernel)/drivers/net/wireless/

Then compile the driver which will produce a .ko file (e.g. 8192cu.ko). Copy that file to the ARM machine (in the Drone's case use FTP to copy the file to the drone) then navigate through the terminal to the file's location:
:~$ telnet 192.168.1.1
:~$ cd /data/video
:~$ insmod 8192cu.ko
If the dongle is plugged, unplug it then replug it and test whether it's working or not:
:~$ ifconfig -a
if a new interface is there, then congrats !!

Comments

  1. Can you post a version of your 8192cu.ko file, insmod 8192cu.ko for me just returns killed. My extraversion is .9-g980dab2

    ReplyDelete
  2. You can contact me by e-mail for that as I don't want to publish such a specific file that most probably will work only on your drone.

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
  3. How well is this wifi adapter working with the drone ? ( 050d:1102 Belkin Components )

    ReplyDelete
  4. Hi Ahmed, im trying to compile the usbnet, cdc_ether and tun modules for my extraversion .9-g980dab2 ,however i keep getting compile errors and cant seem to get it right, can you help me get my compilation working or help me get the .ko modules for this extraversion?

    ReplyDelete

Post a Comment

Popular posts from this blog

Sharing the Network: From Circuit Switching to Packet Switching (The Hitchhiker's Guide to Computer Networks)

Video on Demand: Part 1 (The Hitchhiker's Guide to Computer Networks)