stmllr.net

Sempre Wireless USB stick WU300-2 on Raspberry Pi

by on stmllr.net

The first models of Raspberry Pi computers were shipped and I was happy to receive one this week. RasPi is a SoC computer for ~25€ with Broadcom BCM2835 (ARM) CPU, 256MB, Ethernet, USB, HDMI and 3.5mm audio jack. I completed the equipment with an additional wireless USB adapter. Let me describe how to I managed to get the device working. !!!! UPDATE (2012/07/22) I recommend to use the raspbian image with a prebuild wireless module working out of the box.

Update (2012/07/22)

I recommend to upgrade your Raspberry Pi to raspbian distribution. It not only comes with FPU support for armhf arch, but also ships the neccessary firmware and kernel module r8712u from Debian wheezy by default.

The original story: How to build wireless kernel module for Raspberry Pi

I bought the cheapest wireless USB adapter my local store had: Sempre Wireless LAN 11N WU300-2. Back at home I booted the Debian image and plugged in the device.

Unfortunately it did not work out of the box , since it uses a realtek chipset. Realtek wireless devices are infamous for insufficient open source support. However, after fiddling around some time I managed to get it working. Here's a little howto. At the end of the article, you can find a built of the neccessary kernel module.

Examining the device

First, plugin in the device and watch the output of dmesg:

$ dmesg

usb 1-1.2: new high speed USB device number 4 using dwc_otg
usb 1-1.2: New USB device found, idVendor=0bda, idProduct=8172
usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1.2: Product: RTL8191S WLAN Adapter 
usb 1-1.2: Manufacturer: Manufacturer Realtek 
usb 1-1.2: SerialNumber: 00e04c000001

Looks good so far. Now find out what ID the device has:

$ lsusb

Bus 001 Device 006: ID 0bda:8172 Realtek Semiconductor Corp. RTL8191SU 802.11n WLAN Adapter

Then search the ID in Debian Wiki for the corresponding kernel module: mine is r8712u.

The device driver you need consists of two parts:

  1. The kernel module and
  2. the firmware image.

Kernel module r8712u

The kernel module r8712u is located in the staging area of the kernel. Unfortunately the staging modules are not shipped with the Debian image (debian6-19-04-2012.img) from Rasperry Pi. So you'd have to build them yourself (or download and use the one I built).

To be able to build a kernel modules, you need some additional Debian packages:

$ sudo aptitude install build-essential libncurses5-dev

Fetch the kernel sources from github like it is described in the elinux wiki:

$ mkdir raspi && cd raspi/
$ git clone https://github.com/raspberrypi/linux.git
$ cd linux

Now configure the kernel:

$ cp arch/arm/configs/bcmrpi_cutdown_defconfig .config
$ make menuconfig

Enter the sections

Device Drivers  --->
   Staging drivers  --->  

and select (M) for the corresponding chipset:

(M) RealTek RTL8712U (RTL8192SU) Wireless LAN NIC driver

Save your configuration and build the module:

$ make modules

Copy the modules into the kernel module directory:

$ sudo cp drivers/staging/rtl8712/r8712u.ko /lib/modules/3.1.9+/kernel/net/wireless/

Firmware image

Realtek chipset need additional binary firmware images:

$ sudo aptitude install firmware-realtek

(You need to have Debian non-free repositories included in your apt/sources.list.)

Now rebuild your modules list, load the module and watch the dmesg log:

$ sudo depmod -a
$ sudo modprobe r8712u
$ dmesg

r8712u: module is from the staging directory, the quality is unknown, you have been warned.
usbcore: registered new interface driver r8712u
usb 1-1.2: new high speed USB device number 6 using dwc_otg
usb 1-1.2: New USB device found, idVendor=0bda, idProduct=8172
usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1.2: Product: RTL8191S WLAN Adapter 
usb 1-1.2: Manufacturer: Manufacturer Realtek 
usb 1-1.2: SerialNumber: 00e04c000001
r8712u: DriverVersion: v7_0.20100831
r8712u: register rtl8712_netdev_ops to netdev_ops
r8712u: USB_SPEED_HIGH with 4 endpoints
r8712u: Boot from EFUSE: Autoload OK
r8712u: CustomerID = 0x000a
r8712u: MAC Address from efuse = 00:0a:eb:14:13:52
r8712u: Loading firmware from "rtlwifi/rtl8712u.bin"
r8712u: 1 RCR=0x153f00e
r8712u: 2 RCR=0x553f00e

Finaly, you should have a new device wlan0:

$ iwconfig

lo        no wireless extensions.
eth0      no wireless extensions.
wlan0     unassociated  Nickname:"rtl_wifi"
          Mode:Auto  Access Point: Not-Associated   Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Download the kernel module r8712u.ko

If you don't want to fiddle around with compiling kernel, you can download the binary module here: r8712u.ko 

It is built from these sources: rtl8712-src.tar.gz which are provided here for licence reasons. If you are interested inthe full linux kernel sources for Raspberry Pi, have a look at the github repository of Raspberry Pi.

 

Tags

Comments

  1. Sam Ueckert

    Thanks for the excellent post. I have followed your method, and created the correct module and copied it over. The make process doesn't configure the module however. Do you have any info on what I need to add to /etc/modules.conf?
    Also, newbs will be thrown by the unnecessary 's' on 'build-essential' if they just copy-and-paste it from here.

  2. Sam Ueckert

    Thanks for the excellent post. I have followed your method, and created the correct module and copied it over. The make process doesn't configure the module however. Do you have any info on what I need to add to /etc/modules.conf?
    Also, newbs will be thrown by the unnecessary 's' on 'build-essential' if they just copy-and-paste it from here.

  3. Bazza14

    Thank you a clear and concise solution. Worked for me.

  4. Neil Ford

    If you get a Module not found error using the downloaded module, http://www.jtek.cz/?p=21 has some more detail on how to get the module properly installed and working.

    A big thank you for making the module available. Now have working wifi.

    - Neil.

  5. Steffen

    Thanks for your positive feedback.
    I have fixed the build-essential package name and added a hint about "depmod -a".

  6. Steffen

    I just installed the new raspbian armhf image (2012-07-15-wheezy-raspbian.img) and fortunately, both the r8712u driver and the realtek firmware is included by default.

    Compiling kernel module is not neccessary anymore! Hurray!

  7. Steffen

    If you like to connect the RasPi to your WLAN access point, I'd suggest to use WPA-PSK with WPA2 protocol encryption. You need to put the following configuration into /etc/network/interfaces

    iface wlan0 inet dhcp
        wpa-key-mgmt WPA-PSK
        wpa-proto WPA2
        wpa-ssid YOUR_SSID
        wpa-psk YOUR_ENCODED_PASSPHRASE

    To get an encoded passphrase use:

    $ /usr/bin/wpa_passphrase <ssid> [plaintext_passphrase]