Install Mercury MW150US WIFI dongle on RPi

The wifi dongle cannot be recognized by command lsusb and lsusb, found the chipset of MW150US is rtl8188eu, not rtl8192cu, it is very important.

My RPi kernel is 3.2.27+, it is need to compile module rtl8188eu with RPi source code.

Procedure as below

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# apt-get install build-essential
#
# cd /usr/src
# wget -O rpi-3.2.27.tar.gz https://github.com/raspberrypi/linux/tarball/rpi-3.2.27
# tar xzf ./rpi-3.2.27.tar.gz
# KVER=`uname -r`
# mv raspberrypi-linux-* linux-$KVER
# cd linux-$KVER/
# sed -i 's/EXTRAVERSION =.*/EXTRAVERSION = +/' Makefile
# zcat /proc/config.gz > .config
# wget https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers
# make oldconfig
# make modules_prepare
# ln -s /usr/src/linux-$KVER /usr/src/linux
# ln -s /usr/src/linux-$KVER /lib/modules/$KVER/source
# ln -s /usr/src/linux-$KVER /lib/modules/$KVER/build

Get rtl8188eu source code from http://gutspot.com/wp-content/uploads/2013/01/8188eu_USB_linux.zip
unzip the file and go to directory driver
# make && make install

In my case, it’s all. The module rtl8188eu has been load into RPi, MW150US WIFI dongle can be recognized.

1
2
3
ifconfig -a
iwcofnig
iwlist wlan0 scan

If it does not work, try the following method,

1
2
3
4
5
6
7
8
# lsmod
# rmmod 8192cu
# insmod 8188eu.ko
# modprobe 8188eu
# modinfo 8188eu
for autoload in RPi
# echo "8188eu" >> /etc/modules
# echo "blacklist rtl8192cu" >> /etc/modprobe.d/blacklist.conf (not necessary)

sudo nano /etc/network/interfaces

1
2
3
4
5
6
7
8
9
10
11
auto lo

iface lo inet loopback
iface eth0 inet dhcp

auto wlan0
iface wlan0 inet dhcp
# try one of below options
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
OR
pre-up wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf -B

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

1
2
3
4
5
6
7
8
9
network={
ssid="YOUR-SSID"
scan_ssid=1
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="WPA-PASSWORD" # wpa_passphrase
}

Join WIFI network by running from command prompt with wpa_cli

1
2
3
4
5
6
7
#wpa_cli
>scan
>scan_results
>add_network
>set_network 0 ssid "Xperia T2 Ultra"
>set_network 0 psk "74125896"
>enable_network 0

For reference

1
2
3
4
5
6
7
ssid:   your wifi name
scan_ssid: value of 1 means broadcast and value of 2 means hidden (suggest you enter value of 1)
psk: your wifi password
proto: your choice of RSN or WPA. RSN is WP2 and WPA is WPA1. (most config is RSN)
key_mgmt: your choice of WPA-PSK or WPA-EAP (pre-shared or enterprise respectively)
pairwise: your choice of CCMP or TKIP ( WPA2 or WPA1 respectively)
auth_alg: OPEN option is required for WPA and WPA2 (other option, SHARED & LEAP)

Then run

1
2
3
4
5
# /etc/init.d/networking restart
Or
# ifup wlan0

# dhclient wlan0

script for auto-start wifi connection(Optional) /etc/init.d/wifi-connect

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
#wifi-connect auto-start

case $1 in
start)
wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf -Dwext -s
wpa_cli -B -p/var/lib/run/wpa_supplicant -s
;;
stop)

;;
restart)

;;
*)
echo 'Usage:wifi-connect start|stop|restart'
;;
esac
exit 0

# chmod +x /etc/init.d/wifi-connect
# update-rc.d wifi-connect defaults
# update-rc.d -f wifi-connect remove

Install hostapd

  1. unzip wpa_supplicant_hostapd-0.8_rtw_20120803.zip
    go to directory hostapd and compile
    make && make install
    ** should not ** start hostapd by /etc/init.d/hostapd start just run
    /usr/local/bin/hostapd p2p_hostapd.conf -B
    then hostapd started with ssid DIRECT-RT
  2. config IP address
    ifconfig wlan0 192.168.0.1 netmask 255.255.255.0 (the segment should be match with udhcp)
  3. sudo apt-get udhcpd
    /etc/init.d/udhcp start

Open your mobile’s wifi to search ssid “DIRECT-RT” and pair with it using pasword “12345678”, it will obtain the IP adddress dynamically.

Reference:

http://omer.me/2012/04/setting-up-wireless-networks-under-debian-on-raspberry-pi/
http://tasksofohm.wordpress.com/hardware/connecting-raspberry-to-a-ew-7811un
http://www.ctrl-alt-del.cc/2012/05/raspberry-pi-meets-edimax-ew-7811un-wireless-ada.html
https://guts.me/2013/01/30/set-up-wifi-router-with-raspberry-pi-2-compile-driver-for-8188eu-and-set-up-hostap/
http://blog.elevendroids.com/2012/12/building-tp-link-tl-wn725n-wifi-usb-adapter-driver-for-raspberry-pi/
http://jarhead.blog.163.com/blog/static/175217041201317102236535/
http://alansun.iteye.com/blog/1150893

hostapd

http://www.raspberrypi.org/phpBB3/viewtopic.php?t=19120 http://elinux.org/RPI-Wireless-Hotspot

*** New Version for 3.12.22+ ***
Just install a script to install rtl8188eu.ko as below,
tar -zxvf 8188eu-201xyyzz.tar.gz
<–set data code for driver version above

1
2
3
sudo install -p -m 644 8188eu.ko /lib/modules/$(uname -r)/kernel/drivers/net/wireless
sudo insmod /lib/modules/$(uname -r)/kernel/drivers/net/wireless/8188eu.ko
sudo depmod -a

http://www.raspberrypi.org/forums/viewtopic.php?p=462982#p462982
http://www.fars-robotics.net/