Monthly Archives: May 2013

Compile and install driver for TP-Link TL-WN725N version 2 in Raspbian

NOTICE!

This module is now deprecated as for kernel >= 3.10.0. If you update with rpi-update the module will stop working. Linux kernel 3.12 now has built-in support for this wifi dongle.

Compiling the kernel module for this wifi device takes quite long (30 minutes more or less). If you don’t want to wait follow the instructions in how to install TP-Link TL-WN725N version 2.

git clone https://github.com/liwei/rpi-rtl8188eu.git
git clone --depth 1 git://github.com/raspberrypi/linux.git rpi-linux
git clone --depth 1 git://github.com/raspberrypi/firmware.git rpi-firmware
cd rpi-linux
make mrproper
zcat /proc/config.gz > .config
make modules_prepare
cp ../rpi-firmware/extra/Module.symvers .
cd ../rpi-rtl8188eu
CONFIG_RTL8188EU=m make -C ../rpi-linux M=`pwd`
sudo rmmod 8188eu
sudo install -p -m 644 8188eu.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless
sudo depmod -a
sudo modprobe 8188eu

This wifi dongle comes with a small LED that blinks when it is active. By default this driver doesn’t use it. If you want it to be active edit the rpi-rtl8188eu/include/autoconf.h file and uncomment this line:

#define CONFIG_LED

This module also is very verbose at boot time because it has a debug flag defined. To get rid of those messages comment this line:

#define CONFIG_DEBUG_RTL819X

This is the 8188eu.ko I compiled myself from liwei repo for 2013-02-09-wheezy-raspbian with kernel Linux 3.6.11+.
This is the 8188eu.ko I compiled myself from liwei repo for 2013-09-25-wheezy-raspbian with kernel Linux 3.6.11+.

Source: https://github.com/liwei/rpi-rtl8188eu
http://bitacora.eniac2000.com/?p=3439

TP-Link TL-WN725N version 2 in Raspberry Pi

Version 2 of TP-Link TL-WN725N driver doesn’t come by default in Raspbian so it won’t work by just plug-ining it in.

You can compile the driver by yourself (slow) or just download an already compiled one and install it.

UPDATE!
Due to the problems people has been having with the error “ERROR: could not insert ’8188eu’: Exec format error.” I’ve compiled and tested the driver for both 2013-02-09-wheezy-raspbian and 2013-09-25-wheezy-raspbian for kernel 3.6.11+.

2013-02-09-wheezy-raspbian kernel 3.6.11+:
http://tech.enekochan.com/wp-content/uploads/2013/rtl8188eu/liwei/2013-02-09-wheezy-raspbian-3-6-11/8188eu.ko
2013-09-25-wheezy-raspbian kernel 3.6.11+:
http://tech.enekochan.com/wp-content/uploads/2013/rtl8188eu/liwei/2013-09-25-wheezy-raspbian-3-6-11/8188eu.ko

wget http://tech.enekochan.com/wp-content/uploads/2013/rtl8188eu/liwei/2013-09-25-wheezy-raspbian-3-6-11/8188eu.ko
sudo install -p -m 644 8188eu.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless
sudo depmod -a
sudo modprobe 8188eu

You’ll probably want your Raspberry PI to connect to the wifi on boot. In that case edit /etc/network/interfaces to configure the SSID and the password of your wifi network:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
auto wlan0

iface wlan0 inet dhcp
        wpa-ssid "ssid"
        wpa-psk "password"

Test it by turning down and up the connection and verifying with ifconfig that wlan0 now has an IP:

sudo ifdown wlan0
sudo ifup wlan0
ifconfig

If you see this messages don’t worry as far as everything works OK (I don’t know why those happend but the connection works anyway):

ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument

Previously I had been using the Wifi Config (wpa_gui) application to configure my wifi network settings under the desktop environment. This application automatically configures /etc/network/interfaces and /etc/wpa_supplicant/wpa_supplicant.conf files:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
       ssid="XXXX"
       psk="XXXXXXXXXXXX"
       proto=RSN
       key_mgmt=WPA-PSK
       pairwise=CCMP
       auth_alg=OPEN
}

But it stoped working with the lastest version of the driver.

If you use this method and want to force wpa_supplicant to reconnect to the wifi just run this:

sudo wpa_supplicant -Dwext -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf

I also had to configure the DNS servers to be able to resolve names from the internet. This is done by editing the /etc/resolv.conf file. Just add your DNS servers (usually your ISP gives you those IPs) or use 8.8.4.4 and 8.8.8.8 (DNS servers from Google):

nameserver 8.8.4.4
nameserver 8.8.8.8

Source: http://blog.pi3g.com/2013/05/tp-link-tl-wn725n-nano-wifi-adapter-v2-0-raspberry-pi-driver/
https://www.zhujunsan.net/index.php/2013/03/make-tp-link-tl-wn725n-v2-work-on-raspbian/
http://learn.adafruit.com/adafruits-raspberry-pi-lesson-3-network-setup/setting-up-wifi-with-occidentalis

Fix black screen in Raspberry Pi with HDMI to VGA adapter

If you use an HDMI to VGA adaptor and get a black screen you may tweak the config.txt to solve the problem.

HDMI-VGA

If you open config.txt you will see that there are plenty of lines commented out that change the behavior of the HDMI output in the Raspberry Pi. This is the configuration that made my Raspberry Pi work OK using an HDMI to VGA adapter at 1920×1080 resolution:

disable_overscan=1
hdmi_group=1
hdmi_mode=16
hdmi_drive=2

hdmi_group defines the HDMI type (Not specifying the group, or setting to 0 will use the preferred group reported by the edid):

  • hdmi_group=1 – CEA
  • hdmi_group=2 – DMT

hdmi_mode defines screen resolution in CEA or DMT format.

hdmi_drive chooses between HDMI and DVI modes:

  • hdmi_drive=1 – Normal DVI mode (No sound)
  • hdmi_drive=2 – Normal HDMI mode (Sound will be sent if supported and enabled)

If you want to know which modes (hdmi_mode) are suported by your screen comment the lines for those 4 options (thus leaving all with their default values), reboot and the run those commands:

For hdmi_group=1 available modes:

sudo /opt/vc/bin/tvservice -m CEA

For hdmi_group=2 available modes:

sudo /opt/vc/bin/tvservice -m DMT

See all available options at http://elinux.org/RPi_config.txt

Source: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=76&t=33477

Find the library or program that installs a specific file with apt-file

Sometime you could end up in a situation where you need to know which program or library installs a file. That happened to me while installing redmine. I got an error telling me that it couldn’t find the MagickWand.h file. apt-file tells you the library you need to install to get that file.

$ sudo apt-get install apt-file
$ sudo apt-file update
$ apt-file search MagickWand.h
imagemagick-doc: /usr/share/doc/imagemagick/www/api/MagickWand/struct__MagickWand.html
libmagickwand-dev: /usr/include/ImageMagick/wand/MagickWand.h

Thus I installed libmagickwand-dev and the problem went away:

sudo apt-get install libmagickwand-dev

Solve “The Alias directive in … will probably never match because ir overlaps an earlier Alias”

This is a warning that happens when starting Apache2.

$ sudo service apache2 restart
 * Restarting web server apache2                                                [Wed May 08 11:55:52 2013] [warn] The Alias directive in /etc/phpmyadmin/apache.conf at line 3 will probably never match because it overlaps an earlier Alias.
 ... waiting [Wed May 08 11:55:54 2013] [warn] The Alias directive in /etc/phpmyadmin/apache.conf at line 3 will probably never match because it overlaps an earlier Alias.
                                                                         [ OK ]

It is caused because the configuration for phpMyAdmin is loaded 2 times: in /etc/apache2/conf.d/phpmyadmin.conf and /etc/apache2/apache2.conf with an include to /etc/phpmyadmin/apache.conf.

To get rid of this warning just comment out this line in /etc/apache2/apache2.conf:

Include /etc/phpmyadmin/apache.conf