Deactivate the LEDs of your Radxa Rock

The Rock’s frequently blinking lights can be an annoying source of light pollution. Here is how to turn most of them off. However, the ethernet and wifi leds can only be soldered them out.

On the newer images, the 3 Rock’s LEDs are configured as LED class devices, so edit rc.local

and set them to none using this snippet:

For the older images, the LEDs have to be set via the GPIOs:

make sure that you add those lines before the exit 0 statement in rc.local.

Ubuntu Server Kernel 3.18 on Radxa Rock Pro

If you own a Radxa Rock Pro you have surely had enough trouble with the antiquated 3.0.36 kernel and the many hacked drivers to get it working somehow. Thanks to the work of Heiko Stübner and other kernel developers finally current kernels can be used on this great ARM development board. Keep in mind that video and audio drivers are not mainlined yet. Here is a howto:

Now determine the disk number of your microsd card, unmount the disk and flash the image with dd. Here are the instructions from an OS X perspective:

Make sure you use /dev/rdiskX as raw access is up to 20x faster. After unmounting, you can safely remove the microsd card and put it in your Radxa Rock Pro. You can login with rock/rock:

Next, expand the filesystem with this shell script or manually:

Manually:

When the system is back up again, the filesystem has to be resized to the new partition sizes:

For me that didn’t work out because there were permission issues:

resize2fs 1.42.9 (4-Feb-2014)
Filesystem at /dev/mmcblk0p1 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
resize2fs: Permission denied to resize filesystem

To fix this on OS X install e2fsprogs to get resize2fs:

to avoid replacing some OS X provided files they are not linked into /usr/local.

Unmount the disk:

Check the partition for errors and resize:

For more details on the process see this guide:

First update your locales unless you want lots of locale warnings:

remove apache2 and mysql if you don’t need them:

then upgrade your system and install some frequently used tools:

Now Add a new user:

Log on as the new user an delete the old one:

To easily access all your computers you may want to authenticate yourself with certificates.

On a Mac, first install the missing ssh-copy-id:

Then you can copy your public key to the ssh hosts you frequently need by:

Now configure you ethernet in a way that your MAC won’t change with every restart:

The content should look like:

auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
hwaddress ether 01:02:03:04:05:06

Make sure the hwadress is valid and unique.

To get wlan running:

and add:

ctrl_interface=/var/run/wpa_supplicant
network={
ssid="your ssid name"
psk="your wireless password"
}

If you have several Radxa Rocks, you may want to change their hostnames:

Set up the correct time zone and get a ntp update:

this is important because otherwise the SSL certificates won’t work.

To set up git:

and copy the contents into the ssh keys section of the github preferences.

To configure zsh:

To get AFP filesharing:

Additional folders can be shared by editing AppleVolumes.default:

and adding a line like

/media/microsd/media “Media”

and restarting the netatalk service with:

Compile missing kernel modules for Radxa Rock Pro

If you want to use an Arduino with your Radxa Rock Pro Kernel 3.18 you will need to build some kernel modules by hand. Here is a short howto. Strangely this didn’t work directly on the Radxa Rock Pro so I had to cross compile on a Ubuntu 14.10 system:

Navigate to Device Drivers -> USB Support -> USB Serial Converter Support -> and select USB FTDI Single Port Serial Driver with „m“ and save to .config

Transfer the kernel model to your radxa with a method of your choice and and test them:

If everything works you can install the modules permanently:

then you can load the kernel modules with:

and/or add them permanently to /etc/modules:

Troubleshooting:

You may get an error like:

with dmesg you see:

or you can get more information about the module with:

filename: /home/phoenix/ftdi_sio.ko
license: GPL
description: USB FTDI Serial Converters Driver
author: Greg Kroah-Hartman <@.>, Bill Ryder <@.>, Kuba Ober <@.>, Andreas Mohr, Johan Hovold <@.>
alias: usb:v0403pD012d*dc*dsc*dp*ic*isc*ip*in*
depends: usbserial
vermagic: 3.19.0-rc5+ SMP mod_unload ARMv7 p2v8
parm: ndi_latency_timer:NDI device latency timer override (int)

In my case you can see the problem was that the default kernel is only:

So I should have gotten an older source…

Persistent names for usb-serial devices

Many usb-serial devices appear as /dev/ttyUSBX or /dev/ttyACMX in the system, the link changing every time several of these devices are plugged in. This is unsatisfying if you want to access these devices from a script. One solution is to use a UDEV ruleset to make a symbolic link for each device. Here is how to do it.

Determine vendor and product id of the usb-serial device:

Determine serial number of the device:

Create a UDEV ruleset that makes a symbolic link for each device:

sudo nano /etc/udev/rules.d/99-usb-serial.rules

and add and adapt to your needs:

SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="DAE0011W", SYMLINK+="1wire"

after replugging the device, there will be a symbolic link ‚1wire‘ be created for your device.

Time Capsule Disk Upgrade

My Apple Time Capsule 1TB MC343Z/A 3rd Gen Model A1355 Firmware 7.6.4 has gotten too small for all the backups and files, so it was time for an upgrade. As Time Capsules are still terribly expensive in the larger versions, I went for the DIY upgrade. Judging from some forum posts, the Western Digital RED line for NAS is compatible and suitable. In the end I settled for the WD40EFRX. I went with this rough guide although there is a much more detailed iFixit guide available. The most complicated part is getting the rubber from the base (I ripped mine a little so take your time), the rest is just trivially done in 10 minutes. After everything is done, AirPort Utility will alert you with a warning that a drive needs a repair. Under drives select the partition and select delete. It will now reformat your drive and you are good to go.

Lautsprecher in Fhem einbinden

Hier ein kleines Tutorial wie ein Lautsprecher an einem Radaa Rock oder Raspberrypi in fhem eingebunden werden kann. Zuerst die alsa und Utilities installieren:

In der fhem.cfg einen Lautsprecherdummy und ein Notify darauf anlegen:

In der 99_myUtils.pm eine entsprechende Funktion anlegen:

Im fhem root ein Verzeichnis „media“ erstellen, gewünschte Wave Dateien einfügen und fhem zuordnen:

Eine Wave-Datei kann nun folgendermaßen abgespielt werden:

X11 forwarding over SSH

X11 forwarding allows the graphical interfaces of X11 application running on a remote Linux server to be displayed on your local machine. This can be very helpful for graphical linux tools such as gparted.

On the remote machine first install xauth:

and make sure X11 forwarding is enabled in the sshd_config:

If it is off:

ensure that is enabled:

X11Forwarding yes

and restart the sshd:

On a OS X machine you first have to install XQuartz.
Now you should be able to ssh into your machine and see its X11 display:

An error you may encounter is that the .Xauthority does not exist yet:

which can be mitigated simply by:

on the remote machine.

Abwesenheitsgesteuerte Anrufweiterleitung mit FritzBox und Fhem

In einem echten Smart Home sollte natürlich auch die Kommunikation intelligenter erfolgen. Wie wäre es beispielsweise wenn die Telefonanlage wüsste, dass man nur kurz außer Haus ist? Anrufe könnten dann direkt auf die entsprechenden Mobilgeräte weitergeleitet werden und man erspart sich umständliches Anrufbeantworter abhören und zurückrufen. Mit den Fhem Modulen RESIDENTS, ROOMMATE, GEOFANCY und FRITZBOX ist diese Vision seit einiger Zeit leicht wie folgt umzusetzen:

Zuerst muss eine RESIDENTS Instanz definiert werden, diese stellt den Status einer ganzen Wohneinheit d.h. Wohnung, Haus etc. dar:

Danach werden dieser Residents Instanz die einzelnen Bewohner hinzugefügt:

Um fhem mitzuteilen wer gerade anwesend ist gibt es mittlerweile eine Vielzahl von Möglichkeiten. Die zuverlässigsten sind PRESENCE per FritzBox oder Bluetooth sowie Geofancy:

Mit der kostenlosen Geofancy iPhone App lassen sich z.B. einfach Geofences für iDevices erstellen und überwachen. Eine GEOFANCY Instanz auf fhem Seite kann folgendermaßen definiert werden:

Mit einem Notifier können die erfassten Orte dann ins ROOMMATE Modul übernommen und die Anwesenheit der Wohneinheit aktualisiert werden:

Alternativ kann die Anwesenheit auch mit PRESENCE und Bluetooth überwacht werden:

Und den zugehörigen Notifiern:

Nun zur tatsächlichen Anrufweiterleitung auf der FritzBox. Diese muss zuerst im Webinterface angelegt werden. Ein kleiner Tipp am Rande: Wenn die Abgangsrufnummer auf „automatisch“ steht, kann es passieren das die Anrufweiterleitung direkt im Amt geschieht (AWS). In diesem Falle finden sich keinerlei Logeinträge in der FritzBox Anrufhistorie.

Auf fhem Seite muss eine Instanz des FritzBox Moduls definiert werden. Dieses kann entweder im lokalen Modus laufen, wenn Fhem direkt auf der FritzBox installiert ist und als root läuft oder im entfernten Modus laufen, d.h. per telnet auf fritz.box. Dazu muss telnet zuerst per Telefon auf der FritzBox aktiviert werden (#96*7*) und das telnet Passwort in der Datei fb_pwd.txt im Fhem root Verzeichnis hinterlegt werden. Gegebenenfalls muss auch noch das telnet perl modus auf dem hem server installiert werden:

Die Instanz des FRITZBOX Moduls kann einfach folgendermaßen definiert werden:

Mit den folgenden Notifies kann dann auf verschiedene Anwesenheitsstatus reagiert werden:

Und Voilà, die intelligente Anrufweiterleitung spart Zeit, Nerven und Roamingkosten.

TFTP server on OS X

For flashing, recovering or unbricking embedded devices often a TFTP server is needed for serving the firmware image. On OS X such a server is already built in. To use it, simply put the firmware in /private/tftpboot and then start the tftp daemon with:

Once you are done you can stop the daemon with:

Neato Botvac 80 Wifi Mod

As the Neato BotVac 85, unlike its luxury sibling Vorwerk Kobold VR200, does not have a Wifi interface, I was looking for a solution to retrofit it. Here is some instructions on how to do it.

After doing some research, I found a similar mod for the older Neato XV Series. So I ordered a Hame MPR-A5 which is basically the same as the Hame MPR-A1 without the battery. Two months later it finally arrived.

To integrate this little router in your home network as a client, lets install OpenWrt on it. First make sure you have gotten my device or an equivalent clone:

Connect to your router by ethernet with the credentials on the back of the device and flash the following image from the webinterface.

Login to your router via

type passwd and choose a secure password. The router should now be available via

Now lets tackle the network config:

and adjust like this

config wifi-device ‚radio0‘
option type ‚mac80211′
option hwmode ’11g‘
option path ‚10180000.wmac‘
option htmode ‚HT20‘
option disabled ‚0‘
option country ‚DE‘
option txpower ’20‘
option wmm ‚1‘
option channel ‚9‘

config wifi-iface
option device ‚radio0‘
option network ‚wwan‘
option mode ’sta‘
option encryption ‚psk2‘
option ssid ‚Network‘
option key ‚wpakey‘

and adjust like this:

config interface ‚loopback‘
option ifname ‚lo‘
option proto ’static‘
option ipaddr ‚127.0.0.1‘
option netmask ‚255.0.0.0‘

config interface ‚lan0‘
option ifname ‚eth0.1‘
option proto ‚dhcp‘
option gateway ‚192.168.181.1‘
option dns ‚8.8.8.8‘

config ‚interface‘ ‚wwan‘
option ‚proto‘ ‚dhcp’&lt;/code&gt;

Also change the name server to a name server of your choice

After rebooting, continue by installing some missing packages:

Now plugin your neato with a good USB A to Micro USB cable (2 of my usual ones did not work) and

Now lets make the serial port available via telnet with ser2net. Edit the configuration file for ser2net

It only needs to contain this line:

3000:telnet:0:/dev/ttyACM0:115200

This line says to listen for incoming telnet connections on port 3000, and connect them
to /dev/ttyACM0 at 115200 baud.

As ser2net doesn’t start automatically, add ser2net &
to /etc/rc.local before the exit 0. Reboot and you should now be able to connect the Neato Botvac 80 via telnet

and control it using the commands from the Neato API.