Home

The Genesis Toolkit

Stereo 3D

Linux

Projects
 Roaming NSLU
 Worldmap

Gallery

Download

Impressum

Email:
Latest update
April 14 2008 20:07:43
countercountercountercountercounter
















































































Roaming NSLU

This project started when i replaced my small home web server based an a Linksys NSLU2 by a more powerfull hardware plattform (Fujitsu-Siemens Scovery xS).
I thought about a new funtionality for that smart small device and came to the idear of having a small car computer, the Roaming-NSLU, that serves the following requirements:

Project Survey
Debian Linux done
Additional USB Ports done
LCD Display open
IR Remote control open
GPS Data logging done
Sound interface (for MP3 Player) done
WLAN Connectivity done
USB-Cam open
Power Supply at 12V DC open
Battery Power Backup open



Changes to the System

Most of this is taken from http://www.pcprobleemloos.nl/nslu2/doku.php and www.cyrius.com/debian/nslu2

Change Power Button to cause Shutdown instead of Reboot:
vi /etc/inittab

::
# What to do when CTRL-ALT-DEL is pressed.
#ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -h now
::


Saving Memory: Disbale ipv6
vi /etc/modprobe.d/aliases
::
#alias net-pf-10 ipv6
alias net-pf-10 off
::


Saving Memory: Disable Serial Port by commenting out getty in /etc/inittab
vi /etc/inittab
::
#T0:23:respawn:/sbin/getty -L ttyS0 115200 linux
::


Preserve Flash
nslu:~# touch /.ext3flash

Have to find out how to do this persisting after reboot:
nslu:~# cat /proc/sys/vm/swappiness
60
nslu:~# echo "0" > /proc/sys/vm/swappiness
nslu:~# cat /proc/sys/vm/swappiness
0

vi /etc/default/syslogd
::
SYSLOGD="-m 0"




Additional USB Ports
To enable so much functionality i had to add two additional USB-Ports to the NSLU. This task is well described at www.nslu2-linux.org
To solder the cables to the resistors is fiddly thing, but finaly i made it. Just to see that my concept of leading the USB-Cables from bottom side of the PCB to the upper side of the case were i drilled the outlet wholes was impossible.

Hmm... I had no longer USB-Cables and the wires had to go to the top side of the PCB. I solved this by cutting a small cavity out of the PCB unsing a multifunctional rotary tool. Before that I checked that at this place on the PCB was no other conductors than ground and i did not destroy any other connections (marked by the green arrow in the picture).
Cable ties avoid the cable to be pulled out of the case.

Fortunately the NSLU2 further on worked after this crude procedure and the USB-Cables are neat installed.






USB Soundcard
The sound card is a small device I purchased for some few Euros
The Installation was quite simple:
nslu:~# modprobe snd-usb-audio
nslu:~# lsmod
Module                  Size  Used by
snd_usb_audio          76416  0 
snd_pcm                77960  1 snd_usb_audio
snd_timer              24164  1 snd_pcm
snd_page_alloc         10408  1 snd_pcm
snd_usb_lib            17344  1 snd_usb_audio
snd_rawmidi            25888  1 snd_usb_lib
snd_seq_device          8940  1 snd_rawmidi
snd_hwdep               9860  1 snd_usb_audio
snd                    52756  6 snd_usb_audio,snd_pcm,snd_timer,snd_rawmidi,snd_seq_device,snd_hwdep
  :  :  :  : 
usbcore               126952  7 snd_usb_audio,snd_usb_lib,usbhid,usb_storage,ehci_hcd,ohci_hcd

Istall some software:
nslu:~# apt-get install mpd alsa-utils alsaplayer-alsa oss-compat madplay

Install Music Player Daemon (MPD) allows remote access for playing audio files (Ogg-Vorbis, FLAC, MP3, Wave, and AIFF), streams (Ogg-Vorbis, MP3):
nslu:~# apt-get install mpd alsa-utils alsaplayer-alsa oss-compat madplay


I had a problem with /dev/dsp that was not available after reboot.
jschramm@nslu:~$ ls -l /dev/dsp
ls: /dev/dsp: No such file or direct

nslu:~# cat /dev/sndstat 
Sound Driver:3.8.1a-980706 (ALSA v1.0.12rc1 emulation code)
Kernel: Linux nslu 2.6.18-6-ixp4xx #1 Tue Feb 12 00:57:53 UTC 2008 armv5tel
Config options: 0

Installed drivers: 
Type 10: ALSA emulation

Card config: 
C-Media USB Headphone Set   at usb-0000:00:01.2-1.2, full speed

Audio devices: NOT ENABLED IN CONFIG

Synth devices: NOT ENABLED IN CONFIG

Midi devices: NOT ENABLED IN CONFIG

Timers:
7: system timer

Mixers: NOT ENABLED IN CONFIG

To solve this I had to add the modules snd-mixer-oss and snd-pcm-oss to the /etc/modules file:
nslu:~# cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
snd-mixer-oss
snd-pcm-oss

After Reboot:
nslu:~$ ls -l /dev/dsp
crw-rw---- 1 root audio 14, 3 Mar 24 10:08 /dev/dsp

nslu:~# cat /dev/sndstat 

Sound Driver:3.8.1a-980706 (ALSA v1.0.12rc1 emulation code)
Kernel: Linux nslu 2.6.18-6-ixp4xx #1 Tue Feb 12 00:57:53 UTC 2008 armv5tel
Config options: 0

Installed drivers: 
Type 10: ALSA emulation

Card config: 
C-Media USB Headphone Set   at usb-0000:00:01.2-1.2, full speed

Audio devices:
0: USB Audio (DUPLEX)

Synth devices: NOT ENABLED IN CONFIG

Midi devices: NOT ENABLED IN CONFIG

Timers:
7: system timer

Mixers:
0: USB Mixer


Test playing a MP3-File
nslu:~/my-temp-03$ madplay andrew_sisters_1_youre_a_lucky_fellow_mr_smith.mp3 
MPEG Audio Decoder 0.15.2 (beta) - Copyright (C) 2000-2004 Robert Leslie et al.

Test playing Streaming Audio-MP3:
nslu:~/my-temp-03$ wget http://two.pop-radio.de:8030 -O - | madplay -
MPEG Audio Decoder 0.15.2 (beta) - Copyright (C) 2000-2004 Robert Leslie et al.
--16:02:15--  http://two.pop-radio.de:8030/
           => `-'
Resolving two.pop-radio.de... 87.230.58.54
Connecting to two.pop-radio.de|87.230.58.54|:8030... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://85.214.109.130:7030 [following]
--16:02:15--  http://85.214.109.130:7030/
           => `-'
Connecting to 85.214.109.130:7030... connected.
HTTP request sent, awaiting response... 200 No headers, assuming HTTP/0.9
Length: unspecified

Because the NSLU2 has no display it may be interesting to make it tell something (let it tell the current date and time):
apt-get install espeak
espeak "`date "+%dth of %B; %Y; %H hours; %M minutes; %S seconds"`"

After some successfull test the USB Sound Dongle refused to work anymore. The USB connection got lost, and after replugging it is not properly recognised anymore. Seems the USB Sound Dongle refuses to accept an address. I saw the same with this device on another computer.
On the net i found some hints regarding this error message, that point to a bad cable connection. But as I also plugged it directly into one of the onboard USB ports of the NSLU, this cannot be the case here. Seems as the controller on the USB Sound-Dongle is kind of buggy, I declared the device defective and get another one.

Mar  1 16:35:58 nslu kernel: usb 1-3: new low speed USB device using ohci_hcd and address 101
Mar  1 16:35:59 nslu kernel: usb 1-3: device descriptor read/64, error -110
Mar  1 16:35:59 nslu kernel: usb 1-3: device descriptor read/64, error -110
Mar  1 16:35:59 nslu kernel: usb 1-3: new low speed USB device using ohci_hcd and address 102
Mar  1 16:35:59 nslu kernel: usb 1-3: device descriptor read/64, error -110
Mar  1 16:35:59 nslu kernel: usb 1-3: device descriptor read/64, error -110
Mar  1 16:36:00 nslu kernel: usb 1-3: new low speed USB device using ohci_hcd and address 103
Mar  1 16:36:00 nslu kernel: usb 1-3: device not accepting address 103, error -110
Mar  1 16:36:00 nslu kernel: usb 1-3: new low speed USB device using ohci_hcd and address 104
Mar  1 16:36:01 nslu kernel: usb 1-3: device not accepting address 104, error -110


I brought the device back to the shop and got a new one that works fine.

Set the volumes:
nslu:~$ amixer set PCM 10635
Simple mixer control 'PCM',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 17152
  Mono:
  Front Left: Playback 10635 [62%] [on]
  Front Right: Playback 10635 [62%] [on]

nslu:~$ amixer set Mic 0
Simple mixer control 'Mic',0
  Capabilities: cvolume cswitch cswitch-joined
  Capture channels: Mono
  Limits: Capture 0 - 6096
  Mono: Capture 0 [0%] [on]









GPS-Receiver

The USB GPS receiver is recognised as simple serial device
nslu:~# lsusb
Bus 003 Device 005: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port

Easy access to the GPS data
nslu:~# cat /dev/ttyUSB0 |grep -v "^$"
$GPGGA,165619.000,5231.1673,N,00645.8011,E,1,04,5.8,29.2,M,47.4,M,,0000*6D
$GPGSA,A,3,04,13,08,23,,,,,,,,,6.6,5.8,3.2*31
$GPRMC,165619.000,A,5231.1673,N,00645.8011,E,0.28,304.22,140308,,,A*6B
$GPGGA,165620.000,5231.1677,N,00645.7994,E,1,04,5.8,27.0,M,47.4,M,,0000*64
$GPGSA,A,3,04,13,08,23,,,,,,,,,6.6,5.8,3.2*31


After the NSLU is really roaming, I'll put some functionality to it.






WLAN USB Adapter

My USB WLAN Dongle comes up as RT2501USB Wireless Adapter.

nslu:~# lsusb
Bus 003 Device 004: ID 148f:2573 Ralink Technology, Corp. RT2501USB Wireless Adapter


I had to compile and install the rt73 kernel module from rt2x00.serialmonkey.com
nslu: apt-get install make module-assistant build-essential linux-headers-`uname -r` wireless-tools
: : :

nslu: wget http://rt2x00.serialmonkey.com/rt73-cvs-daily.tar.gz
nslu: tar -xvf rt73-cvs-daily.tar.gz
nslu: cd ./rt73-cvs-2008030710/Module

nslu:~/rt73-cvs-2008030710/Module# make arm
make[1]: Entering directory `/usr/src/linux-headers-2.6.18-5-ixp4xx'
  CC [M]  /root/my-temp-01/rt73-cvs-2008030710/Module/rtmp_main.o
  CC [M]  /root/my-temp-01/rt73-cvs-2008030710/Module/mlme.o
  CC [M]  /root/my-temp-01/rt73-cvs-2008030710/Module/connect.o
  CC [M]  /root/my-temp-01/rt73-cvs-2008030710/Module/rtusb_bulk.o
  CC [M]  /root/my-temp-01/rt73-cvs-2008030710/Module/rtusb_io.o
  CC [M]  /root/my-temp-01/rt73-cvs-2008030710/Module/sync.o
  CC [M]  /root/my-temp-01/rt73-cvs-2008030710/Module/assoc.o
  CC [M]  /root/my-temp-01/rt73-cvs-2008030710/Module/auth.o
  CC [M]  /root/my-temp-01/rt73-cvs-2008030710/Module/auth_rsp.o
  CC [M]  /root/my-temp-01/rt73-cvs-2008030710/Module/rtusb_data.o
  CC [M]  /root/my-temp-01/rt73-cvs-2008030710/Module/rtmp_init.o
  CC [M]  /root/my-temp-01/rt73-cvs-2008030710/Module/sanity.o
  CC [M]  /root/my-temp-01/rt73-cvs-2008030710/Module/rtmp_wep.o
  CC [M]  /root/my-temp-01/rt73-cvs-2008030710/Module/rtmp_info.o
  CC [M]  /root/my-temp-01/rt73-cvs-2008030710/Module/rtmp_tkip.o
  CC [M]  /root/my-temp-01/rt73-cvs-2008030710/Module/wpa.o
  CC [M]  /root/my-temp-01/rt73-cvs-2008030710/Module/md5.o
  CC [M]  /root/my-temp-01/rt73-cvs-2008030710/Module/rt2x00debug.o
  LD [M]  /root/my-temp-01/rt73-cvs-2008030710/Module/rt73.o
  Building modules, stage 2.
  MODPOST
  CC      /root/my-temp-01/rt73-cvs-2008030710/Module/rt73.mod.o
  LD [M]  /root/my-temp-01/rt73-cvs-2008030710/Module/rt73.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.18-5-ixp4xx'
*** Module rt73.ko built successfully
nslu:~/my-temp-01/rt73-cvs-2008030710/Module# 
nslu:~/my-temp-01/rt73-cvs-2008030710/Module# 
nslu:~/my-temp-01/rt73-cvs-2008030710/Module# make install
*** Install module in /lib/modules/2.6.18-5-ixp4xx/extra ...
make[1]: Entering directory `/usr/src/linux-headers-2.6.18-5-ixp4xx'
  INSTALL /root/my-temp-01/rt73-cvs-2008030710/Module/rt73.ko
  DEPMOD  2.6.18-5-ixp4xx
make[1]: Leaving directory `/usr/src/linux-headers-2.6.18-5-ixp4xx'
/sbin/depmod -a
*** Update /etc/modprobe.d/ralink alias for wlan*
*** Install firmware in /lib/firmware ...
*** Check old config ...


The interface comes up
nslu:~/my-temp-03/WPA_Supplicant# ifconfig wlan0 up

nslu:~# tail -f /var/log/syslog
Mar  9 14:57:19 nslu kernel: rt73: init
Mar  9 14:57:19 nslu kernel: rt73: idVendor = 0x148f, idProduct = 0x2573 
Mar  9 14:57:20 nslu kernel: rt73: Interface up for first time, activating permanent MAC
Mar  9 14:57:20 nslu kernel: rt73: Active MAC is: 00:10:60:a0:9e:ac.
Mar  9 14:57:20 nslu kernel: rt73: Local MAC = 00:10:60:a0:9e:ac
Mar  9 14:57:20 nslu kernel: usbcore: registered new driver rt73
Mar  9 14:57:20 nslu kernel: rt73: driver version - 1.0.3.6 CVS


The rt73 does not work with wpasupplicant but has it's own wpa configuration tools. So all the WPA configuration goes into /etc/network/interfaces:
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
    iface eth0 inet static
    address 192.168.0.3
    netmask 255.255.255.0
    network 192.168.0.0
    broadcast 192.168.0.255
    post-up /usr/bin/beep -l 100 -f 6

auto wlan0 
iface wlan0 inet static
    #pre-up rmmod rt73
    pre-up iwpriv wlan0 set NetworkType=Infra
    pre-up iwpriv wlan0 set AuthMode=WPAPSK
    pre-up iwpriv wlan0 set EncrypType=TKIP
    pre-up iwpriv wlan0 set SSID="yyyyyyyy"
    pre-up iwpriv wlan0 set WPAPSK=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    pre-up iwpriv wlan0 set SSID="yyyyyyyy"
    address 192.168.0.50
    netmask 255.255.255.0
    network 192.168.0.0
    broadcast 192.168.0.255
    gateway 192.168.0.1
    dns-nameservers 192.168.0.1
    dns-search domus
    post-up route del default
    post-up route add default gw 192.168.0.1 wlan0
    post-up /usr/bin/beep -l 100 -f 12


Actually there's a strange behavior of networkingon NSLU, when i boot without the ethernet cable plugged, in the wlan interface is also not working.
When i replug the ethernet cable, the wireless network also comes up. When i ifconfig eth0 down and unplug the ethernet cable the wlan does still work.

Strange, after some meditation on the interfaces file I noticed the commented line # The primary network interface and had the idea to just change the sections for the interfaces, so lets wlan0 be my primary interface and eth0 an additional one.
After reboot the NSLU is on Air (even without ethernet cable plugged in)
So thats my current /etc/network/interfaces

nslu:~# cat /etc/network/interfaces 
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto wlan0
iface wlan0 inet static
    pre-up iwpriv wlan0 set NetworkType=Infra
    pre-up iwpriv wlan0 set AuthMode=WPAPSK
    pre-up iwpriv wlan0 set EncrypType=TKIP
    pre-up iwpriv wlan0 set SSID="yyyyyyyyy"
    pre-up iwpriv wlan0 set WPAPSK=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    pre-up iwpriv wlan0 set SSID="yyyyyyyyy"
    address 192.168.0.50
    netmask 255.255.255.0
    network 192.168.0.0
    broadcast 192.168.0.255
    gateway 192.168.0.1
    dns-nameservers 192.168.0.1
    dns-search domus
    post-up route del default
    post-up route add default gw 192.168.0.1 wlan0
    post-up /usr/bin/beep -l 100 -f 12


#allow-hotplug eth0
auto eth0
    iface eth0 inet static
    address 192.168.0.3
    netmask 255.255.255.0
    network 192.168.0.0
    broadcast 192.168.0.255
    post-up /usr/bin/beep -l 100 -f 6





USB-Cam
... to be continued ...










12V Power Supply with Battery Backup
... to be continued ...















Joerg Schrammel - - Duisburg Germany