Compile Realtek rtl8812AU/8821AU USB WiFi driver on Debian Jessie

Install the driver first from github:

sudo apt-get install git
git clone https://github.com/abperiasamy/rtl8812AU_8821AU_linux
cd rtl8812AU_8821AU_linux
sudo cp -R . /usr/src/rtl8812AU_8821AU_linux-1.0
sudo dkms add -m rtl8812AU_8821AU_linux -v 1.0
sudo dkms build -m rtl8812AU_8821AU_linux -v 1.0
sudo dkms install -m rtl8812AU_8821AU_linux -v 1.0

Test and load the driver:

dkms status
modinfo rtl8812au | egrep 'filen|vers|0811'
sudo modprobe -rfv rtl8812au
sudo modprobe -v rtl8812au
iwconfig
iwlist chan
sudo iwlist scan | egrep -i 'cell|chan|essid|wpa|cipher|qual'

Configure Sublime Editor with KickAss on Debian 8 Jessie

After a long time I got the urge to code something for our bellowed Commodore 64. Since it’s a pain to do it on a real machine, it takes a lot of time to set everything up since I do not have permanent location for my C64 in the apartment.

I decided to use Sublime editor with KickAss and VICE emulator.

Since KickAss is java application you need to make sure you have proper java version to run it. By default Debian 8 (jessie) has openjdk-7-jre and openjdk-7-jre-headless packages installed, which are not compatible with KickAss.

You can check the default java version with command:

# java -version
java version "1.7.0_111"
OpenJDK Runtime Environment (IcedTea 2.6.7) (7u111-2.6.7-1~deb8u1)
OpenJDK 64-Bit Server VM (build 24.111-b01, mixed mode)

If you try to compile any source with this Java version you will get following error:

Exception in thread "main" java.lang.UnsupportedClassVersionError: kickass/KickAssembler : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)

First thing you need to do is to install jdk-8 with following command:

apt-get install openjdk-8-jre

If you do not remove old java version it will still be the default one used on your system.

In order to use your newly installed Java 8 you need to update alternatives with command:

# update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 auto mode
1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1069 manual mode

Press enter to keep the current choice[*], or type selection number: 2

After selecting Java 8 and pressing enter you will get confirmation message:

update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in manual mode

Check if correct java version is configured:

$ java -version
openjdk version "1.8.0_102"
OpenJDK Runtime Environment (build 1.8.0_102-8u102-b14.1-1~bpo8+1-b14)
OpenJDK 64-Bit Server VM (build 25.102-b14, mixed mode)

Next thing you need is to install Sublime Text Editor. Since there is no package for Debian, you can use Ubuntu package, by downloading it from following link amd64 (64bit) or i386 (32bit). Or visit Sublime homepage by clicking this link.

Install the package manually with:

dpkg -i sublime-text_build-3126_amd64.deb

Download Kick Assembler from http://theweb.dk/KickAssembler/ and extract it to any path you like. In my case the path to the file is: ~/C64/bin/.

You need to update your CLASSPATH variable, which is not set by default in Debian so you need to append this to your ~/.bashrc file:

CLASSPATH=~/C64/bin/KickAss.jar:$CLASSPATH
export CLASSPATH

Remember you need to re-login or start new shell window in order to get this loaded. You can check by echoing $CLASSPATH:

$ echo $CLASSPATH
/home/erol/C64/bin/KickAss.jar:

After this is done install VICE emulator by using standard apt-get command:

apt-get install vice

Start sublime editor by running command:

subl

When Sublime is started install Package Control by pressing CTRL+` and paste this to console window part:

import urllib.request,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' + '1e3d39e33b79698005270310898eea76'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by) 

More info about this procedure you can find on this page.

From Preferances > Package Control chose Install Package and type KickAss then select Kick Assembler (C64) .

Make sure KickAssembler (C64) is selected as Build System:

kickass4

You can first check if KickAss is working by compiling one of the provided examples in my case path where KickAss is installed is “C64/bin/KickAss.jar” so the command looks like this:

java -jar C64/bin/KickAss.jar C64/bin/Examples/01.MusicIrq/MusicIrq.asm
//------------------------------------------------------
//------------------------------------------------------
// Kick Assembler v4.3 by Mads Nielsen
//------------------------------------------------------
//------------------------------------------------------
parsing
flex pass 1
flex pass 2
flex pass 3
Output pass

Memory Map
----------
$0801-$080d Basic
$080e-$080d Basic End
$1000-$2290 Music
$4000-$405e Main Program

Writing file: C64/bin/Examples/01.MusicIrq/MusicIrq.prg
Writing Symbol file: C64/bin/Examples/01.MusicIrq/MusicIrq.sym

Now load that same file in Sublime and press CTRL+B. Output in the lower part of the screen should be same as the above.

kickass2

If you selected to run it after compilation program will run in your X64 emulator (VICE).

kickass3

UPDATE: I found an easier way to setup CLASSPATH variable before starting the sublime editor. Just edit the icon for sublime editor and prefix it to look like this:

export CLASSPATH=/home/erol/C64/bin/KickAss.jar;/opt/sublime_text/sublime_text %F

With this you do not need to edit your .bashrc if you are going to start the editor via shortcut icon.

Use two wireless network interfaces on Raspberry Pi 3

Recently I have made some physical changes to my home network. Moved the WiFi router to a more central position to get better coverage, but that meant also my main media player running Xbian could no longer be connected via Ethernet cable, but had to switch to WLAN.

Well wireless adapter on Pi3 is ok for basic stuff, but it does not have good antenna to achieve better network quality or it could run at least 150Mbits which I required.

I remember I had couple of Realtek 300Mbit USB sticks bought long time ago that I was not using. Everything was OK when I switched from cable to WLAN1 (let’s call this my Realtek Card, WLAN0 is the built-in RPi3).

At that time my WLAN0 was disabled, since I was not using it by blacklisting the modules in /etc/modprobe.d/xbian.conf

alias char-major-89 i2c-dev

blacklist evbug
#blacklist brcmfmac
#blacklist brcmutil

As soon as I wanted to use both WLAN0 and WLAN1, my WLAN1 stopped working. Device was detected, module was loaded, but no wlan1 device was created.

I searched for such issue and found something similar with proposed fixes, so I tested it and surprisingly it works.

Main thing is the order of loading the kernel modules. Because if RPi3 built-in adapter loads first you will have an issue where wlan1 will not appear. You need to plug out / in the USB adapter to get it recognized or to remove and insert the kernel r8712u module.

Easiest way to fix the issue for me was to add these 3 lines to /etc/modules at the end of the file:

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

uinput
i2c-bcm2708
i2c-dev
r8712u
brcmfmac
brcmutil

This meant that my Realtek card will get detected before the built in one and therefore it will have the wlan0 name and wlan1 will be rpi3 adapter.

Because your device names are also created in /etc/udev/rules.d/70-persistent-net.rules you need to make appropriate changes there to change built-in adapters name to wlan1 and USB adapter to wlan0:

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# USB device 0x:0x (smsc95xx)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="b8:27:eb:04:64:20", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# Unknown net device (/devices/platform/soc/3f300000.mmc/mmc_host/mmc1/mmc1:0001/mmc1:0001:1/net/wlan0) (brcmfmac_sdio)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="b8:27:eb:54:24:45", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan1"

# USB device 0x:0x (r8712u)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:a1:b0:42:56:4c", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

Reboot and you should have both adapters working with external one as wlan0 and built-in one as wlan1.

Vitality #3 by Albion Crew

vitality3

In order to document all the stuff I have done during my C64 era, I am trying to collect all the works.

One of them is an article I wrote for a magazine done by Albion Crew from Poland.

It was long time ago. To be precise in 1997 I wrote an article for Vitality disk magazine for Commodore 64. It was about spectacular U2 concert in Sarajevo held couple of years after the war in Bosnia & Herzegovina.

If you want to read the whole artice I wrote you can download the magazine from this link.

Mirror link to CSDB.