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

Is programming a creative pursuit?

So is programming a creative activity or not? This article offers a good point of view to which I agree.

The ByteBaker

It’s becoming clear that we, as a society, are placing a larger and larger emphasis on innovation and creativity while at the same time bemoaning the lack thereof. There are some activities that we instantly recognize as creative pursuits: painting, music, writing, theatre. And also more modern ones: graphics, web design, info graphics and industrial design, font design and lettering. But when it comes to modern acitivities and professions one of the elephants in the room is programming. The question that’s been on my mind: is programming a creative pursuit?

Programming is problem-solving. It’s about coming up with ways to do things that couldn’t be done before (or at least doing them better). But that’s just the beginning. Once you figure out a way to solve the problem you then create something – a program – that embodies your solution. The program is what goes ahead and solves…

View original post 523 more words

Linux swappiness

Recently I had the brilliant idea of adding a second Linux distribution to my computer and install it along with the already existing W7 and Ubuntu installations. The problem was that I had no extended partitions available and none of the MBR slots were free. I had 2 OSs, a large shared data partition and a swap one. I had to do something so I replaced the shared partition with an extended one and inside I made 2 logical partitions. Also I wanted partitions to be more neatly organised so I had also deleted the swap partition to place it near the Ubuntu one. For this to happen I had to make Ubuntu stop using swap memory. During the past week I noticed strange (very slightly) performance drops (even though I have a reasonable 4 GB of memory) and today I realized I forgot to turn the swap back on (I actually thought Linux would just start using the new one and didn’t bother checking).

While installing a virtual machine on Ubuntu, VMPlayer threw out an error just 1 minute before it died, it was a recommendation to add swap space to the machine.

Terminal part

Turning off swap

sudo swapoff

Turning on swap

sudo swapon -a

And here was the problem.

Error: swapon: cannot find the device for UUID=e6e677c9-5da6-49d5-930c-5210c83356fe

I suppose the config file kept the UUID of the old swap partition that I removed, another clue that pointed to this problem was given by Ubuntu itself. At boot time, while loading the system it used to halt for a few seconds during the purple startup screen and say something like UUID e6e677c9-5da6-49d5-930c-5210c83356fe could not be found – abort mounting or mount manually. I had seen computers before showing such behaviour (at university) but had never knew what was wrong. The config file responsible is /etc/fstab. here I found the UUID for the swap partition and replaced it with the right one.

To find the UUID of the current partitions:

sudo blkid -o list (man page)

sudo vim /etc/fstab

Effect: (viewed with blkid)

/dev/sda6 swap (not mounted) a87bc3d5-d477-460f-8017-131f84fcdfd8

/dev/sda6  swap             <swap>         a87bc3d5-d477-460f-8017-131f84fcdfd8