HowTo using TP-Link WN725 on Raspberry Pi running Pidora

From RS Wiki
Revision as of 12:37, 27 March 2016 by Rac2 (Talk | contribs)

Jump to: navigation, search

Introduction

This guide is about using the TP-Link TL-WN725N USB WiFi Dongle on a Raspberry Pi and Pidora. After spending more than 1 day searching on Google and trying all possible things, I succeed making it work.

I am using a minimal Pidora installation with no NetworkManager. Since it was challenging enough I have decided to put it all together here.

If this page helps you, please link to it (e.g. from discussion groups) or put a nice comment on the discussion page :). This page is intended for people that have a clear understanding about Linux (Fedora preferably). If you are a beginner, you can follow the steps, but you need to google a little bit about what is the meaning of each command.

The TL-WN725N USB WiFi Dongle requires enough current to make the Pi reboot if you insert or remove it when working! Please shutdown your system before inserting or removing the adapter.

Step 1: Firmware

If you get something like "Direct firmware load for rtlwifi/rtl8188eufw.bin failed with error -2" when booting with the Wifi Dongle installed or Typing lsusb is not displaying the device, then you are not having the firmware installed. You have to Download and install the firmware:

  • download the firmware to a subdirectory rtl8188eu/
  • copy the firmware (file rtl8188eufw.bin) from the download directory to /lib/firmware/rtlwifi/
  • reboot to activate the firmware (you can wait with this step, make it after step 2)
       git clone https://github.com/lwfinger/rtl8188eu.git
       mkdir -m=777 -v -p /lib/firmware/rtlwifi/
       cp rtl8188eu/rtl8188eufw.bin /lib/firmware/rtlwifi/
       chmod 444 /lib/firmware/rtlwifi/rtl8188eufw.bin
       reboot

The success of this step means that the device is recognized (lsusb lists it like below).

       -bash-4.2# lsusb
       Bus 001 Device 004: ID 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter


Step 2: Activate the corresponding kernel module

Check if the kernel module is loaded with lsmod. Probably it is not, so you have to:

  • download the kernel module
       wget https://dl.dropboxusercontent.com/u/80256631/8188eu-20160319.tar.gz  -> is anyone out there able to provide a better link as the dropbox?
       tar xzvf 8188eu-20160319.tar.gz
       cp 8188eu.conf /etc/modprobe.d/  -> disable power management
       cp 8188eu.ko /lib/modules/4.1.20+/kernel/drivers/net/wireless/8188eu.ko  -> copy the kernel module to the proper location
       chmod 644 /lib/modules/4.1.20+/kernel/drivers/net/wireless/8188eu.ko
       reboot  -> alternatively you can use modprobe and insmod to activate it on the fly if see the device with lsusb, i.e. rebooted after step 1

Now lsmod should list the

       -bash-4.2# lsmod
       Module                  Size  Used by
       8188eu                931781  0

ifconfig -a should list the device and provide you with the MAC address and the device id (e.g. wlan0).

Step 3: the ifcfg-wlan0 file

setup the /etc/sysconfig/network-scripts/ifcfg-wlan0 file

       NAME="wlan0"
       DEVICE=wlan0
       HWADDR=XX:XX:XX:XX:XX:XX <- put the MAC of the WiFi Adapter here, you can get it with ifconfig
       
       #   DHCP Version --------------------
       USERCTL=yes
       NM_CONTROLLED=no
       ONBOOT=yes
       BOOTPROTO=dhcp
       #   Fixed IP version ----------------
       #IPADDR=192.168.1.10
       #GATEWAY=192.168.1.1
       #NETMASK=255.255.255.0
       #BOOTPROTO=static
       #   Wireless configuration ----------
       TYPE=Wireless
       MODE=Managed
       #   Settings provided by WPA Supplicant, not needed here
       #ESSID="XXX"
       #RATE=54Mb/s
       IPV6INIT=no
       IPV4_FAILURE_FATAL=no
       IPV6_FAILURE_FATAL=no

Step 4: configure wpa-supplicant

The wpa-supplicant is needed to authenticate into WAP secured networks. If you are using a network without security it is not needed. But hopefully no one is exposing his network, so I document it here for WPA2 encryption.

  • generate the passphrase
       wpa_passphrase "Your Wireless SSID" testpassword > /root/wirelesspassword.conf

now you have in /root/wirelesspassword.conf

       network={
               ssid="Your Wireless SSID"
               #psk="testpassword" <- delete this line since it lists your password in clear text! You do not need it, the passphrase is enough
               psk=5badfeae3f0f83a75f58cb18d2e483c6a72b1f3c13f2b7402747ad0d406b5d30
       }


configure other options in /etc/wpa_supplicant/wpa_supplicant.conf

       -bash-4.2# cat /etc/wpa_supplicant/wpa_supplicant.conf
       ctrl_interface=/var/run/wpa_supplicant
       ctrl_interface_group=root
       country=DE
       mac_addr=0 -> I had once problems with a network that used also MAC Filtering. This helped. 
       preassoc_mac_addr=0 -> I had once problems with a network that used also MAC Filtering. This helped. 
       network={
               ssid="RAC Home"
               proto=WPA RSN -> use WPA2 with AES
               key_mgmt=WPA-PSK
               pairwise=CCMP TKIP
       }


Step 5: autostart the wpa-supplicant and the dhclient

Add the wpa-supplicant and dhclient at the end the ifup script for wireless in /etc/sysconfig/network-scripts/ifup-wireless

       wpa_supplicant -Dwext -iwlan0 -c /root/wirelesspassword.conf -B
       dhclient wlan0

Step 6: ativate the wireless adapter and connect to network

Manually you start it by calling

       -bash-4.2# ifup-wlan0

I start my network in /etc/rc.d/rc.local by explicitely calling ifup wlan0, if it does not start. (too lazy to find out what service does it really and activate it). Please post you questions on the discussion page. Feel free to improve the page if you wish (need to login to the wiki).