#!/bin/sh
#------------------------------------------------------------------------------
# OPT_EMBEDDED  /etc/rrdtool/wrap.val                              __FLI4LVER__
# Creation:     2005-12-23 gdw
# Last Update:  $Id$
# 
# rrdtool WRAP Datenerfassung
#------------------------------------------------------------------------------

[ -z "$RDTOOL_CONF_LOADED" ] && . /var/run/rrdtool.conf

local source=wrap
eval local idx='$RRDTOOL_'$source'_ID'
eval local options='$RRDTOOL_'$idx'_OPTIONS_STRING'

wrap_io_path='/sys/bus/i2c/devices/0-0048/temp1_input'

for item in $options
do
    local db_file=$RRDTOOL_DB_PATH/$source/$item.rrd
    case "$item" in
#    "voltage")
#        value=`grep VPWR /proc/driver/soekris_voltage | cut -d" " -f2`
#        rrdtool update $db_file \
#        N:$value
#        ;;
    "temperature")
        value=`sed 's/\([0-9]\{3\}\)$/.\1/' $wrap_io_path`
        rrdtool update $db_file \
        N:$value
        ;;
    esac
done

