Dockstar Heizung

An old NSU2 application was ported to the Dockstar computer.

2016-08-04 Now it is ported to an Asus netbook 900A-32 with Ubuntu 1604.

Help for Midnight Commander

Software

The operating system is Linux Debian Wheezy, see DockStarDebian.

2016-08-04 Ubuntu 1604

Additional software is needed:

# Install package
$ sudo apt-get install digitemp
# Link the RS232 interface
$ sudo ln -s /usr/bin/digitemp_DS9097 /usr/bin/digitemp

# Install package
$ sudo apt-get install fswebcam

# example call at /dev/video1 (video0 = Netbook camera)
$ fswebcam -d /dev/video1 -S 4 snap.jpg

* pyserial - RS232 serial interface module for Python

# install Python installer PIP
$ sudo apt-get install python-pip

# install package
$ sudo pip install pyserial

$ sudo adduser rudi dialout
or
$ sudo usermod -a -G dialout rudi

# You need to logout and login to make it work
# check it
$ id rudi
uid=1000(rudi) gid=1000(rudi) Gruppen=1000(rudi),4(adm),20(dialout),24(cdrom),27(sudo),30(dip),33(www-data),44(video),46(plugdev),113(lpadmin),128(sambashare)

$ sudo mkdir /var/volatile
$ sudo mkdir /var/volatile/www
$ sudo chown -R www-data:www-data /var/volatile/www

* gnuplot - use for drawing a diagram

# Install package
$ sudo apt-get install gnuplot

$ sudo apt-get install ttf-bitstream-vera

Software adoptions

#---- For Dockstar ONLY -----#
# file /etc/network/interfaces

auto lo eth0
iface lo inet loopback
#iface eth0 inet dhcp

# use static address
iface eth0 inet static
address 192.168.17.90
netmask 255.255.255.0
network 192.168.17.0
broadcast 192.168.17.255
gateway 192.168.17.1

/!\ Not for Ubuntu 1604.

network udev rules, check the MAC number if the network does not work. At boot time it is shown in the log, that eth0 is renamed to eth1.

# file /etc/udev/rules.d/70-persistent-net.rules

# Unknown net device (/devices/platform/mv643xx_eth_port.0/net/eth0) (mv643xx_eth_port)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:23:54:58:02:9f", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

$ sudo chmod a+rw /dev/video0

# USB information, for webcam and netbook camera
$ lsusb
Bus 001 Device 004: ID 046d:09a4 Logitech, Inc. QuickCam E 3500
Bus 001 Device 002: ID 093a:2700 Pixart Imaging, Inc.
...

# check if camera is found (Ubuntu 1604)
$ cat /var/log/syslog | grep 46d
Aug  4 12:57:18 FADS90 kernel: [    3.191156] usb 1-5: New USB device found, idVendor=046d, idProduct=09a4
Aug  4 12:57:18 FADS90 kernel: [   13.561613] uvcvideo: Found UVC 1.00 device <unnamed> (046d:09a4)
Aug  4 12:57:18 FADS90 kernel: [   13.578807] input: UVC Camera (046d:09a4) as /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0/input/input10

# check for device (Ubuntu 1604)
$ ls -ls /dev/vi*
0 crw-rw-rw-+ 1 root video 81, 0 Aug  4 12:57 /dev/video0
0 crw-rw-rw-+ 1 root video 81, 1 Aug  4 12:57 /dev/video1

# add program "fswebcam" to group "video"
$ sudo chown root:video /usr/bin/fswebcam

$ sudo adduser rudi video
or
$ sudo usermod -a -G video rudi

# You need to logout and login to make it work

# check
$ id rudi
uid=1001(rudi) gid=1001(rudi) Gruppen=1001(rudi),20(dialout),27(sudo),33(www-data),44(video)

# data collection
$ sudo ln -s /etc/init.d/heizung.sh /etc/rc2.d/S07heizung
# web server
$ sudo ln -s /etc/init.d/moin_sas.sh /etc/rc2.d/S07moin_sas

Trouble shooting

$ ps -Af | grep heiz
root      2231     1  0 18:47 ?        00:00:00 /usr/bin/sudo -u rudi /usr/bin/python /home/rudi/heizung/heizung20.py
rudi      2253  2231  0 18:47 ?        00:00:00 /usr/bin/python /home/rudi/heizung/heizung20.py
root      2254     1  0 18:47 ?        00:00:00 /usr/bin/sudo -u rudi /home/rudi/heizung/webcam6.sh
rudi      2258  2254  0 18:47 ?        00:00:00 /bin/sh /home/rudi/heizung/webcam6.sh
rudi      3996  3603  0 18:58 pts/4    00:00:00 grep --color=auto heiz

$ ps -Af | grep moin
www-data  3888     1  0 18:56 ?        00:00:00 python /home/rudi/moin-1.9.7/moin server standalone --user=www-data --group=www-data --start

The shell script /etc/init.d/heizung.sh should give for the moin standalone web server the logging:

$ tail /var/log/syslog
Aug  5 18:56:15 FADS90 rudi: Starting web server: moin

$ tail moin-1.9.7/moin_rot.log
2016-08-05 18:56:15,840 INFO MoinMoin.log:135 using logging configuration read from "/home/rudi/moin-1.9.7/wikiserverlogging.conf"
2016-08-05 18:56:15,841 INFO MoinMoin.log:157 Running MoinMoin 1.9.7 release code from /home/rudi/moin-1.9.7/MoinMoin
2016-08-05 18:56:17,080 INFO MoinMoin.web.serving:129 Running as uid/gid 33/33
2016-08-05 18:56:17,081 INFO werkzeug:116  * Running on http://localhost:8080/

Video image capture problem

Video image capture problem every several days, there are no more webcam picture updates:

# if there is in the log:
user.err kernel: [  670.140322] uvcvideo: Failed to set UVC probe control : -32 (exp. 26).

# repair with:
$ sudo rmmod uvcvideo
$ sudo modprobe uvcvideo

In order to automate the repair I have done the following.

# changes made to file webcam6.sh

# in order to not write so frequently to the USB-stick a RAM disk is used for logging
$PREFIXCMD/fswebcam -d/dev/video0 -q -S 4 $tempfile 2>&1 | logger

# check for a failure in the log file, after calling fswebcam
  FAILED=$(logread | tail | grep failed | wc -l)

# in case of a failure, create the signal file "uvc_failure.log"
  if [ $FAILED -ne 0 ] ; then
    touch "$HZPATH/uvc_failure.log"
    echo "Create uvc_failure.log" 2>&1 | logger
  fi

# uvc_reload.sh
# reload kernel module uvcvideo in case of a malfunction
# run by a root cron job every 10 minutes
# setup with: $ sudo crontab -e
# By default PATH is only /bin and /usr/bin
# PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# */10 * * * * /home/rudi/heizung/uvc_reload.sh > /dev/null 2>&1
#
# 2013-05-15 RudolfReuter

# test for function
#echo "test from uvc_reload.sh" 2>&1 | logger

if [ -e "/home/rudi/heizung/uvc_failure.log" ] ; then
    rmmod uvcvideo
    RETVAL=$?
    echo "rmmod uvcvideo result: $RETVAL" 2>&1 | logger
    if [ $RETVAL -eq 0 ] ; then
        modprobe uvcvideo
        if [ $? -eq 0 ] ; then
            rm "/home/rudi/heizung/uvc_failure.log"
            echo "uvcvideo reload" 2>&1 | logger
        fi
    fi
fi

List of pages in this category:

-- RudolfReuter 2013-04-13 04:01:13


Go back to CategoryDockStar or FrontPage ; KontaktEmail (ContactEmail)

DockstarHeizung (last edited 2016-08-05 17:26:12 by RudolfReuter)