Setup USB wi-fi adapter on linux

Purpose: connecting a developer computer board (cubieboard2) to the Internet by means of wireless connection. The already installed Linux distribution does not have a proper driver for the device.

Used tutorials and sources of information

https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=44044
http://askubuntu.com/questions/16584/how-to-connect-and-disconnect-to-a-network-manually-in-terminal
http://askubuntu.com/questions/138472/how-do-i-connect-to-a-wpa-wifi-network-using-the-command-line

Check for device detection:
1: lsusb
2: lsmod -> see what drivers are installed for a given device
3: dmesg | grep 819 (819 is the version of the driver)

Example output:
rtl8192cu: Chip version 0x11
rtl8192cu: MAC address: 14:cc:20:20:d9:b9
rtl8192cu: Board Type 0
rtl8192cu: Loading firmware rtlwifi/rtl8192cufw.bin
usbcore: registered new interface driver rtl8192cu
rtlwifi: Firmware rtlwifi/rtl8192cufw.bin not available
Error: Driver ‘rtl8192cu’ is already registered, aborting…

***Notice rtl8192cu: Loading firmware rtlwifi/rtl8192cufw.bin
-> Firmware is needed
source for the file:
https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/rtlwifi

Firmware directory: /lib/firmware/name-of-driver

mkdir /lib/firmware/RTL8192CU
or
mkrdir rtlwifi

mkdir /lib/firmware/RTL8192CU

cd /lib/firmware/RTL8192CU

wget https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/rtlwifi/rtl8192cufw.bin

http://ubuntuforums.org/showthread.php?t=1667140
http://ubuntuforums.org/showthread.php?t=1861463&page=11

After reboot:

dmesg | grep 819
PERCPU: Embedded 7 pages/cpu @d3808000 s7616 r8192 d12864 u32768
pcpu-alloc: s7616 r8192 d12864 u32768 alloc=8*4096
rtl8192cu: Chip version 0x11
rtl8192cu: MAC address: 14:cc:20:20:d9:b9
rtl8192cu: Board Type 0
rtl8192cu: Loading firmware rtlwifi/rtl8192cufw.bin
usbcore: registered new interface driver rtl8192cu
Error: Driver ‘rtl8192cu’ is already registered, aborting…

The inbuilt driver needs to be blacklisted.
Add “blacklist rtl8192cu” here: /etc/modprobe.d/blacklist.conf

http://forums.fedoraforum.org/archive/index.php/t-157746.html
_____________________________________________________________

Setting up wireless connection on linux using command line

1) Install wpasupplicant
2) edit/create gedit /etc/wpa_supplicant.conf by adding:

network={
ssid=”ssid_name”
psk=”password”
}

OR

wpa_passphrase SSID PASSWORD > CONFIG_FILE

3) To check for available wi-fi signal: iwlist scan
4) Check the name of the wireless interface: ifconfig or iwconfig

http://askubuntu.com/questions/16584/how-to-connect-and-disconnect-to-a-network-manually-in-terminal

Checking can be done by using ping through a given interface:
ping -I <interface> <website>

From this moment on nothing else of what I tried worked (the device is recognised and I can scan for Wi-Fi networks but I am unable to connect) so I had to use the GUI. I plugged the board in a monitor and used the internet symbol from the desktop GUI of xfce4 to access the Wi-Fi network, configure it (add password) and finally my cubieboard2 was connected by a wireless connection to the Internet.

Useful:

Place on system where repository lists are kept:
/etc/apt/sources.list
/etc/apt/sources.list.d/*.list

To continue using an outdated release then edit /etc/apt/sources.list and change archive.ubuntu.com to old-releases.ubuntu.com.

http://old-releases.ubuntu.com/ubuntu/dists/
https://help.ubuntu.com/community/Repositories/CommandLine