How-To Configure Wireless LAN on RaspberryPi With Raspbian Kernel 3.2.27+ And Solwise RTL8188CUS WiFi dongle


IMG 3159 Snapseed How To Configure Wireless LAN on RaspberryPi With Raspbian Kernel 3.2.27+ And Solwise RTL8188CUS WiFi dongleThe configuration of WLAN with a RTL8188CUS dongle on RaspberryPi is quite trivial now. It doesn’t’ rely on esoteric scripts, of manual installation of third-party kernel modules anymore.

I’ve been digging the solution for days before, it came alone at the beginning of September with a release of new ‘firmware’ for the RPi (see ‘A little of Story’ at the end of the post).

The procedure to install and configure a wireless network interface with Raspbian requires as little as a system upgrade and minimal understanding of the ‘wpa_supplicant’ utility.

Prerequisites

  1. The RaspberryPi must be powered with a 2A output USB charger because the WiFi dongle is very energy-thirsty, especially when it’s scanning the network for available SSIDs or when it’s creating the connection with the assigned SSID.
  2. The RaspberryPi must be installed with Raspbian version 2012-08-16-wheezy-raspbian or greater.
  3. The RaspberryPi must be connected to the internet via the ethernet card.
  4. It’s advisable to have the ‘avahi-daemon’ package installed (and running)
  5. The WiFi Dongle must not be plugged to the RaspberryPi until specified in the following procedure.
  6. It’s better to use a USB extension lead to connect the WiFi dongle to avoid the RaspberryPi to self-restart if the dongle is hot-plugged (or hot-unplugged).

Notes

I did notice that when the WiFi dongle is installed and active, sometimes it interferes with the usb keyboard (with both normal and wireless keyboards).

System Preparation

If your RPi is running a Raspbian version greater than 2012-08-16-wheezy-raspbian you can skip the System Preparation.

  1. launch a repository update:
    $ sudo apt-get update
  2. run a system upgrade:
    $ sudo apt-get upgrade
  3. make sure that the latest RaspberryPi firmware version is installed
    $ sudo apt-get install raspberrypi-bootloader
    The recent RPi firmwares include the Linux kernel version 3.2.27+ or greater.
    On Raspbian the RPi firmware is packaged as ‘raspberrypi-bootloader
     
  4. Install the wpa_supplicant utility:
    $ apt-get install wpasupplicant

WLAN configuration and wpa_supplicant set-up

We suppose that the WiFi dongle will be recognised as the wlan0 device.

Under some circumstances it may be recognised as wlan1 (..or wlan2 on so on), in such case modify the configuration accordingly.

Otherwise if you want your system to forcibly recognise the dongle as wlan0 you will have to play with the /etc/udev/ configuration files.

  1. Generate a PSK version of your WLAN password with wpa_passphrase utility
    $  wpa_passphrase My_WiFi_SSID mypassword

    the output will be similar to

    network={
        ssid="My_WiFi_SSID"
        #psk="mypassword"
        psk=b2abb0fcd2f4527e11817de0823a57bb19ba4622f4595062c94ec4dd1370b5fe
    }
    This output is meat to be an entry for a network configuration blocks of a wpa_supplicant.conf file.
    By the way we e will use it differently.

  2. Copy the ‘psk’ value of the wpa_passphrase output
    i.e. b2abb0fcd2f4527e11817de0823a57bb19ba4622f4595062c94ec4dd1370b5fe
  3. edit the /etc/network/interfacesand add the wlan0 configurations as follow:
    ...
    
    auto wlan0
    allow-hotplug wlan0
    iface wlan0 inet dhcp
      wpa-ssid "My_WiFi_SSID"
      wpa-psk b2abb0fcd2f4527e11817de0823a57bb19ba4622f4595062c94ec4dd1370b5fe
    alternatively you can use the clear-text version of the password
      wpa-psk "mypassword"
  4. Shutdown the RPi.
  5. Unplug the ethernet cable.
  6. Plug the WiFi dongle in the RPi’s USB port.
  7. Restart the RPi and wait that it connects to the Wireless LAN.

If the dongle will lighten up and you can ping or ssh into the Raspbian, congratulations, you’ve done it!

A little of story:

The Linux kernel 3.x comes with the module rtl8192cu.ko that is not able to properly recognised the WiFi dongle with the RTL8188CUS chipset, and when plugging the device, the RPi will hang on device detection of may even freeze.

The most recent versions on the RPi firmware (Sep 2012) have removed the buggy kernel module, and substituted it with a ‘manually’ compiled module called 8192cu.ko probably sources from the source code available at Realtek home page.

 

Comments

comments

Powered by Facebook Comments

About marcomc

Marco M.C. is a System Administrator with 10 years of professional experience in ICT. He has deep knowledge of Mac OS X, Windows, and GNU/Linux. His hobbies vary from DIY, Traveling, learning foreign languages and especially he love to cook and experiment with food from all around the world.
This entry was posted in IT, Linux, RaspberryPi and tagged , , , , , . Bookmark the permalink.