Jul 232013
 

Update

We have released dfreerdp (FreeRDP for the DirectFB backend) as a package for the Raspberry Pi. Please go to our new blog post to get it!

Intro

RDP is a convenient way to connect to Windows and also other operating systems with RDP host software, e.g. Linux. RDP transmits display information more efficiently than VLC, as it sees the structure of the screen and it’s elements. It also allows to transmit audio information both ways – playback and recording, share printers, drives, and more. As it is an extensible protocol, efficient video / multimedia playback can be implemented – and has been implemented, albeit apparently only in Windows Media Player.

The Raspberry Pi is a low-power device, with Full-HD (and audio) capable HDMI output.

FreeRDP is a mighty utility to connect to RDP servers, and utilize many of their possibilities. It even supports the video extensions for RDP (in RDP lingo: video redirection virtual channel extension) with ffmpeg. Don’t get your hope up too high right now, though: while theoretically feasible in software, it still would have to be written for both the Raspberry AND the host (it is not a “plug & forget” solution, but the software run on the server has to support it specifically).

The current state: A marriage made in heaven?

Not quite. FreeRDP is easily installed, and used from an X session. But it is … agonizingly slow. Audio playback is in a bad state.

The problem: X adds a very high overhead to any application, but even more so a graphics intensive, such as FreeRDP. Even super-charging the Raspberry Pi with overclocking, Class 10 SD cards, a beefy power supply, etc. will NOT solve this problem! An RDP client compiled specifically for Wayland might, but this is still some way off.

Solution

FreeRDP can be compiled to draw to the Direct Frame Buffer. This eliminates all of the overhead, which X would add. This is perfect for people really trying to use the Raspberry as Windows / RDP thin client. It will work in FullHD resolution (over the local network), with sufficient performance (and 16 bit color depth).

Kudos are in order to the Tao of Mac blog, which had the idea, and the instructions to get me up and running. You rock!

We will release a hardware & software package RDP client, based on the Raspberry, really soon now. If you’re interested, hit me up in the comments.

Step-by step instructions

With all that out of the way, let’s jump into the instructions!

Preparation

We suggest to use a Class 10 SD card, with ample space for the installation & build of the packages (8 GB Class 10 seems sensible). Install the newest Raspbian image, set up your locale and keyboard layout, aptitude update and aptitude upgrade.

Install the necessary packages:

aptitude install build-essential git-core cmake libssl-dev libx11-dev libxext-dev libxinerama-dev libxcursor-dev libxdamage-dev libxv-dev libxkbfile-dev libasound2-dev libcups2-dev libxml2 libxml2-dev libxrandr-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libavutil-dev libavcodec-dev libcunit1-dev libdirectfb-dev xmlto doxygen libxtst-dev

This should take quite a while.

Download the FreeRDP package (use a sensible location, we will be compiling there later. If in doubt, a sub-folder in your home folder is OK):

wget https://github.com/FreeRDP/FreeRDP/archive/1.0.2.tar.gz

You might also consider checking out the 1.0.3 pre-release version. It might turn stable in a couple of months.

Set up the build environment – this is analoguous to ./configure seen in many other compilations:

cmake -DCMAKE_BUILD_TYPE=Release  -DWITH_FFMPEG=OFF -DWITH_XINERAMA=OFF -DWITH_XCURSOR=OFF -DWITH_DIRECTFB=ON -DCMAKE_INSTALL_PREFIX=~/freerdp

A couple of hints for this:

  • You might want to adjust the –DCMAKE_INSTALL_PREFIX to something more suitable – if you compile as root, it will install the application and the libraries into the folder /root/freerdp otherwise.
    A good choice could be /usr – this way the binaries and libraries will be in the normal search path.
  • turning off FFMPEG means turning off virtual video extension. As discussed before, this is of limited use anyway, right now. But some experimenting might be interesting. FreeRDP also is built modularized on top of FFMPEG, so exchanging that for an omxplayer-like code thingy SHOULD be feasible.
  • Xinerama – is an X extension which allows X applications to span two or more displays a one large virtual display.

Check for the output of this command. It will tell you about skipped options and missed packages. It should find DirectFB amongst others (Found DirectFB: /usr/lib/arm-linux-gnueabihf/libdirectfb.so).

  • pulseaudio: this is a sound server, and another layer on ALSA. It is network capable. Users report varying mileage with pulseaudio and good playback quality. We have tested without the pulseaudio package, future tests will show whether there is an advantage in using it.
  • pcsc – this is for smart card support, most likely you will not need it
  • CUnit – a lightweight system for writing, administering and running unit tests in C – most likely you will not need this, either.

Compile the DirectFB RDP client:

cd client/DirectFB/
make

#optionally 
sudo make install

#for sound support
cd ../../channels/drdynvc
make
sudo make install
cd ../rdpsnd
make
sudo make install

This is all – but this will take quite a while (some hours).

Set up some configuration files

Edit your /etc/udev/rules.d/99-input.rules to be:

SUBSYSTEM=="input", GROUP="input", MODE="0660"
KERNEL=="tty[0-9]*", GROUP="root", MODE="0666"
KERNEL=="mice", MODE="0666"
KERNEL=="fb0", OWNER="root", MODE="0660"

The first line should aready be in the file, add the other three lines.

Optional, but recommended: Edit your /boot/config.txt to contain the following settings:

framebuffer_width=1920
framebuffer_height=1080
framebuffer_depth=16
# for other stuff
gpu_mem=128

arm_freq=800
disable_overscan=1
hdmi_drive=2
hdmi_ignore_edid=0xa5000080

This will

  • set your resolution as fixed [framebuffer_width, framebuffer_height] – be sure to adjust to your needs!
  • set bit depth to 16 – as we will connect to the RDP server using this depth for better performance.
  • ignore anything the monitor will tell the Raspberry – it might lead to blurry edges, otherwise [hdmi_ignore_edid=0xa5000080]
  • overclock the raspberry just a little [arm_freq=800]
  • disable the overscan – remove the black area around the display output on modern LCD monitors [disable_overscan=1]
  • set up the HDMI output to be a real HDMI output and carry audio – this will fix “no sound output” problems [hdmi_drive=2] don’t use this if you connect your Raspberry via DVI or VGA to the monitor

Edit /etc/fb.modes and add a new mode:

# Added as per taoofmac instructions
mode "1920x1080-24p"
   geometry 1920 1080 1920 1080 32
   timings 13468 148 638 36 4 44 5
endmode

You will have to adjust this if you use a different resolution than FullHD. The original article at Tao of Mac has some more resolution examples for you.

Create a new file /etc/directfbrc with the following contents:

system=fbdev
autoflip-window
desktop-buffer-mode=auto
vt-switching
graphics-vt
no-deinit-check
no-motion-compression
no-translucent-windows
memcpy=arm
mode=1920x1080
depth=16
dma
hardware
# for the moment, we need DirectFB's own cursor sprite
cursor

Reboot.

 

Usage

If you specified –DCMAKE_INSTALL_PREFIX to be /usr, you should be able to use FreeRDP DirectFB client without any path prefix, else just prepend your path:

dfreerdp -u "user name" -p secret_password_here -f -g 1920x1080 -x l -z --disable-full-window-drag  --gdi hw --plugin rdpsnd --data alsa --  host:port

Be sure to adjust this command:

  • “user name” should be your user name. If it contains a space, you should keep the quotation marks, else you can loose them.
  • secret_password_here should be your password, obviosly.
  • -g specifies the geometry. Adjust, as necessary.
  • -x = experience (l for LAN), will enable different bells and whistles. You might want to modify that, or use a more finegrained control of which features to enable, and which to disable
  • -z enable compression (useful)
  • –gdi hw – I’m not sure whether this is really necessary
  • –plugin rdpsnd –data alsa —  – this will enable remote sound output on the Raspberry. Drdynvc is said to have better quality, but I could not get it to work unfortunately. And, yes, the trailing double dashes are part of this option.
  • server:port – can be specified as domain or IP adress. The :port can be omitted, if you are connecting to the default RDP port (3389)

If you want sound output on the remote machine, use the –o switch.

 

FAQ

What about keyboard layout?

It will work exactly as you see your keyboard input on the Raspberry console itself. Even the Windows key should work. If your layout does not work on the Raspberry console, consider setting it up using raspi-config

Will this work over WLAN?

Sure it will. Just adjust your WiFi dongle for optimum throughput and latency (yes, literally change its position, tilt, etc. until you find the best performance spot!)

We recommend you the following packes for graphical / console adjustment of Wireless settings:

aptitude install wicd wicd-gtk wicd-curses

Will Skype work?

Not tested yet – enlighten us Smile This will need microphone redirection, too.

Will forwarding of devices work?

Not tested yet – inform us about usb printers, thumb drives, etc.

How can I test sound output on the Raspberry?

aplay /usr/share/scratch/Media/Sounds/Vocals/Singer2.wav -v -V mono

Will performance over WAN networks be OK?

Yes, pretty much – sound output will suffer (a lot), but the GUI will still be quite usable. You might want to adjust the flags to disable some eye candy.

Why do the browsers “stutter” during scrolling?

In my understanding: Unfortunately browsers need a very high degree of control over their screen outputs, and thus they render it themselves, instead of letting Windows do it – RDP sees browser output as image, which is retransmitted when scrolling. Playing with image compression options might alleviate this problem a bit.

Will accessing Linux hosts over RDP work?

Not out of the box – you will need to install an X to RDP conversion software.

In a very quick and rough test, a connection set up by the Scarygliders X11 RDP O Matic as a server backend did not work reliably enough (it was installed on a Pentium IV Linux server). It might do so with some tuning.

Or another backend / solution might do the trick. Looking forward to your input Smile

 

Known problems

  • Flash (isn’t it always on some list?) – will deliver horrible audio performance, native players (Foobar2000) will be OK, though.
  • Video playback – don’t even dream of playing YouTube videos over an RDP connection … the time is not ready yet, the software not written. Care to join a noble cause?
  • WLAN performance will depend on WLAN throughput and latency. The orientation of your dongle – especially nano dongles – will be very important. It can be tuned to a decent performance state, though.
  • I can’t get the new / style switches to work with FreeRDP, fallback to the legacy – switches for now.
  • Sound output: only rdpsnd works, –plugin drdynvc –data tsmf:audio:alsa:plughw:0,0 — will not work – maybe this is a configuration issue, though and some other parameters need to be passed. Drdynvc is said to have better quality. The issue might be with servers with no sound card drivers installed. I did not find an easy solution to this, and I am looking forward to your suggestions.
  • Connection to Linux RDP server compiled with X11 RDP O Matic is not stable for me.

References & further reading

Jul 032013
 

Using a Raspberry Pi as a router with AICCU / SIXXS is possible, but there are a couple of “gotchas”.

How-To

Get IPv6 tunnel

Go to SixXS and get your tunnel. (Free) This will be enough to connect the Raspberry via IPv6 to the Internet. If you want to bring other machines online, too, you will need to request and set up a subnet.

(This is in progress)

Add routing for local network

Now, you need to add the routing for the local network. We will assume that the network interface you want to add it to is “br0” (most probably this will be either eth0 or wlan0 for you!). Also, that the /64 network assigned to you by SiXXS is 2001:db8:384e:8888::/64

ip route add 2001:db8:384e:8888::/64 dev br0

Basically, this tells your Raspberry, if traffic is for machines in this network, it should not be forwarded through the SiXXS tunnel, but rather it should be sent out through br0. As I have said before, adjust br0 to eth0 / wlan0 if necessary.

(Note: this should be set up permanently as post-up rule).

Some Cool Things to do with IPv6

Copy Files from one host to another

scp -6 pi@[2001:db8:384e:8888:ba27:ebff:fe18:bb4c]:/scripts/ctemp.rb /webroot/temp/ctemp.rb

This will copy the file “/scripts/ctemp.rb” from the host 2001:db8:384e:8888… to /webroot/temp/ctemp.rb on the local computer, using the username “pi” on the remote computer. Yes, you will be able to do this into your home network, if IPv6 is set up correctly! Never again files forgotten at home Smile

Q & A

Can I have a “normal” router which is separate from the Raspberry for IPv4 routing?

Yes. This is the purpose of the whole idea – the Raspberry acting as “IPv6 gateway” on your local network.

What is 2001:db8::?

This is a special prefix used for documentation purposes. Your real adress will have different numbers / letters in it.

What kind of speed can I expect?

OK, please lower your expectations right now. Maybe there is optimisation potential, but here’s our first quick test:

image

We used ipv6-test.com/speedtest to run the test.

Jun 032013
 

Unter Windows kann einfach das Programm Win32DiskImager.exe verwendet werden, um Images VON der SD Karte zu Backup-Zwecken zu erstellen.

Unter Linux kann man das sehr mächtige Tool dd nutzen. dd sollte vorsichtig eingesetzt werden, da es durchaus in der Lage ist die Systempartition zu überschreiben – besonderes Augenmerk sollte also auf den “of” Parameter gerichtet sein (output Ziel).

Es wäre prinzipiell denkbar, den Raspberry Pi “aus sich selbst heraus” zu backuppen. Dazu müsste man jedoch die Systeme read-only remounten, und einen passenden USB-Speicher, etc. zur Hand haben. Falls Interesse an einem Skript dafür besteht, werden wir uns damit beschäftigen.

Basis-Nutzung:

dd if=/dev/sd* of=/tmp/my.image

dd liest hier die kompletten Daten von /dev/sd* (das * muss mit dem entsprechenden Buchstaben ersetzt werden) und schreibt sie in die Datei /tmp/my.image (Pfad und Name hier nach Wunsch anpassen).

Möchte man das etwas komfortabler haben, hilft “Pipeview” pv:

pv –tpreb /dev/sd* | dd of=/tmp/my.image

Das zeigt einen Fortschrittsdialog beim Kopieren an. Während dd meist auf Linux-Systemen verfügbar ist, muss pv meistens installiert werden.

Bonus: Wie erkennne ich welchen Buchstaben ich nutzen muss statt dem Sternchen /dev/sd* ?

sudo lsblk -o NAME,FSTYPE,MOUNTPOINT,LABEL,UUID,MODEL,SIZE,STATE,OWNER,GROUP,MODE,TYPE

Das obige Kommando zeigt eine Liste von angeschlossenen Laufwerken an, meist ist anhand der Größe möglich die SD Karte zu ermitteln.

Achtung: da wir die gesamte SD Karte, “samt Haut und Haaren” backuppen wollen, und nicht eine Partition (z.B. als /dev/sda1 adressiert), sollte KEINE Zahl am Ende der Adresse sein (d.h. z.B. /dev/sda statt /dev/sda1).

Weiterführende Infos: überall im Internet, z.B. Wikipedia

May 292013
 

Summary

I managed to get Weston running without compiling it from code first. Unfortunately, only the terminal was usable, X applications (midori, chromium, scratch) did not work. I spend the rest of the evening investigating, and would like to share some hints with you – information about Weston & Wayland is not easy to find.

If you want a working solution, come back in a couple of weeks – we will most probably have one for you. If you love to tinker, read on. This article will be a great starting base for exploration.

weston-on-raspberry-screenshot

Installing Weston and Wayland

The following instructions are to be executed as root:

# echo deb http://raspberrypi.collabora.com wheezy rpi >> /etc/apt/sources.list
# apt-get update
# apt-get install weston

Accept the installation without known key. (You have to expressly enter “Y” for this).

Edit your /boot/config.txt and add the following lines at the end of the file: (hint: “sudo nano /boot/config.txt “)

#Settings for Weston to work
gpu_mem=128
dispmanx_offline=1

Reboot.

Edit your /etc/weston/weston.ini

[shell]
focus-animation=dim-layer
animation=zoom

[launcher]
icon=/usr/share/icons/gnome/24x24/apps/utilities-terminal.png
path=/usr/bin/weston-terminal

[launcher]
icon=/usr/share/icons/gnome/32x32/actions/insert-image.png
path=/usr/bin/simple-shm

[launcher]
icon=/usr/share/icons/gnome/32x32/apps/zen-icon.png
path=/usr/bin/midori

[core]
modules=xwayland.so,desktop-shell.so

The important lines are the two last ones – the launchers will unfortunately not work in my setup, as X does not work … The modules have to be loaded in EXACTLY this order – first xwayland, then desktop-shell. You also cannot omit desktop-shell – else weston will show a black screen only.

I am not sure, whether I am overriding (sensible?) defaults, as there is very little documentation on the topic as of yet.

Create a weston-starter script which will set up some variables: “ sudo nano /pi/home/weston-starter “ with the following contents:

#! /bin/bash

#export WLD="$HOME/local"
export WLD=""

export PATH="$WLD/bin:$PATH"
export LD_LIBRARY_PATH="$WLD/lib:/opt/vc/lib"
export PKG_CONFIG_PATH="$WLD/lib/pkgconfig/:$WLD/share/pkgconfig/"
export ACLOCAL="aclocal -I $WLD/share/aclocal"
export XDG_RUNTIME_DIR="/tmp/wayland"
export XDG_CONFIG_HOME="$WLD/etc"
export XORGCONFIG="$WLD/etc/xorg-conf"

mkdir -p "$WLD/share/aclocal"
mkdir -p "$WLD/share/pkgconfig"
mkdir -p "$XDG_RUNTIME_DIR"
chmod 0700 "$XDG_RUNTIME_DIR"

#cp bcm_host.pc egl.pc glesv2.pc $WLD/share/pkgconfig/

#git clone git://anongit.freedesktop.org/wayland/wayland

weston --log=/tmp/weston.log

Again – these should very probably be adjusted, and MAY be the cause of the problem with the X-Server. I have adjusted them from a script a user used to compile weston.

The last line actually starts weston, and logs it’s output to /tmp/weston.log (normally this gets sent to the terminal, which is hidden by weston itself). Very handy to monitor from an SSH shell on a second computer.

Make it executable (chmod +x weston-starter).

 

OK. If everything goes well, you can start weston now.

pi@raspberrypi ~ $ ./weston-starter

(Be sure to start it as user pi – if you start it as root first, the temporary directory created in /tmp will not be accessible by pi. You can of course also chmod this directory to be world readable and writable /tmp/wayland )

Playing around with weston

You will be able to start multiple terminal instances, resize them and drag them around, and interact with the system via the terminals.

The second icon does not work for me. The third icon which I added to the configuration (to start Midori) neither.

Here are some nifty facts:

  • hit the Windows key to get into “expose mode”
  • hit Windows key + Tab to switch between open Windows
  • hold down Windows key and scroll the mouse to zoom into any area (this is pretty cool and pretty smooth)
  • Ctrl + Alt + Backspace terminates weston
  • Wayland has it’s own screenshot utility – it can’t be invoked from the command line, instead you have to press a shortcut (unfortunately I do not know which one). It may also be, that I disabled this screenshot utility by explicitly listing the modules to be loaded in the weston.ini

weston-zoom

Showing off the zooming feature of Weston / Wayland. This is a pretty cool, dynamic feature, to which the still picture can do no justice.

The little there is to see REALLY impressed me. It is so fluid, so fast – I was not used to this from the Raspberry Pi and GUI applications before.

X-Applications

You will NOT be able to start any X application with my instructions. I suspect, that the X-Server which is installed from the default repositories does not support wayland!

Fatal server error:
X Unrecognized option: -wayland

If you have a look at file /usr/lib/weston/xwayland.so with the text editor somewhere in the file you will see the x server being called with this –wayland option. Trying to invoke it from the command line with it will yield the error message above, but I also managed to get it out of a starting wayland server somehow.

This can be also seen in the following logexcerpt ( /tmp/weston.log which we set up in our start script )

[23:38:20.556] xserver listening on display :0
[23:38:20.557] Loading module ‘/usr/lib/weston/desktop-shell.so’
[23:38:20.560] Compositor capabilities:
               arbitrary surface rotation: no
               screen capture uses y-flip: no
[23:38:20.560] libwayland: using socket /tmp/wayland/wayland-0
[23:38:20.562] launching ‘/usr/lib/weston/weston-desktop-shell’
[23:38:24.558] forked X server, pid 4635
[23:38:24.596] libwayland: disconnect from client 0x19ad188
[23:38:24.597] xserver crashing too fast: 256

All the fun stuff (Midori, LibreOffice, Chromium, …) is unfortunately not testable …

If you try to start Midori, it will yield the following error message:

Midori - Cannot open display:

MFAQ

Mock-FAQ, as no one asked (yet).

weston-launch

There seems to be no such program on the Raspberry Pi, yet. weston-launch passes parameters to weston with the following syntax: weston-launch — –modules=xwayland.so,desktop-shell.so

Note the double double dashes. weston itself takes only single double dashes in front of modules.

man weston

A good idea if you’re stuck with any Linux command is to look at it’s manpage. Weston is no exception, it ships with one which is quite handy.

 

To be done

We need to have LibreOffice running on Raspbian hardfloat under Weston & Wayland. This probably means compiling weston & wayland, and getting a special x server compatible with them. And this in turn means setting up a crosscompiling rig.

A quote from the manpage:

XWayland requires a special X.org server to be installed. This X server will connect to a Wayland server as a Wayland client, and X clients will connect to the X server. XWayland provides backwards compatibility to X applications in a Wayland stack.

References

May 212013
 

Das ist eine Anleitung wie man eine mit NTFS formatierte Festplatte über den Raspberry Pi im heimischen (Windows-) Netzwerk freigibt. Der Samba-Teil kann (und sollte) natürlich auch mit Linux Partitionen verwendet werden.

penguinadmin

ntfs-3g installieren

Dieses Paket wird benötigt um NTFS – Partitionen größer als 2 TB einbinden zu können. Ich habe diesen Absatz ganz an den Anfang gestellt, damit etwaiige Probleme erst gar nicht auftreten. Sollte man nur Linux Partitionen einbinden wollen, kann das entfallen.

Da der ntfs-3g Treiber sehr ressourcenintensiv ist, sollte man wenn möglich native Linux (ext4 / ext3) Partitionen bevorzugen.

Die dazugehörige Fehlermeldung, falls man es ohne dieses Paket  versuchen würde, würde lauten:

pi@andromeda /mnt $ sudo mount -a
mount: wrong fs type, bad option, bad superblock on /dev/sda1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

pi@andromeda /mnt $ sudo dmesg | tail
(...)
[23556.245263] NTFS driver 2.1.30 [Flags: R/W MODULE].
[23556.265987] NTFS-fs error (device sda1): parse_ntfs_boot_sector(): Volume size (2TiB) is too large for this architecture.  Maximum supported is 2TiB.  Sorry.
[23556.266018] NTFS-fs error (device sda1): ntfs_fill_super(): Unsupported NTFS filesystem.

Daher installieren wir das Paket ganz einfach:

sudo apt-get install ntfs-3g

Einbinden einer neuen Festplatte

  • Schließe die Festplatte an.
  • Überprüfe mit lsusb ob sie erkannt wurde
pi@andromeda ~ $ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 1a40:0201 Terminus Technology Inc. FE 2.1 7-port Hub
Bus 001 Device 005: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB
Bus 001 Device 006: ID 0bc2:3320 Seagate RSS LLC

In unserem Fall ist die Festplatte eine Seagate 3 TB USB 3.0 Festplatte (abwärtskompatibel mit USB 2.0 für den Raspberry Pi). Sie wird erkannt.

  • Liste die angeschlossenen Speichermedien auf mit:

sudo lsblk -o NAME,FSTYPE,MOUNTPOINT,LABEL,UUID,MODEL,SIZE,STATE,OWNER,GROUP,MODE,TYPE 

image

Wenn Deine Ausgabe anstelle der Baumsymbole links komische Zeichen ausgibt, stelle die Zeichensatzkodierung deines SSH-Clients (z.B. PuTTY) auf UTF-8 um. (Klick auf das Bild öffnet eine größere Version)

In unserem Beispiel wird also sowohl die SD Karte von der der Pi gebootet wird ( /dev/mmcblk0 ) mit ihren zwei Partitionen /dev/mmcblk0p1 und /dev/mmcblk0p2, sowie die Seagate Festplatte als /dev/sda mit der einzigen Partition /dev/sda1 angezeigt.

Wichtig an dieser Stelle anzumerken ist, dass die Buchstaben, z.B. das a bei /dev/sda nach der Reihenfolge des Einsteckens vergeben werden. Um jedesmal sicher die richtige Festplatte anzusprechen (z.B. wenn man mehrere Festplatten an dem Pi anschließt, oder zusätzliche USB Sticks / SD Reader / …), sollte man sich daher der UUID bedienen.

  • Liste die UUIDS auf, und verifiziere deren Zuordnung:

ls –lR /dev/disk/by-uuid/

image

 

  • Mountpoint erstellen und /etc/fstab editieren (hier erstmal die Default Einstellungen in dieser Datei zur Referenz):
pi@andromeda /mnt $ sudo su
root@andromeda:/mnt# mkdir /mnt/bigdata
root@andromeda:/mnt# nano /etc/fstab

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1

Der Mountpoint ist nötig, um die Festplatte in das Hauptdateisystem “einhängen” und damit später adressieren zu können  Es sollte sich um einen leeren Ordner handeln, der aber nicht unbedingt in /mnt liegen muss. (Nur das Verzeichnis /tmp sollte man vorsichtig benutzen – es wird bei jedem Neustart geleert).

Wie bereits oben ausgeführt, sollte man hier NICHT /dev/sda1 eintragen, sondern den Pfad mit der UUID, um sicherzustellen dass die richtige Festplatte angesprochen wird.

Wir fügen folgende Zeile in die /etc/fstab hinzu:

UUID=DA0E27C90E279E0F   /mnt/bigdata    ntfs    defaults        0       2

Dabei sind die einzelnen Spalten jeweils mit einem Tab getrennt.

  • die UUID solltest Du mit Deiner UUID ersetzen, die der Partition entspricht die Dich interessiert
  • den Mountpoint ebenfalls mit dem, den Du erstellt hast
  • das Dateisystem ggf. anpassen, falls es nicht ntfs ist
  • defaults bedeutet: standard-Einstellungen (z.B. ob das Dateisystem beim Start automatisch eingehängt werden soll – normalerweise ja)
  • die zahl 0 bedeutet “dump-freq” – Archivierungsfrequenz für das Programm dump – 0 bedeutet “disabled”
  • die zahl 2 spezifiziert die Reihenfolge des Dateisystem-Checks. Nicht-root Partitionen sollten hier eine 2 oder eine 0 (disabled) haben.

 

  • initiales Mounten

Die Partition ist jetzt in /etc/fstab eingetragen, und wir sollten sie jetzt einhängen (nach einem Neustart wird das automatisch gemacht werden):

sudo mount -a

Sollte hier ein Fehler auftreten, schaue bitte den allerersten Absatz nochmal an – hast Du das Paket ntfs-3g installiert?

 

Samba

Samba ist eine “Kompatibilitätsschicht” mit der Windows-Welt von der Linux-Seite her. Es dient nicht nur zur Freigabe von Dateien, sondern auch um z.B. Drucker für Windows zur Verfügung zu stellen.

Aus meiner Sicht ist die Freigabe unter Linux deutlich einfacher als unter Windows selber, also herein ins Vergnügen:

  • wir installieren samba
pi@andromeda ~ $ sudo su
root@andromeda:/home/pi# aptitude install samba samba-common-bin

Samba liest seine Einstellungen aus der Datei /etc/samba/smb.conf – wir schlagen vor die Default Datei als Backup zu verschieben, und eine neue Datei mit einfachen Einstellungen anzulegen. Eine einfache funktionierende Beispieldatei (in Anlehnung an diesen Artikel) ist im folgenden wiedergegeben:

# Global parameters
[global]
       workgroup = HOME
       netbios name = ANDROMEDA
       server string = Samba Server %v
       map to guest = Bad User
       log file = /var/log/samba/log.%m
       max log size = 50
#       socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
       preferred master = No
       local master = No
       dns proxy = No
       security = User

# Share
[bigdata]
       path = /mnt/bigdata
       valid users = my-samba-user
       read only = No
       create mask = 0777
       directory mask = 0777

Die Gruppe global ist ein Sonderbezeichner, es gibt außerdem weitere, z.B. für Drucker. Die workgroup “HOME” hat für uns ganz gut funktioniert, evtl. könnte man noch “WORKGROUP” ausprobieren.

Edit: Durch auskommentieren der socket options Zeile (durch die Raute #)  – wie durch den Kommentar von Basti empfohlen, kann man die Geschwindigkeit auf nahezu den vollen Durchsatz des 100 Mbit/s Ports des Raspberrys anheben! (=> ca. 10 MB/s)

Der netbios name ist der wichtigste Teil unter global. Das ist der neue Windows-Name des Raspberry Pi’s. Es macht Sinn ihn genauso zu benennen, wie den echten hostnamen des Raspberrys (das was üblicherweise auf der Kommandozeile immer angezeigt wird).

Der Name des Shares wird später unter Windows im Pfad eingegeben, ist hier in rechteckigen Klammern, bigdata.

Der vorher erstellte Pfad zum mountpoint sollte hier verändert werden, unter valid users einzutragen ist ein frei wählbarer Name (hier als Beispiel “my-samba-user”), für den wir im nächsten Schritt einen Benutzer anlegen werden.

  • Samba User anlegen, Einstellungen testen, Samba Server neustarten
root@andromeda:/etc/samba# useradd -c "Pi Samba user" my-samba-user

root@andromeda:/etc/samba# smbpasswd -a my-samba-user
New SMB password:
Retype new SMB password:
Added user my-samba-user.

root@andromeda:/etc/samba# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[bigdata]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
        workgroup = HOME
        server string = Samba Server %v
        map to guest = Bad User
        log file = /var/log/samba/log.%m
        max log size = 50
        socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
        local master = No
        dns proxy = No
        idmap config * : backend = tdb

[bigdata]
        path = /mnt/bigdata
        valid users = my-samba-user
        read only = No
        create mask = 0777
        directory mask = 0777

root@andromeda:/etc/samba# service samba restart
[ ok ] Stopping Samba daemons: nmbd smbd.
[ ok ] Starting Samba daemons: nmbd smbd.

root@andromeda:/etc/samba#

Das ist alles was auf Linux Seite erforderlich ist.

 

Einfacher Verbindungstest

image

Man kann jetzt im Windows (falls man den Startknopf noch hat) Dialog “Ausführen” bzw. “Run” auswählen, und den Pfad des neuen SAMBA Shares einfach angeben. In unserem Beispiel “\\ANDROMEDA\bigdata” – ANDROMEDA ist der Pi und bigdata der Share. Man beachte die BACK-Slashes!

Es geht ein Dialog auf, in dem man den ebenfalls bereits auf dem Raspberry Pi angelegten SAMBA-Benutzer und das Passwort eingeben muss, danach öffnet sich ein Explorer-Fenster mit dem Inhalt des neuen Netzlaufwerkes.

 

Dauerhafte Verbindung einrichten

 

Windows 8

image

Explorer aufmachen, Computer anklicken, Reiter “Computer”, “Map Network Drive” klicken. (Map Network Drive kann man auch per Rechtsklick auf “Computer” aus dem Kontext-Menü auswählen).

image

Hier muss man einen (lokalen) Laufwerksbuchstaben auswählen, und den Pfad des Netzlaufwerkes angeben. Bequemerweise kann man auch mit dem Knopf “Browse …” den Ordner auswählen, der Pi taucht in der HOME Gruppe einfach auf. Sollte es das nicht tun, dennoch den Pfad manuell eintippen – das sollte so klappen.

Wichtig ist, dass “Connect using different credentials” angekreuzt ist – wir haben auf dem Raspberry einen eigenen User für die Verbindung eingerichtet.

Ein Klick auf “Finish” ruft den Dialog für die Passwort / Nutzer – Eingabe auf:

image

Hier sollte man die Login Daten des speziell dafür angelegten SAMBA Nutzers eingeben. Es empfiehlt sich in sicheren Umgebungen vermutlich auch, “Remember my credentials” einzugeben, damit sich der Rechner die Zugangsdaten merkt.

That’s it – jetzt steht das Laufwerk zur Verfügung!

 

Windows 7

image

Man öffnet den Explorer, klickt auf “Computer”, und auf “Map network drive”. (Falls man es in der Leiste oben nicht findet, kann man es auch per rechts-Klick auf “Computer” erreichen).

Ansonsten analoges Vorgehen wie bei Windows 8, siehe oben!

 

Windows XP

netzlaufwerk-verbinden

Im Explorer wählt man unter Extras den Menüpunkt “Netzlaufwerk verbinden …” aus …

netzlaufwerk-dialog

es erscheint dieser Dialog, in dem man den Pfad (analog wie bei Windows 8 bzw. 7) eingeben sollte. Anders ist hier, dass man anstelle einer Checkbox “als anderer Benutzer verbinden” eine Art Hyperlink hat, den man anklicken sollte.

verbinden-als

Es erscheint daraufhin dieser Dialog, in dem man die Zugangsdaten die auf dem Raspberry Pi für Samba eingerichtet wurden, eingeben sollte. Ein Klick auf OK hier, und auf Fertig stellen im vorherigen Dialog sollte das Netzlaufwerk verbinden und gleich ein Explorer-Fenster mit dessen Inhalt öffnen.

 

Q & A

Web browser

Ein wichtiger Vorteil von SAMBA ist, dass man den Pi ab sofort unter seinem (Samba) Namen per Webbrowser erreichen kann. Z.B. kann ich einfach andromeda als Adresse angeben, und vorausgesetzt dass ein Webserver installiert ist, wird die Webseite problemlos aufgerufen

image

 

Was für eine Geschwindigkeit kann man erwarten?

Edit: Durch auskommentieren der socket options Zeile (durch die Raute #)  – wie durch den Kommentar von Basti empfohlen, kann man die Geschwindigkeit auf nahezu den vollen Durchsatz des 100 Mbit/s Ports des Raspberrys anheben! (=> ca. 10 MB/s)

image

>> ca. 5 – 6 MB/s

Dabei war die angeschlossene Festplatte eine USB 3.0 Festplatte, es wird das 100 Mbit/s Netzwerk des Raspberrys benutzt, angeschlossen sind das Zielnotebook und der Raspberry am gleichen Gigabit-Switch, und es wird auf eine SSD kopiert, was den Raspberry selber bzw. die USB Implementatoin darauf zu der Engstelle macht.

Das ist natürlich nicht besonders schnell, aber zum Streamen von Filmen, Musik, Dokumenten und für Background-Backups reicht es. Lieber allerdings nicht alles gleichzeitig Smile

Mögliche Gründe für diese niedrige Geschwindigkeit sind – neben den Flaschenhälsen LAN, USB (was sowohl für lesen von der Festplatte als auch für das LAN benötigt wird) das Dateisystem NTFS bzw. der Treiber ntfs-3g dafür. Er ist bekannt, sehr ressourcenfressend zu sein. Vielleicht ist der Default-Treiber für ntfs ressourcenschonender, bei unserem Test mussten wir jedoch ntfs-3g wegen der 3 Terabyte Größe der Festplatte verwenden. Bevorzugen sollte man wie schon erwähnt Linux-eigene Partitionsformate. Wir werden demnächst einen Test damit veröffentlichen.

Die Geschwindigkeit über WLAN (an das Notebook, Raspberry Pi ist weiterhin per LAN angebunden) ist mit ca. 700 KB/s deutlich niedriger – seltsamerweise. Wir würden uns hier über ein paar Erfahrungen von euch freuen (einfach als Kommentar posten). Evtl. liegt das auch an unserer Netzwerk-Topologie / Timing-Problemen …

 

Referenzen / weitere Information

May 022013
 

What is this about?

This is a small tutorial, which will show you how to set up a local Raspberry to serve as a so-called SOCKS 5 proxy-server for your local network. The Raspberry itself will connect to a remote server, which will then make the requests to other Internet servers with it’s own IP, thus masquerading the original requestor’s.

All computers on your local network can be configured to connect to the Raspberry, so they all can share the same connection to the remote server.

plug-in-raspberry-socks

Usage #1: Unblocking

As we all know, many sites ban IPs outside of certain contries (* cough Hulu YouTube Pandora Grooveshark cough*) or severely limit the usage. YouTube for instance will block most (> 60 %) “copyrighted” content here in Germany … also Google will index some pages, according to German laws, etc. Other examples will be easily found by the astute reader.

Well what about the obvious case of a US citizen being abroad and wanting to access these and other services? Or a British citizen trying to access the BBC iPlayer?

All you need is a US / British IP address. If you also happen to own a US / British VPN (if not, we recommend Hostigation for US VPSes – affiliate link), then you’re set. If you happen to be a US citizen, that is. If not, well … probably you should not read on Winking smile

 

Usage #2: Security & privacy

If you don’t trust your direct upstream connection, i.e. unsecure WiFi hotspot / sharing Internet through the neigbour’s connection, you might want to forward all traffic from your browser through a safe tunnel.

 

Usage #3: Advanced filtering

If you want to do some advanced filtering on your Internet traffic, i.e. rewriting some JavaScripts / CSS on the fly, logging and analysing the traffic, injecting automatic commands, for instance to log you in automatically and securely on some websites, etc., this solution might also work for you (with an additional “proxy” application on the Raspberry between the actual SOCKS proxy port and the browsers / apps you are serving). The Raspberry then could forward the traffic on through localhost, i.e. your regular Internet upstream service. We will not discuss advanced filtering in this post, but maybe in some upcoming posts.

Set up remote server

On your server / VPS in the remote location (i.e. USA), we recommend to add a new user for SOCKS / SSH forwarding with regular (i.e. non-root) privileges. This is done for security measures, should someone obtain control of your Raspberry. (Many Raspberries are left with the pi / raspberry default login).

adduser socks-foo

Linux will ask you for a password for this new user (in our example the username is “socks-foo”, pick your own), and some other questions, which can be safely accepted in their default values.

If you have OpenSSH server running, which you would need to log (“SSH”) into the remote location in the first place, -that’s it – you’re finished with the server.

If you access your “remote” machine directly or via some other means, please set up the OpenSSH server for this tutorial to work.

Consider setting up private key authentication and taking other security precautions which may be necessary, but outside the scope of this article. Please have a look at this article, for instance.

Set up Raspberry

We will have a Raspberry local server forwarding to the remote server(s). If in doubt, use the commands as root user / sudo them.

We will introduce you to an “instant on” solution first, and discuss in some more depth how it can be made more permanent in another article in this blog (coming soon).

Easy setup / test

In the easiest setup, you could start your SOCKS server simply by the following command

ssh -o ServerAliveInterval=60 -D0.0.0.0:8888 socks-foo@example.com

This will connect to the server example.com (you can also simply use it’s IP), with the user socks-foo, and set up dynamic forwarding on the port 8888 for all network interfaces on the Raspberry Pi. The ssh client will log into your example.com machine at this point, if you close the connection (exit), then the SOCKS proxy obviously will also stop working.

The 0.0.0.0 is important – without it, the Raspberry will open the port, but only on localhost – you will not be able to connect from other computers on your network to it.

You can verify that the port is indeed open (from another console) by

netstat -tlnp

This will show you a list of opened ports, and which IP adresses and services they are bound to.image

Also you can try to use curl to fetch content through socks (on another console logged into your Pi):

curl --socks5 localhost:8888 blog.pi3g.com

This should show you some HTML code.

 

Advanced Setup

In this simple test setup above, you need to connect to the Raspberry and enter the password to the remote server every time you want to use it. We will be looking at setting up a private / public key authentication method and installing the SOCKS proxy as a service in a future post.

Setting up your browser

Next, you can set up your browser to use the new SOCKS 5 proxy. We will demonstrate this with Firefox. A good idea is maybe to use a special browser just for connecting to the proxy, especially if the traffic on the remote server you are using is metered.

Open Firefox’ connection preferences:

Firefox > Options > Options > Advanced > Network > Settings …

image

Set up the IP of your Raspberry as SOCKS Host, the port you opened on the Raspberry Pi as SOCKS proxy port. Choose SOCKS v5, click OK.

DNS Setup

To direct DNS requests through the SOCKS proxy, we will have to modify another value:

Enter about:config as URL in Firefox, and press enter to navigate to the page.

image

Click on “I’ll be careful, I promise!”, and find the setting network.proxy.socks_remote_dns and set it to true.

image

You can use the search to find this advanced setting more easily.

That’s it! Your browser will now use the new SOCKS 5 proxy you just set up on your Raspberry Pi.

Browser-Plugins, like Flash, will automatically use the new SOCKS 5 proxy.

Please note, that your console to the Raspberry Pi has to be open for the connection to work (if you close it, the connection to the remote server will be disconnected and your proxy will be defunct.) We will show you in an upcoming article how to make it permanent.

 

References

Apr 172013
 

Vor kurzem habe ich die Gelegenheit gehabt mich mit Chrono zu treffen, und einen gemeinsamen Nachmittag mit sehr interessanten Gesprächen zu verbringen.

Apollo

Chrono verfolgt mit Apollo die Idee eines weitgehend selbst-erhaltenden, autarken, mobilen Hackerspaces. Er möchte damit auf die Reise gehen, und Leuten die keine Hackerspaces in der Nähe haben die Gelegenheit geben zu basteln, neue Techniken zu lernen und Ideen auszutauschen. Dabei versorgen sich z.B. die zwei Apollo Module über Solarzellen und möglicherweise auch Windenergie mit Strom, es sind Schlafplätze vorhanden, die tagsüber zu Softwarearbeitsplätzen umgerüstet werden, etc.

An Bord von dem Apollo-Projekt soll unter anderem z.B. eine CNC Fräse sein – Chrono überlegt aktuell einen Controller auf Basis des Raspberrys mit dem Realtime Kernel Xenomai zu bauen.

CNC stellt besonders hohe Anforderungen an harte Realtime-Fähigkeiten, um ein präzises Stepping hinzukriegen. Ein Litmus Test für den Raspberry – sollte sich das damit realisieren lassen, sind eine große Reihe anderer Anwendungen unproblematisch möglich, da weniger aufwendig.

Um Chrono und das Apollo Projekt zu unterstützen, haben wir zwei pi3g Raspberry Pis für diesen mobilen Hackerspace gestiftet. Bon voyage!

Dronen-Tracker Antenne und Proxy

Chrono hat für eine Drohne einen Proof Of Concept Tracker mit dem Raspberry Pi aufgebaut. Ebenfalls auf dem Xenomai Realtime Kernel basierend, werden von dem Raspberry Pi direkt über den GPIO Servos angesteuert, die die Antenne (im Testaufbau erstmal nur aus Pappe) positionieren. Das fahren der Antenne funktioniert auch über Stunden hinweg sehr zuverlässig – Chrono hatte mir sie demonstrieren können. (Sie hat für eine zusätzliche Geräuschkulisse zu Chronos’ Workstation und der angenehmen Musik im Hintergrund gesorgt).

Gleichzeitig wird über MAVLINK mit der Drone Kontakt gehalten, das Pi dient hier als MAVLINK Proxy. MAVLINK ist ein kompaktes Protokoll für die Kommunikation mit “Micro Air Vehicles”, d.h. auch besagten Dronen. Da über das MAVLINK Positionsinformationen übergeben werden, kann daraus die Antenne nachgeführt werden, um so optimale Reichweiten der Drone erzielen zu können.

Angedacht sind mehrere Basisstationen die jeweils den Aktionsradius der Drone erweitern können.

Diese Drone könnte auch optimal dazu eingesetzt werden um Kommunikationskanäle offen zu halten, indem sie z.B: WLAN Access Points boosted / ausfindig macht / mesh networks aufbaut …

Der Proof of Concept Code ist leider noch nicht releasebereit. Falls Chrono in dieser Richtung etwas releasen wird / einen Write Up machen wird, werden wir ihn natürlich verlinken. (Chrono stellt üblicherweise sehr hochwertige Step-by-step Anleitungen für ein weites Themengebiet ins Netz).

Xenomai

Xenomai ist wie bereits gesagt ein Realtime-Kernel-Ersatz (Framework) für den stock Linux Kernel. Damit ist hartes Realtime auf dem Raspberry Pi möglich, unter anderem auch stabiles PWM über die GPIO Pins in Software.

Weitere Informationen:

Apr 112013
 

As we have posted earlier, we own an old CanoScan LiDE 30. We are very satisfied with this scanner – but unfortunately it does not work on newer versions of Windows (e.g. Windows 7 64 bit, Windows 8) – Canon “forgot” to release updated drivers.

Raspberry Pi networked scanner sharing

A Raspberry Pi is perfect for a small, low volume server application. Today, we have put together all the pieces necessary to use it to attach the Canon scanner to our network, and scan from Windows once again.

BTW: It looks as though the Fujitsu ScanSnap 1300i might also be supported by SANE. This is the replacement scanner for the Canon flatbed scanner we bought – but it can’t scan books, for instance.

Step by step setup guide:

This guide is written for Raspbian. We have tested it with the latest Raspbian version currently available (2013-02-09).

Get the required packages:

sudo su
aptitude update
aptitude install xinetd sane-utils

xinetd is the Internet superdaemon which will start saned, the “Scanner Easy Access Now” daemon when a network connection to it’s port is opened (saned can’t do that on it’s own).

sane-utils contains the saned. (On Archlinux the package is called simply “sane”)

Raspbian automatically sets up the group saned and the user saned for you. It also adds the user saned to the group scanner.

Configure /etc/default/saned so it will start automatically (RUN=yes):

# Defaults for the saned initscript, from sane-utils

# Set to yes to start saned
RUN=yes

# Set to the user saned should run as
RUN_AS_USER=saned

Start saned, and test whether the scanner is recognized. Ideally you should do this as user saned, to see if all access rights for saned are setup correctly. Your scanner should naturally be attached to the Raspberry Pi. If it draws its power through USB, we recommend to use a powered USB hub.

root@raspberrypi:/home/pi# /etc/init.d/saned start

root@raspberrypi:/home/pi# su -s /bin/sh - saned
No directory, logging in with HOME=/

$ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 008: ID 04a9:220e Canon, Inc. CanoScan N1240U/LiDE 30
Bus 001 Device 007: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse
Bus 001 Device 006: ID 046d:c31c Logitech, Inc. Keyboard K120 for Business

$ scanimage -L
device `plustek:libusb:001:008' is a Canon CanoScan N1240U/LiDE30 flatbed scanner

$ exit

root@raspberrypi:/home/pi#

I have included the # and $ prompt in this listing, so you can distinguish between commands the root user (#) issues and the saned user issues ($)

If you see your scanner here, great. If not – have a look at the documentation and further reading links we will provide at the end of this article.

The USB scanner itself is plug & play – you can attach it to the Raspberry Pi when you feel like scanning, and remove it after you have finished.

Prepare network sharing of the scanner

root@raspberrypi:/etc/xinetd.d# cat /etc/services | grep sane
sane-port       6566/tcp        sane saned      # SANE network scanner daemon

You should see the sane-port line as in the listing. If it is not in there, add it.

root@raspberrypi:/# cd /etc/xinetd.d

root@raspberrypi:/etc/xinetd.d# touch sane-daemon

root@raspberrypi:/etc/xinetd.d# which saned
/usr/sbin/saned

root@raspberrypi:/etc/xinetd.d# nano sane-daemon

This will set up the XInet configuration. Please use the following configuration for the /etc/xinetd.d/sane-daemon file:

service sane-port
            {
              socket_type = stream
              server = /usr/sbin/saned
              protocol = tcp
              user = saned
              group = saned
              wait = no
              disable = no
            }

Note that we used the output from “which saned” in the configuration above. If it is different for you – e.g. on Archlinux – adjust accordingly.

Set up saned to accept connections from your network by editing /etc/sane.d/saned.conf:

# saned.conf
# Configuration for the saned daemon

## Daemon options
# [...]
# data_portrange = 10000 - 10100


## Access list
# [...]
# The hostname matching is not case-sensitive.

#scan-client.somedomain.firm
192.168.1.0/24

#192.168.0.1
#192.168.0.1/29
#[2001:7a8:185e::42:12]
#[2001:7a8:185e::42:12]/64

# [...]

Please adjust the subnet specification 192.168.1.0/24 to your network architecture. You can also explicitly specify single IPs. If you do not edit this file, SaneTwain will hang when contacting your Raspberry Pi scanner server.

Now you can reboot the Raspberry Pi (sudo reboot), and continue to the set up on the Windows side.

Setting up Windows to access the SANE network scanner

We have tested with Windows 7 64 bit & Windows 8 64 bit.

Windows users use “TWAIN” drivers. Luckily, there is an application, which will create a bridge between TWAIN and SANE on the network. The author claims it does not work for 64 bit Windows, but it did work for us. Please report back in the comments about your success / failure stories on different Windows versions.

Download SaneTwain here.

SaneTwain Setup

image

Just enter your Raspberry Pi IP (if you do not know it, “ip addr show” will show you it’s network setup) as the hostname. Port and Username can stay the way they are. Look through the other settings, if you want to. The Mail tab, for instance, offers the possibility to set up an Evernote account you want to scan to.

Before you try to use the TWAIN driver SaneTwain offers, you should set up the hostname using the way we just described (by starting ScanImage.exe).

Scan

Now you’re set up for scanning. Use the “preview” button to acquire a preview, and the “scan” button to save the selected area to a PNG (it will be scanned with better quality, of course). The resolution can be set, also other options.

Wait until the scanner is finished with the preview and has repositioned itself, before you hit the “scan” button.

image

The TWAIN driver works for us, too. (Tested with IrfanView) – this is Windows 8 64 bit. No special tweaks were applied.

Setting up Linux to scan from the network scanner

If you have a Linux box, you can use basically any SANE Frontend to scan using the network.

You need to add the network scanner to a local SANE installation.

Edit /etc/sane.d/net.conf and add the IP of your server. You can specify multiple servers.

image

Test with scanimage –L once again, and after a while you will see your network scanner showing up.

Frontends

Try XSane. Noteworthy is also gscan2pdf which will convert scanned pages to multipage PDFs, and even OCR them for you!

Of course you should be able to scan from another Raspberry Pi on your network, or even the Internet.

simple-scan is a frontend for SANE.

Further Reading & Links

SANE

SaneTwain

How-Tos

We used the following how-tos in building this tutorial. Thanks, guys!

Apr 092013
 

Wir haben hier im Büro einen LIDE 30 von CanoScan, der leider keine Treiberunterstützung für Windows 8 / Windows 7 (zumindestens die 64 bit Versionen hat). Mein Bruder hat auf seinem Laptop mit Ubuntu das Programm “simple scan” benutzt, um den Scanner zu benutzen – ohne jegliche Treiberinstallation.

Die Idee liegt natürlich nahe, das auch auf dem Raspberry auszuprobieren.

Der Scanner wird über unseren powered USB Hub an das Raspberry Pi angeschlossen – der Canon LIDE 30 bezieht seinen Strom über USB, und das wollen wir dem Raspberry und seiner Polyfuse nicht direkt zumuten.

Mit startx ist schnell X-Windows aufgerufen, und unter einer Konsole mit aptitude install simple-scan nach einiger Zeit die GUI fürs Scannen installiert.

Mit simple-scan wird sie dann unter der Kommandozeile geöffnet und erkennt den (mittlerweile angeschlossenen) Scanner vollautomatisch. Keine Treibersuche – die Magie von Linux!

Die Oberfläche ist einfach und weitgehend selbsterklärend. Das Ausgabeformat kann man im Speicherndialog unten links einstellen.

Zur Geschwindigkeit: die Prozessorauslastung lag wiedermal bei 100 %, der Scan war vielleicht anderthalb mal so langsam wie unter Ubuntu auf einem modernen Desktoprechner. Die Geschwindigkeit beim Speichern (Konvertierung) war ebenfalls nicht berauschend, für den gelegentlichen Scan mit altem Equipment jedoch akzeptabel.

Eventuell ließe sich hier noch mit einer Class 10 SD Karte (wir hatten mit einer Class 4 getestet), sowie vielleicht einer AJAX – Weboberfläche anstelle von XWindows optimieren. Generell würde ich gerne auch mal das Raspberry im Betrieb von einem RAM Image sehen – ich habe die SD Karte im Verdacht es extrem auszubremsen, egal welche Klasse.

Wir haben hier noch einen Fujitsu ScanSnap 1300i – es wäre interessant was man mit ihm und dem Raspberry Pi so anstellen kann. Mir schwebt da ein Netzwerkserver für den ScanSnap vor …

Apr 072013
 

For our production process (for the upcoming Raspberry Pi media centre edition in a nifty transparent red case) we need to mass-extract the Broadcom SoC’s serial numbers. Doing this manually would be a chore for 50 Raspberry Pis, so we came up with a quick & dirty solution in Ruby.

We’d like to share that with you guys – the code is released into the public domain. 

Download the script:

Setup

karthikeyan_ruby_flatmix

The script is supposed to be run on a master Raspberry Pi. You need to install some prerequisites (nmap, Ruby, Ruby gems) for it to be able to run:

aptitude install ruby
aptitude install nmap

gem install nmap-parser
gem install net-ssh

The script is written in Ruby. Other languages (e.g. Python) could be used, too, of course. I just feel really at home with Ruby. nmap is used to scan the network (you can even scan for ports, etc.). Have a look at this site for some further information about nmap usage to scan a network.

The gems are Ruby extension packages. Ruby has its own package manager “gem” which will download and setup the packages for you. nmap-parser is a wrapper and interface for nmap, net-ssh is an interface to SSH.

Unzip the script, put it into a new folder and make it executable ( chmod +x getips-v1.rb ).

Edit the script to reflect your network (line 35 – replace 192.168.1.0/24 with the network range you want to scan), the expected amount of Raspberry Pis per batch (line 8) you will be processing.

Edit the SSH part to reflect the password setup of your Raspberry Pis (here defaulting to “pi” / “raspberry”) and what should be done on them (line 62 ff).

If you really want to, you could uncomment the “espeak” line (line 12) to enable speech output from your Raspberry as a prompt to setup the next batch, etc. I have disabled it after some experimenting – the script uses a mix of straight “puts” and “speak” (which in turn will also use puts to output to the default output) – you would need to do some more editing for this to be really consistent.

Usage

Start the script ( ./getips-v1.rb ) – it uses the shebang notation, so ruby will be called automagically to parse and execute the script.

The script will show you your master Raspberry’s serial and IP adress – it’s IP and serial will be ignored from now on (no processing done on it).

Afterwards it will enter into an infinite loop (which you can terminate by entering q or x + enter when prompted, or Ctrl + C at any point). It will scan your network for Raspberry Pis (determined by the MAC vendor – so be sure to attach your Raspberrys via their own LAN port, not WiFi – or modify it to work!). If less Pis are found than expected (default is 7), it offers you to rescan the network – allowing for additional Raspberrys to come up if they did not boot fast enough during the first scan. If you want, you can skip the rescan by entering n + enter when prompted.

After the scan, it will connect to every Raspberry in turn, login via SSH with the default password and user (pi / raspberry), get the SoC serial, halt the Raspberry and disconnect.

The serials will be written to a file which will be saved to the same directory.

The serial extraction is just a sample use, of course. You could use it to install packages, modify configuration files, and much, much more.

After having finished the tasks you requested, it will offer you to quit the script (q or x + enter) or read another batch. It will loop forever if you want to.

For more sophisticated requirements

We recommend you to look into Capistrano or similar tools for batch automation. Capistrano is also Ruby based, and uses a “DSL” to describe the automation tasks.

Feel free to contact us, if you need it custom tailored to your requirements – we charge fair rates, especially if the result can be released as open source.

Optimization WordPress Plugins & Solutions by W3 EDGE