NSLU2 SlugOS/BE 4.8 beta, Software Setup for "Heizung"

In order to run the application "Heizung" ipkg and ipkg-opt must be setup:

Install ipkg-opt (in /root, user root, einfügen in Putty mit RE MausTaste):
Info page: http://www.nslu2-linux.org/wiki/Optware/Slugosbe
ipk_name=`wget -qO- $feed/Packages | awk '/^Filename: ipkg-opt/ {print $2}'`
wget $feed/$ipk_name
tar -xOvzf $ipk_name ./data.tar.gz | tar -C / -xzvf -
sed -i -e 's|/stable|/unstable|' /opt/etc/ipkg.conf
Temporär: $ PATH=PATH$:/opt/bin
Test: $ env
SSH_CLIENT= 2372 22

Optware List in /opt/lib/ipkg/lists/optware

root@LKG95AC9E:~$ ipkg-opt update
Downloading http://ipkg.nslu2-linux.org/feeds/optware/slugosbe/cross/unstable/Packages.gz
Inflating http://ipkg.nslu2-linux.org/feeds/optware/slugosbe/cross/unstable/Packages.gz
Updated list of available packages in /opt/lib/ipkg/lists/optware
Successfully terminated.

Package List in /var/lib/ipkg/cross
  ln -s /var/lib/ipkg/cross /usr/lib/ipkg/cross  # symlink

ipkg update

Then the following programs must be installed:

ipkg-opt install mc  # Midnight Commander
ipkg-opt install digitemp  # one wire temperature sensor software
ipkg download coreutils  # for command "groups"
ipkg install coreutils-doc
ar -x coreutils_5.3.0-r2_armv5teb.ipk data.tar.gz
tar -xzf data.tar.gz "./usr/bin/groups.coreutils"
cp usr/bin/groups.coreutils /usr/bin/groups  # for WinSCP needed
Edit /usr/bin/groups: change "id -Gn" -> "id -gn", because busybox does not have a "-G" option.
ipkg install gnuplot  # and install and test it
ipkg install gnuplot-x11
WinSCP Copy Freesans.ttf to /usr/share/fonts/truetype/freefont/FreeSans.ttf
WinSCP Copy gnuplotM.png_FreeSans to /home/rudi/heizung
WinSCP Copy heizdata.txt to /home/rudi/heizung
rudi: tail -n300 heizdata.txt >heizdata300.txt
rudi: tr ";" " " <heizdata300.txt >heizdata300s.txt
From the Meteohub Installation copy 2 files with FreeType support.
WinSCP Copy gnuplot (2.5 MB) /usr/bin
WinSCP Copy libgd.so.2.0.0. (540 KB) /usr/lib

ipkg-opt install htop
ipkg install joe  # emacs like editor
ipkg install man
ipkg install man-pages
ipkg install nmap  # check for www server running
ipkg install ntp   # time synchronisation
ipkg install ntp-utils
ipkg-opt install python25 # 2.5.4-1
ipkg-opt install py25-serial
ipkg-opt install python  # symlink to python25

For an USB-RS232 serial modul install:

ipkg install kernel-module-usbserial
ipkg install kernel-module-pl2303
depmod -a
- plugin USB-RS232 module in USB port disk2
modprobe usbserial
modprobe pl2303
 - test with: dmesg
<6>usb 3-1: new full speed USB device using ohci_hcd and address 2
<6>usb 3-1: configuration #1 chosen from 1 choice
<6>usbcore: registered new interface driver usbserial
<6>drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
<6>usbcore: registered new interface driver usbserial_generic
<6>drivers/usb/serial/usb-serial.c: USB Serial Driver core
<6>drivers/usb/serial/usb-serial.c: USB Serial support registered for pl2303
<6>pl2303 3-1:1.0: pl2303 converter detected
<6>usb 3-1: pl2303 converter now attached to ttyUSB0
<6>usbcore: registered new interface driver pl2303
<6>drivers/usb/serial/pl2303.c: Prolific PL2303 USB to serial adaptor driver
ipkg install usbutils # lsusb
chmod a+rw /dev/ttyUSB0 # otherwise user can not access

Now add an user to the system:

adduser rudi  # pw: xxx
edit /etc/hosts  (rudi2, rudi7)

Add moin wiki 1.8.1

ipkg-opt install py25-moin
folder "moin" is in /opt/share/moin, folder "MoinMoin" is in /opt/lib/python25/site-packages
# setup wiki instance with user rights
WinSCP copy /opt/share/moin to /home/rudi
chown -R rudi:rudi moin
cd /home/rudi/moin
tar -xzf underlay.tar.gz # system pages
cp server/moin ./moin # get startup script an configure it
test with: ./moin server standalone --show-timing --start 2>&1 | logger
WinSCP Copy moin.sh to /etc/init.d # shell script for Linux init
set execute bits = 755
ln -s /etc/init.d/moin.sh /etc/rc3.d/S81moin
ln -s /etc/init.d/moin.sh /etc/rc0.d/K81moin
Allow "xmlrpc" -> edit MoinMoin/config/multiconfig.py 'actions excluded' ->  [#'xmlrpc',
config user RudolfReuter
login user RudolfReuter
cat /proc/meminfo
htop -> moin uses 32% memory (threadLimit = 10 in wikiserverconfig.py)
htop -> moin uses 30.5% memory (threadLimit = 5 in wikiserverconfig.py)
search SystemPagesSetup
install German -> click on install in front of german.zip
restart moin in order to take effect
In order to have the page load timing on the web page you have to add in wikiconfig.py:
    show_timings = True

Now setup the webcam application:

~ mkdir /home/rudi/heizung
WinSCP copy uvccapture to /opt/bin and set rights to 755
$ mkdir /lib/modules/
$ mkdir /lib/modules/
$ mkdir /lib/modules/
Webcam modules ar in archive modules.tar
WinSCP copy to video: v4l1-compat.ko, v4l2-compat-ioctl32.ko, videodev.ko
WinSCP copy to video/uvc: uvcvideo.ko
$ depmod -a
plugin webcam to USB port.
<6>usb 1-3: new high speed USB device using ehci_hcd and address 4
<6>usb 1-3: configuration #1 chosen from 1 choice
<6>Linux video capture interface: v2.00
<6>uvcvideo: Found UVC 1.00 device <unnamed> (046d:09a4)
<6>uvcvideo: UVC non compliance - GET_DEF(PROBE) not supported. Enabling workaround.
<6>input: UVC Camera (046d:09a4) as /class/input/input1
<6>usbcore: registered new interface driver uvcvideo
<6>USB Video Class driver (v0.1.0)
root@LKG95AC9E:~$ ls -ls /dev/v*  # test if video device was created
   0 crw-rw----    1 root     video     81,   0 Jan 18 17:11 /dev/video0
$ uvccapture -q90 # gives shot.jpg 320x240 px, 12 KB
Add rudi to /etc/group "video:*:44:rudi" # ist did not help
$chmod a+rw /dev/video0 # now calling uvccapture by user works
WinSCP copy webcam3.sh to /home/rudi/heizung
This shell script takes every 30 s a shot and stores the image to /var/volatile/www

Last the "Heizung" application:

WinSCP copy heizung to /home/rudi/heizung and /etc/init.d
chmod uga+x /etc/init.d/heizung.sh

# link to start automatic
$ sudo ln -s /etc/init.d/heizung.sh /etc/rc3.d/S82heizung

$ ipkg-opt install sudo
edit /opt/etc/sudoers -> add user: rudi ALL=(ALL) ALL
ln -s /var/volatile/www/shot.jpg /home/rudi/moin/htdocs/shot.jpg
ln -s /var/volatile/www/heizdata.csv /home/rudi/moin/htdocs/heizdata.csv
WinSCP copy GetVarURL2.py to /home/rudi/moin/data/plugin/macro

If because of lack of memory the moin wiki engine was kill from the kernel, do a restart (in webcam3.sh):

  # if dynamic memory allocation is too much (lack of swap), kernel kills process.
  # check for running moin process
  wcval=`ps | grep moin | grep python | wc -l`
  if test $wcval -lt "2" ; then   # process died -> restart
    /etc/init.d/moin.sh start
  # check for running heizung process
  wcval=`ps | grep heizung | grep python | wc -l`
  if test $wcval -lt "1" ; then    # process died -> restart
    /etc/init.d/heizung.sh start

Liste der Seiten in dieser Category:

Go Back to CategoryNslu2 or StartSeite ; KontaktEmail (ContactEmail)

NSLU2SlugOSHeizungSW (last edited 2012-09-03 13:28:16 by dslb-084-058-182-245)