Apr 272014

Starting from today, we are offering free (uninsured) shipping to the United Kingdom for all products in our new international shop:



Get your unique British Edition kit now Smile! It sports our 16 GB pi.card half-size SD card as additional unique feature!


We will be adding a choice of additional kits with British power supply units, soon.

Apr 212014

This is heavily based on this Wiki entry. Go there to read more about the background of toolchains.

As a quick summary for you: we want compilation to be faster than on the Raspberry Pi. MUCH faster.

Set up crosscompiling

Create / use an Ubuntu machine. I use 12.04 LTS.

You can check your Ubuntu version with lsb_release –a

Run the commands:

sudo add-apt-repository ppa:linaro-maintainers/toolchain

This will add the linaro toolchain repository.

sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"

This will add the universe repository and all other available repositories (universe being the one we need additionally).

aptitude update

To get the contents from the repositories. Now install the crosscompiling toolchain:

apt-get install gcc-arm-linux-gnueabi

dpkg -L gcc-arm-linux-gnueabi

This will show the location of the newly installed libraries.

Official note:

Note that this toolchain defaults to ARMv7 with Thumb2. If you want to use it for older processors you have to add “-marm” into CFLAGS.

Apr 212014

First of all, remove xpra and cython if you had them installed:

aptitude purge xpra cython

Update your package lists, as we are going to install a lot of packages:

aptitude update

Prepare required prerequisites

Then follow the instructions on the xpra Wiki for building Ubuntu / Debian style:

apt-get install libx11-dev libxtst-dev libxcomposite-dev libxdamage-dev \ python-all-dev python-gobject-dev python-gtk2-dev

apt-get install xvfb xauth x11-xkb-utils
apt-get install libx264-dev libvpx-dev libswscale-dev libavcodec-dev

The file mentioned in the how-to, vpx.pc should exist:

cat /usr/lib/pkgconfig/vpx.pc

You will need to install and compile Cython from sources, as the version in the Raspbian repository is too old (0.15.1 vs. 0.16 minimum needed).

wget http://www.cython.org/release/Cython-0.20.1.tar.gz
tar -xzf Cython-0.20.1.tar.gz

change into the newly extracted directory. Install cython:

python setup.py install

This will take quite a while. Test that you have the correct cython version:

cython --version

should yield Cython version 0.20.1

Download and extract source

wget https://www.xpra.org/src/xpra-0.12.3.tar.bz2
tar -xjf xpra-0.12.3.tar.bz2

Note: there may be a newer package, check, please.

Change into the extracted directory. We need to apply a patch:

patch < patches/old-libav.patch

Enter xpra/codecs/dec_avcodec/decoder.pyx as the file to patch

Next patch (several files in one go):

patch < patches/old-libav-pixfmtconsts.patch

Simply copy and paste the “Index file” the patcher asks for, for example xpra/codecs/csc_swscale/colorspace_converter.pyx

Next patch (also several files):

patch < patches/old-libav-no0RGB.patch

Act like above (copy & paste file name, without leading / ).

It also contains a useful README, which tells you the next step is:

./setup.py install --home=install

After the compilation is done, you should either (always) set the Pythonpath to include the install subdirectory, like this:

export PYTHONPATH=$PWD/install/lib/python:$PYTHONPATH

or install the “finished” files to the appropriate targets. From the install directory do:

cp bin/* /usr/bin/.
cp -R lib/* /usr/lib/.
cp -R share/* /usr/share/.

xpra will now be the newest version:

xpra –version

xpra v0.12.3

You will still have to set the PYTHONPATH to the new files in /usr/lib/python, though:

The PYTHONPATH environment variable needs to be set:

export PYTHONPATH=/var/lib/python:$PYTHONPATH


Test & Test results

OK, here’s how to set up a test session:

Set up a test server, which has xpra installed (you can install it through the winswitch packages, will get you the newest xpra version on Ubuntu & Debian)

Start X Windows, open LXTerminal, run the following commands.

export PYTHONPATH=/var/lib/python:$PYTHONPATH

Start an xpra session via SSH (can be killed using Ctrl-C, and reconnected to using the same command):

xpra start ssh:maxcs@ –start-child=xterm –encoding=h264

Read the manpage (man xpra) to have a look at some other options

Test results


rgb, png encodings are too high-latency.

jpeg is barely usable, even when resizing the application (for instance Abiword) to not full-screen usage.

webm encoding delivers worse quality, but seems a bit more usable

h264 decoding is NOT done in hardware in the default code (we’ll look into this). Surprisingly it is still the “most fluid to use” one.

I suspect that no decoding in H.264 is taking place, and server side xpra falls back to a different encoder (webm?) Anyways, one can even “watch” videos (a couple of frames each second with heavy artifacts) with this.

For very light administration / checking of remote contents, etc. xpra can be used as is. We will need to enable hardware decoding of h264, though, for it to yield real benefits.

Please note: our interests solely rest in streaming TO the Raspberry Pi, not FROM the Raspberry Pi – we will not test / patch in order to speed up administration of the Pi at this point.


Notes & Further reading

Dependencies of xpra package:

(you can show this using “apt-cache showpkg xpra” on a machine which has the package in the newer version, e.g. Ubuntu AMD64):

0.12.3-1 – python2.7 (0 (null)) python (2 2.7.1-0ubuntu2) python (3 2.8) libavcodec53 (18 4:0.8-1~) libavcodec-extra-53 (2 4:0.8-1~) libavutil51 (18 4:0.8-1~) libavutil-extra-51 (2 4:0.8-1~) libc6 (2 2.14) libgtk2.0-0 (2 2.24.0) libswscale2 (18 4:0.8-1~) libswscale-extra-2 (2 4:0.8-1~) libvpx1 (2 1.0.0) libx11-6 (0 (null)) libx264-120 (0 (null)) libxcomposite1 (2 1:0.3-1) libxdamage1 (2 1:1.1) libxext6 (0 (null)) libxfixes3 (0 (null)) libxrandr2 (2 4.3) libxtst6 (0 (null)) python-gtk2 (0 (null)) x11-xserver-utils (0 (null)) xvfb (0 (null)) python-gtkglext1 (0 (null)) python-opengl (0 (null)) python-numpy (0 (null)) python-imaging (0 (null)) python-appindicator (0 (null)) openssh-server (0 (null)) python-pyopencl (0 (null)) pulseaudio (0 (null)) pulseaudio-utils (0 (null)) python-dbus (0 (null)) gstreamer0.10-plugins-base (0 (null)) gstreamer0.10-plugins-good (0 (null)) gstreamer0.10-plugins-ugly (0 (null)) python-gst0.10 (0 (null)) openssh-client (0 (null)) ssh-askpass (0 (null)) python-numeric (0 (null)) python-lz4 (0 (null)) keyboard-configuration (0 (null)) xpra:i386 (0 (null))


Optional: install checkinstall, to create a package which you can easily remove or re-deploy to other computers:

aptitude install checkinstall




error: implicit declaration of function ‘avcodec_free_frame’

you need to apply the patch patches/old-libav.patch

error: ‘AV_PIX_FMT_YUV420P’ undeclared

you need to apply the patch patches/old-libav-pixfmtconsts.patch

error: ‘PIX_FMT_0RGB’ undeclared

you need to apply the patch patches/old-libav-no0RGB.patch

The other patches were NOT needed in my experimental compilation.


ImportError: No module named xpra.platform

Once you try to execute xpra (from LXTerminal preferably), you may get this message. The PYTHONPATH environment variable needs to be set:

export PYTHONPATH=/var/lib/python:$PYTHONPATH

Apr 202014

We’re working on streaming a multimedia remote desktop to the Raspberry Pi.

In the future we envision, you shall be able to use a webbrowser on the Pi at normal speeds – including YouTube videos, etc. – operate with CPU / GPU intensive applications – as all the processing is done on a server, and just the H.264 stream rendering on the Raspberry Pi.

First steps

A very interesting application stack to serve this purpose is already available: WinSwitch & xpra

Look at the WinSwitch homepage for installation instructions – it is really quite easy.

WinSwitch bundles several remote clients (VNC / xpra / RDP) with an easy-to-use interface, and broadcasts servers / clients (via Avahi / Bonjour).

A very first demonstration of the capabilities of this stack can be obtained installing WinSwitch on your “normal” desktop machine, and on a server.


As a server we currently use the “fastest available” Intel Atom processor currently on the market –  Intel(R) Atom(TM) CPU  C2750. We are looking into using AMD’s ARM 64 bit processor as server hardware in the future (power-efficiency!), and the performance should be roughly comparable.


As a client we use a Dell Inspiron notebook (with Windows 8.1), Core i7 processor, FullHD resolution.

There is a xpra package available for the Raspberry Pi, which is based on a quite old version of xpra, and will not connect to our server. This may be related to the huge version difference between the two packages, wrong setup, or special tweaking done by winswitch to xpra.

Test results

YouTube videos

We can stream a webbrowser running YouTube fullscreen in FullHD, which will use about 50 % of the server’s total resources (decoding one or several videos in FullHD, encoding one FullHD stream). This is possible in low-latency, at about 30fps and high quality. Yes, this does include an audio stream, too.

The stream uses about 40 Mbp/s of bandwidth, and is much more reliable (less choppy) if streamed over LAN, instead of WLAN. In fast-moving scenes video will still be a bit choppy, but tolerably.

The encoding is done in software, using x264.

Streaming ONE browser window is possible with our server hardware in good quality (for video content) from either the host directly, or from a virtual Ubuntu machine (KVM-virtualized) inside it.

TWO browser windows will start to degrade the quality, even if trying to force best quality and lowest latency.


This screenshot shows the YouTube video in the browser being streamed on the client.

Application streaming

Winswitch allows you to stream single applications. Performance / latency is very good on a local network, keyboard / mouse delay is barely noticeable.

In general, applications will be quite useable and seem responsive.

Applications requiring precise mouse / screen cordination, like graphics software will not be usable (at least with our hardware setup).


This screenshot shows Firefox being streamed through xpra.


VLC media player being streamed – sound works


GIMP: barely usable (too much delays)


word processing with AbiWord: OK performance (could be better, but it’s usable)


Desktop streaming

Streaming a desktop with xnest / Xephyr / xpra from inside a virtualised Ubuntu container on the base hardware is NOT possible at low-latency (30 fps) with high-quality. (With our server hardware)

In order to test it, you have to install additional packages on the server:

aptitude install xnest xserver-xephyr

and set the desktop default to xpra, possibly after restarting the server / client:


Apparently frame-grabbing / mirroring the desktop / going through the X layer uses up much more processor resources.


Gameplay is quite smooth – but full screen video playback would be a problem.

Some hints

  • authentication with private/public key pairs may be problematic without additional configuration, for first tests I recommend to re-enable password login for SSH.
  • audio for the browser may require alsa and pulseaudio
  • This does not work on the Raspberry Pi yet, this is our next step (compiling a package for it).



  • encoding performance and latency may be enhanced significantly using NVidia’s NVENC hardware encoding / framegrab API – which xpra supports.
Apr 192014

libavg is a German project to ease the building of multimedia applications – this can be anything from a movie / touch interface installation in a museum to a quick demo of a future application you throw together yourself, before (if needed) delving into “hardcore” programming.

libavg supports a variety of text, graphics, audio and video output, and a variety of input possibilities (e.g. multitouch). Have a look at their showcase to see some of the possibilites.

Luckily for us, libavg has been ported and optimized for the Pi, and they provide a pre-compiled package.


Follow the instructions on https://www.libavg.de/site/projects/libavg/wiki/RPI for installing the tarball (see link at the bottom of the page, which you can “wget”.

There are also instructions for compiling from source, using QEMU, on that page.


After installation, you can test libavg with the classic “hello world” program.

Please refer to this page https://www.libavg.de/site/projects/libavg/wiki/HelloWorld for the source.

One gotcha: X Windows needs to be running in order for the program to execute. (“startx”). Else the software will complain:

RuntimeError: No available video device


Video playback is NOT hardware accelerated on the Pi currently with libavg.  In my test a H.264 encoded low-res movie was played at normal speed, but seemed quite choppy. Audio was OK. Decoding and rendering happens via the CPU (as per the “node” idea – combining multiple videos / other nodes for output), which maxes it out. The same video works fine using omxplayer, though.

In this blog article the team announces intentions to work on OpenMax IL integration. In the same article, a comment states that as per January of 2014 there has been no work done in this area, lacking necessary manpower & knowledge resources for the development.


libavg has an extensive documentation, for instance this page for area nodes (including the video node).

It also has a blog, with some interesting entries, for example:

Video decoding using libav and ffmpeg – detailing some of the problems behind video decoding in general, and libav/ffmpeg in particular.

Apr 042014

This is a quick introduction how to calibrate our touchscreen.


I freely admit this is heavily based on Adafruit’s tutorial – I hope we will be able to return the favour for you guys one day!

I suggest for you to run the commands in the following tutorial in a separate SSH shell, opened from an additional computer (why not simply buy a second Raspberry Pi from you-know-whom?) .

Also, the commands in this tutorial are supposed to be run as root! –> “sudo su” gets you into the root user from the pi user.

Some background information:

Our touchscreen is based on the ADS7843 (compatible with ads7846 driver) chip, which you can see being activated (on our image) by calling lsmod:

sudo lsmod

Module                  Size  Used by
fuse                   76348  3
evdev                   9407  4
joydev                  9084  0
ads7846                 7849  0
ads7846_device          6049  0
spi_bcm2708             4728  0
snd_bcm2835            16165  0
snd_soc_bcm2708_i2s     5474  0
regmap_mmio             2806  1 snd_soc_bcm2708_i2s
snd_soc_core          131356  1 snd_soc_bcm2708_i2s
regmap_spi              1897  1 snd_soc_core
snd_pcm                81585  2 snd_bcm2835,snd_soc_core
snd_page_alloc          5156  1 snd_pcm
regmap_i2c              1645  1 snd_soc_core
snd_compress            8108  1 snd_soc_core
snd_seq                53769  0
snd_timer              20133  2 snd_pcm,snd_seq
snd_seq_device          6473  1 snd_seq
leds_gpio               2059  0
led_class               3688  1 leds_gpio
snd                    61299  7 snd_bcm2835,snd_soc_core,snd_timer,snd_pcm,snd_seq,snd_seq_device,snd_compress


This driver “delivers” the finished information to the device /dev/input/event0 – you can verify this by doing

sudo cat /dev/input/event0

and touching the touchscreen (preferably with our stylus!) – it will spew out a garble of binary information on each touch. Use Ctrl + C to terminate the command.

Note: If this command does not react to input from the touchscreen, try moving your mouse / typing on the keyboard you’ve attached to the Raspberry Pi –> it may be assigned differently on your system. Adjust the following commands accordingly … !


Our touchscreen is set up as framebuffer device 1 – you can test this like this:

cat /dev/zero > /dev/fb1

Will turn your little screen black (and give you an error message to go with it, free of charge, naturally).


Tslib is a library which serves as common abstraction layer for events on touchscreens. It includes filters (for instance for smoothing the events and calibrating).


Install the touchscreen utilities (Tslib):

aptitude install libts-bin

This will create a configuration file, /etc/ts.conf, which you might want to modify some day (have a look at the manpage first, maybe).

In order to use ts_calibrate and ts_test, you need to set environment variables.

export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_FBDEVICE=/dev/fb1

This will set them temporarily for the current user and current console you’re working on.

Then, start the calibration process:


This will show a screen with a crosshair. And instructions.

Touch the crosshair’s center with your stylus. Repeat the procedure, until the software exits.

The calibration data will be shown on your console. It will look something like this:

xres = 320, yres = 240
Took 16 samples…
Top left : X = 3110 Y =  934
Took 6 samples…
Top right : X =  696 Y =  979
Took 14 samples…
Bot right : X =  711 Y = 3163
Took 10 samples…
Bot left : X = 3161 Y = 3115
Took 8 samples…
Center : X = 1915 Y = 2070
330.695190 -0.090429 0.001365
-13.946960 0.001227 0.064123
Calibration constants: 21672440 -5926 89 -914028 80 4202 65536


This data will be written to the calibration file /etc/pointercal :

root@raspberrypi:/home/pi# cat /etc/pointercal
-5926 89 21672440 80 4202 -914028 65536536


You can test the calibration using


This will display a crosshair for you to move and drag around. You can also switch to drawing mode, and draw something.

Do not forget to set up the environment variables, if you run the command from another console.


X-Calibration and further knowledge

Please refer to Adafruit’s tutorial. The section on calibrating X is also applicable to our display.

The symlinking of the input device (/dev/input/event0 to /dev/input/touchscreen) mentioned in the tutorial will not work with our touchscreen and it’s current driver, the command has to be modified for that.



Evtest can help you to troubleshoot device input.

Install it using

aptitude install evtest

run it on the device you want to test, e.g. what the touchscreen should default to:

evtest /dev/input/event0

This will show you more information than the crude “cat” test suggested at the beginning of this article. It will also allow you to see keyboard events from your keyboard if you have one attached to the Pi (use /dev/input/event1 if you attached it as first USB device, before a different input device).



/dev/touchscreen/ucb1x00: No such file or directory

This error message will show, if you did not set the environment variables. Keep in mind, that you either have to set them manually from each (!) console / user (!) you open or operate as, or permanently in the appropriate location.

Check which environment variables are set by using:


you should see


amongst the other output.



ts_open: No such file or directory

This error message will show, if you did not set the environment variables. Keep in mind, that you either have to set them manually from each (!) console / user (!) you open or operate as, or permanently in the appropriate location.

Check which environment variables are set by using:


you should see


amongst the other output.

 Posted by at 10:37 pm
Apr 032014

What is this about?

How to set up a Raspbian system as a read-only system in a couple of easy steps.


This penguin has been doing a lot of reading as of lately.

Why is this of interest to me?

The filesystem on the Raspberry Pi’s SD card, as every filesystem on every computer, can be corrupted if you disconnect the power suply.

Once you make the filesystem read-only (all changes go to a RAM-Disk), you will be able to disconnect the power supply whenever you want.

An additional bonus is less wear on the SD card – sometimes you do NOT want the logfiles which a standard Linux / Raspbian will write to anyway. Our solution will write those to a RAM-Disk and discard them on reboot / power cycling.

Last but not least, you can set up a known state to boot into, experiment, and if things go wrong, simply reboot.

How-To make Raspbian read-only

all commands to be run as root (sudo su) if not specified otherwise.

This how-to is based on another how-to I found on the Internet, in German. Thanks guys!

Disable swap

dphys-swapfile swapoff
dphys-swapfile uninstall
update-rc.d dphys-swapfile disable

Install UnionFS

UnionFS is an overlaying filesystem (you can mount from several different locations into the same folder). In case of collisions, UnionFS uses priorities for the filesystems. It is frequently used to create RAM-Disk Overlays for read-only systems, for instance also with Live CDs.

aptitude install unionfs-fuse

Create mount script

nano /usr/local/bin/mount_unionfs

Add the following content to this file:

 ROOT_MOUNT=$(awk '$2=="/" {print substr($4,1,2)}' < /etc/fstab)
 if [ $ROOT_MOUNT = "rw" ]
   /bin/mount --bind ${DIR}_org ${DIR}
   /bin/mount -t tmpfs ramdisk ${DIR}_rw
   /usr/bin/unionfs-fuse -o cow,allow_other,suid,dev,nonempty ${DIR}_rw=RW:${DIR}_org=RO ${DIR}

make it executable:

 chmod +x /usr/local/bin/mount_unionfs

Update /etc/fstab:

nano /etc/fstab

Modify the file to read (adjust partitions for NOOBS!) as follows:

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    ro                0       2
/dev/mmcblk0p2  /               ext4    ro,noatime        0       1
mount_unionfs   /etc            fuse    defaults          0       0
mount_unionfs   /var            fuse    defaults          0       0
none            /tmp            tmpfs   defaults          0       0

Prepare the directories

cp -al /etc /etc_org
mv /var /var_org
mkdir /etc_rw
mkdir /var /var_rw

At this point your Raspberry Pi should be read-only already. You can verify this with


This command should show something like the following:

/dev/root on / type ext4 (ro,noatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=215824k,nr_inodes=53956,mode=755)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=44820k,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=89620k)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)
/dev/mmcblk0p1 on /boot type vfat (ro,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
ramdisk on /etc_rw type tmpfs (rw,relatime)
unionfs-fuse on /etc type fuse.unionfs-fuse (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
ramdisk on /var_rw type tmpfs (rw,relatime)
unionfs-fuse on /var type fuse.unionfs-fuse (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other)
none on /tmp type tmpfs (rw,relatime)

This indicates to you that the filesystems are mounted read-only and unionfs is active.

Clean up the Log directory

mount -o remount,rw /
for f in $(find . -name \*log); do > $f; done
cd /var_org/log
rm -f *.gz


Another reboot and you’re done!


How-To Install additional Packages after “read-only-modding”

You’ve got to remount the root filesystem as readable. For instance, as root, you can do:

mount -o remount,rw /
aptitude update
aptitude install stress
Optimization WordPress Plugins & Solutions by W3 EDGE