Merge branch 'master' of github.com:volkszaehler/volkszaehler.org

Conflicts:
	misc/controller/vzlogger/etc/vzlogger.conf
	misc/controller/vzlogger/src/protocols/1wire.c
This commit is contained in:
Steffen Vogel 2011-08-05 01:31:08 +02:00
commit d2017e94a3
16 changed files with 376 additions and 195 deletions

View file

@ -139,6 +139,8 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@ DEPDIR = @DEPDIR@
DEPS_CFLAGS = @DEPS_CFLAGS@ DEPS_CFLAGS = @DEPS_CFLAGS@
DEPS_LIBS = @DEPS_LIBS@ DEPS_LIBS = @DEPS_LIBS@
DEPS_LOCAL_CFLAGS = @DEPS_LOCAL_CFLAGS@
DEPS_LOCAL_LIBS = @DEPS_LOCAL_LIBS@
ECHO_C = @ECHO_C@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@ ECHO_T = @ECHO_T@

View file

@ -72,8 +72,8 @@
/* Define to 1 if you have the <unistd.h> header file. */ /* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H #undef HAVE_UNISTD_H
/* No-debug Mode */ /* Local interface */
#undef NDEBUG #undef LOCAL
/* Name of package */ /* Name of package */
#undef PACKAGE #undef PACKAGE

View file

@ -2,7 +2,7 @@
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.67 for vzlogger 0.2. # Generated by GNU Autoconf 2.67 for vzlogger 0.2.
# #
# Report bugs to <info@steffenvogel.de>. # Report bugs to <http://bugs.volkszaehler.org>.
# #
# #
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@ -231,10 +231,10 @@ fi
$as_echo "$0: be upgraded to zsh 4.3.4 or later." $as_echo "$0: be upgraded to zsh 4.3.4 or later."
else else
$as_echo "$0: Please tell bug-autoconf@gnu.org and $as_echo "$0: Please tell bug-autoconf@gnu.org and
$0: info@steffenvogel.de about your system, including any $0: http://bugs.volkszaehler.org about your system,
$0: error possibly output before this message. Then install $0: including any error possibly output before this
$0: a modern shell, or manually run the script under such a $0: message. Then install a modern shell, or manually run
$0: shell if you do have one." $0: the script under such a shell if you do have one."
fi fi
exit 1 exit 1
fi fi
@ -554,7 +554,7 @@ PACKAGE_NAME='vzlogger'
PACKAGE_TARNAME='vzlogger' PACKAGE_TARNAME='vzlogger'
PACKAGE_VERSION='0.2' PACKAGE_VERSION='0.2'
PACKAGE_STRING='vzlogger 0.2' PACKAGE_STRING='vzlogger 0.2'
PACKAGE_BUGREPORT='info@steffenvogel.de' PACKAGE_BUGREPORT='http://bugs.volkszaehler.org'
PACKAGE_URL='' PACKAGE_URL=''
ac_unique_file="src/main.c" ac_unique_file="src/main.c"
@ -597,6 +597,10 @@ ac_includes_default="\
ac_subst_vars='am__EXEEXT_FALSE ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE am__EXEEXT_TRUE
LTLIBOBJS LTLIBOBJS
DEPS_LOCAL_LIBS
DEPS_LOCAL_CFLAGS
LOCAL_FALSE
LOCAL_TRUE
LIBOBJS LIBOBJS
EGREP EGREP
GREP GREP
@ -687,6 +691,7 @@ ac_subst_files=''
ac_user_opts=' ac_user_opts='
enable_option_checking enable_option_checking
enable_dependency_tracking enable_dependency_tracking
enable_local_interface
enable_debug enable_debug
' '
ac_precious_vars='build_alias ac_precious_vars='build_alias
@ -702,7 +707,9 @@ PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR PKG_CONFIG_LIBDIR
DEPS_CFLAGS DEPS_CFLAGS
DEPS_LIBS DEPS_LIBS
CPP' CPP
DEPS_LOCAL_CFLAGS
DEPS_LOCAL_LIBS'
# Initialize some variables set by options. # Initialize some variables set by options.
@ -1321,6 +1328,8 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-dependency-tracking speeds up one-time build --disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors --enable-dependency-tracking do not reject slow dependency extractors
--enable-local-interface
enable support for local HTTPd (def=no)
--enable-debug enable debug data generation (def=no) --enable-debug enable debug data generation (def=no)
Some influential environment variables: Some influential environment variables:
@ -1339,11 +1348,15 @@ Some influential environment variables:
DEPS_CFLAGS C compiler flags for DEPS, overriding pkg-config DEPS_CFLAGS C compiler flags for DEPS, overriding pkg-config
DEPS_LIBS linker flags for DEPS, overriding pkg-config DEPS_LIBS linker flags for DEPS, overriding pkg-config
CPP C preprocessor CPP C preprocessor
DEPS_LOCAL_CFLAGS
C compiler flags for DEPS_LOCAL, overriding pkg-config
DEPS_LOCAL_LIBS
linker flags for DEPS_LOCAL, overriding pkg-config
Use these variables to override the choices made by `configure' or to help Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations. it to find libraries and programs with nonstandard names/locations.
Report bugs to <info@steffenvogel.de>. Report bugs to <http://bugs.volkszaehler.org>.
_ACEOF _ACEOF
ac_status=$? ac_status=$?
fi fi
@ -1565,9 +1578,9 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
( $as_echo "## ----------------------------------- ## ( $as_echo "## ------------------------------------------- ##
## Report this to info@steffenvogel.de ## ## Report this to http://bugs.volkszaehler.org ##
## ----------------------------------- ##" ## ------------------------------------------- ##"
) | sed "s/^/$as_me: WARNING: /" >&2 ) | sed "s/^/$as_me: WARNING: /" >&2
;; ;;
esac esac
@ -3846,12 +3859,12 @@ if test -n "$DEPS_CFLAGS"; then
pkg_cv_DEPS_CFLAGS="$DEPS_CFLAGS" pkg_cv_DEPS_CFLAGS="$DEPS_CFLAGS"
elif test -n "$PKG_CONFIG"; then elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \ if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json >= 0.9 libcurl >= 7.21.0 libmicrohttpd >= 0.9.3\""; } >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json >= 0.9 libcurl >= 7.21.0\""; } >&5
($PKG_CONFIG --exists --print-errors "json >= 0.9 libcurl >= 7.21.0 libmicrohttpd >= 0.9.3") 2>&5 ($PKG_CONFIG --exists --print-errors "json >= 0.9 libcurl >= 7.21.0") 2>&5
ac_status=$? ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then test $ac_status = 0; }; then
pkg_cv_DEPS_CFLAGS=`$PKG_CONFIG --cflags "json >= 0.9 libcurl >= 7.21.0 libmicrohttpd >= 0.9.3" 2>/dev/null` pkg_cv_DEPS_CFLAGS=`$PKG_CONFIG --cflags "json >= 0.9 libcurl >= 7.21.0" 2>/dev/null`
else else
pkg_failed=yes pkg_failed=yes
fi fi
@ -3862,12 +3875,12 @@ if test -n "$DEPS_LIBS"; then
pkg_cv_DEPS_LIBS="$DEPS_LIBS" pkg_cv_DEPS_LIBS="$DEPS_LIBS"
elif test -n "$PKG_CONFIG"; then elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \ if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json >= 0.9 libcurl >= 7.21.0 libmicrohttpd >= 0.9.3\""; } >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json >= 0.9 libcurl >= 7.21.0\""; } >&5
($PKG_CONFIG --exists --print-errors "json >= 0.9 libcurl >= 7.21.0 libmicrohttpd >= 0.9.3") 2>&5 ($PKG_CONFIG --exists --print-errors "json >= 0.9 libcurl >= 7.21.0") 2>&5
ac_status=$? ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then test $ac_status = 0; }; then
pkg_cv_DEPS_LIBS=`$PKG_CONFIG --libs "json >= 0.9 libcurl >= 7.21.0 libmicrohttpd >= 0.9.3" 2>/dev/null` pkg_cv_DEPS_LIBS=`$PKG_CONFIG --libs "json >= 0.9 libcurl >= 7.21.0" 2>/dev/null`
else else
pkg_failed=yes pkg_failed=yes
fi fi
@ -3887,14 +3900,14 @@ else
_pkg_short_errors_supported=no _pkg_short_errors_supported=no
fi fi
if test $_pkg_short_errors_supported = yes; then if test $_pkg_short_errors_supported = yes; then
DEPS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "json >= 0.9 libcurl >= 7.21.0 libmicrohttpd >= 0.9.3" 2>&1` DEPS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "json >= 0.9 libcurl >= 7.21.0" 2>&1`
else else
DEPS_PKG_ERRORS=`$PKG_CONFIG --print-errors "json >= 0.9 libcurl >= 7.21.0 libmicrohttpd >= 0.9.3" 2>&1` DEPS_PKG_ERRORS=`$PKG_CONFIG --print-errors "json >= 0.9 libcurl >= 7.21.0" 2>&1`
fi fi
# Put the nasty error message in config.log where it belongs # Put the nasty error message in config.log where it belongs
echo "$DEPS_PKG_ERRORS" >&5 echo "$DEPS_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (json >= 0.9 libcurl >= 7.21.0 libmicrohttpd >= 0.9.3) were not met: as_fn_error $? "Package requirements (json >= 0.9 libcurl >= 7.21.0) were not met:
$DEPS_PKG_ERRORS $DEPS_PKG_ERRORS
@ -4604,28 +4617,135 @@ fi
done done
# debug compilation support # local interface support
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with debug information" >&5 # Check whether --enable-local-interface was given.
$as_echo_n "checking whether to build with debug information... " >&6; } if test "${enable_local_interface+set}" = set; then :
# Check whether --enable-debug was given. enableval=$enable_local_interface; local=true
if test "${enable_debug+set}" = set; then :
enableval=$enable_debug; debugit="$enableval"
else else
debugit=no local=false
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $debugit" >&5
$as_echo "$debugit" >&6; }
if test x"$debugit" = x"yes"; then if test x$local = xtrue; then
LOCAL_TRUE=
LOCAL_FALSE='#'
else
LOCAL_TRUE='#'
LOCAL_FALSE=
fi
if test x"$local" = x"true"; then
$as_echo "#define LOCAL /**/" >>confdefs.h
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DEPS_LOCAL" >&5
$as_echo_n "checking for DEPS_LOCAL... " >&6; }
if test -n "$DEPS_LOCAL_CFLAGS"; then
pkg_cv_DEPS_LOCAL_CFLAGS="$DEPS_LOCAL_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmicrohttpd >= 0.9.3\""; } >&5
($PKG_CONFIG --exists --print-errors "libmicrohttpd >= 0.9.3") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_DEPS_LOCAL_CFLAGS=`$PKG_CONFIG --cflags "libmicrohttpd >= 0.9.3" 2>/dev/null`
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$DEPS_LOCAL_LIBS"; then
pkg_cv_DEPS_LOCAL_LIBS="$DEPS_LOCAL_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmicrohttpd >= 0.9.3\""; } >&5
($PKG_CONFIG --exists --print-errors "libmicrohttpd >= 0.9.3") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_DEPS_LOCAL_LIBS=`$PKG_CONFIG --libs "libmicrohttpd >= 0.9.3" 2>/dev/null`
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
DEPS_LOCAL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libmicrohttpd >= 0.9.3" 2>&1`
else
DEPS_LOCAL_PKG_ERRORS=`$PKG_CONFIG --print-errors "libmicrohttpd >= 0.9.3" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$DEPS_LOCAL_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (libmicrohttpd >= 0.9.3) were not met:
$DEPS_LOCAL_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables DEPS_LOCAL_CFLAGS
and DEPS_LOCAL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables DEPS_LOCAL_CFLAGS
and DEPS_LOCAL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5 ; }
else
DEPS_LOCAL_CFLAGS=$pkg_cv_DEPS_LOCAL_CFLAGS
DEPS_LOCAL_LIBS=$pkg_cv_DEPS_LOCAL_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
fi
# debug compilation support
# Check whether --enable-debug was given.
if test "${enable_debug+set}" = set; then :
enableval=$enable_debug; debug=true
else
debug=false
fi
if test x"$debug" = x"true"; then
$as_echo "#define DEBUG /**/" >>confdefs.h $as_echo "#define DEBUG /**/" >>confdefs.h
AM_CXXFLAGS="$AM_CXXFLAGS -g -Wall -Werror -Wno-uninitialized -O0" AM_CXXFLAGS="$AM_CXXFLAGS -g -Wall -Werror -Wno-uninitialized -O0"
else else
$as_echo "#define NDEBUG /**/" >>confdefs.h
AM_CXXFLAGS="$AM_CXXFLAGS -O3" AM_CXXFLAGS="$AM_CXXFLAGS -O3"
fi fi
@ -4743,6 +4863,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCC\" was never defined. as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5 Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi fi
if test -z "${LOCAL_TRUE}" && test -z "${LOCAL_FALSE}"; then
as_fn_error $? "conditional \"LOCAL\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
: ${CONFIG_STATUS=./config.status} : ${CONFIG_STATUS=./config.status}
ac_write_fail=0 ac_write_fail=0
@ -5211,7 +5335,7 @@ $config_headers
Configuration commands: Configuration commands:
$config_commands $config_commands
Report bugs to <info@steffenvogel.de>." Report bugs to <http://bugs.volkszaehler.org>."
_ACEOF _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1

View file

@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script. # Process this file with autoconf to produce a configure script.
AC_PREREQ([2.67]) AC_PREREQ([2.67])
AC_INIT(vzlogger, 0.2, info@steffenvogel.de) AC_INIT([vzlogger], [0.2], [http://bugs.volkszaehler.org])
AM_INIT_AUTOMAKE(vzlogger, 0.2) AM_INIT_AUTOMAKE(vzlogger, 0.2)
AC_CONFIG_SRCDIR([src/main.c]) AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([config.h])
@ -12,7 +12,7 @@ AC_CONFIG_FILES([Makefile src/Makefile docs/Makefile])
AC_PROG_CC AC_PROG_CC
# Checks for libraries. # Checks for libraries.
PKG_CHECK_MODULES([DEPS], [json >= 0.9 libcurl >= 7.21.0 libmicrohttpd >= 0.9.3]) PKG_CHECK_MODULES([DEPS], [json >= 0.9 libcurl >= 7.21.0])
# Checks for header files. # Checks for header files.
AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h sys/time.h termios.h unistd.h]) AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h sys/time.h termios.h unistd.h])
@ -27,20 +27,32 @@ AC_FUNC_REALLOC
AC_FUNC_STRERROR_R AC_FUNC_STRERROR_R
AC_CHECK_FUNCS([gettimeofday memset sqrt strchr strtol]) AC_CHECK_FUNCS([gettimeofday memset sqrt strchr strtol])
# debug compilation support # local interface support
AC_MSG_CHECKING([whether to build with debug information]) AC_ARG_ENABLE(
AC_ARG_ENABLE([debug], [local-interface],
[AS_HELP_STRING([--enable-debug], [AS_HELP_STRING([--enable-local-interface], [enable support for local HTTPd (def=no)])],
[enable debug data generation (def=no)])], [local=true],
[debugit="$enableval"], [local=false]
[debugit=no]) )
AC_MSG_RESULT([$debugit])
if test x"$debugit" = x"yes"; then AM_CONDITIONAL([LOCAL], [test x$local = xtrue])
if test x"$local" = x"true"; then
AC_DEFINE([LOCAL],[],[Local interface])
PKG_CHECK_MODULES([DEPS_LOCAL], [libmicrohttpd >= 0.9.3])
fi
# debug compilation support
AC_ARG_ENABLE(
[debug],
[AS_HELP_STRING([--enable-debug], [enable debug data generation (def=no)])],
[debug=true],
[debug=false]
)
if test x"$debug" = x"true"; then
AC_DEFINE([DEBUG],[],[Debug Mode]) AC_DEFINE([DEBUG],[],[Debug Mode])
AM_CXXFLAGS="$AM_CXXFLAGS -g -Wall -Werror -Wno-uninitialized -O0" AM_CXXFLAGS="$AM_CXXFLAGS -g -Wall -Werror -Wno-uninitialized -O0"
else else
AC_DEFINE([NDEBUG],[],[No-debug Mode])
AM_CXXFLAGS="$AM_CXXFLAGS -O3" AM_CXXFLAGS="$AM_CXXFLAGS -O3"
fi fi

View file

@ -1,3 +1,10 @@
vzlogger (0.2-1) stable; urgency=low
* Fixed some bugs after porting to armel architecture
* Improved init script
-- Steffen Vogel <info@steffenvogel.de> Thu, 04 Aug 2011 20:00:25 +0200
vzlogger (0.2) unstable; urgency=low vzlogger (0.2) unstable; urgency=low
* Initial Release. * Initial Release.

View file

@ -9,6 +9,7 @@ Vcs-Git: git://github.com/volkszaehler/volkszaehler.org.git
Vcs-Browser: http://github.com/volkszaehler/volkszaehler.org/tree/master/misc/controller/vzlogger/ Vcs-Browser: http://github.com/volkszaehler/volkszaehler.org/tree/master/misc/controller/vzlogger/
Package: vzlogger Package: vzlogger
Version: 0.2-1
Architecture: any Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends} Depends: ${shlibs:Depends}, ${misc:Depends}
Description: program for logging measurements to an volkszaehler.org middelware Description: program for logging measurements to an volkszaehler.org middelware

View file

@ -14,8 +14,8 @@
PATH=/sbin:/usr/sbin:/bin:/usr/bin PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC=vzlogger # Introduce a short description here DESC=vzlogger # Introduce a short description here
NAME=vzlogger # Introduce the short server's name here NAME=vzlogger # Introduce the short server's name here
DAEMON=/usr/sbin/vzlogger # Introduce the server's location here DAEMON=/usr/bin/vzlogger # Introduce the server's location here
DAEMON_ARGS="" # Arguments to run the daemon with DAEMON_ARGS="-d" # Arguments to run the daemon with
PIDFILE=/var/run/$NAME.pid PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME SCRIPTNAME=/etc/init.d/$NAME
@ -41,9 +41,9 @@ do_start()
# 0 if daemon has been started # 0 if daemon has been started
# 1 if daemon was already running # 1 if daemon was already running
# 2 if daemon could not be started # 2 if daemon could not be started
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ start-stop-daemon --background --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1 || return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ start-stop-daemon --background --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \ $DAEMON_ARGS \
|| return 2 || return 2
# Add code here, if necessary, that waits for the process to be ready # Add code here, if necessary, that waits for the process to be ready

View file

@ -85,6 +85,8 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@ DEPDIR = @DEPDIR@
DEPS_CFLAGS = @DEPS_CFLAGS@ DEPS_CFLAGS = @DEPS_CFLAGS@
DEPS_LIBS = @DEPS_LIBS@ DEPS_LIBS = @DEPS_LIBS@
DEPS_LOCAL_CFLAGS = @DEPS_LOCAL_CFLAGS@
DEPS_LOCAL_LIBS = @DEPS_LOCAL_LIBS@
ECHO_C = @ECHO_C@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@ ECHO_T = @ECHO_T@

View file

@ -3,10 +3,8 @@
; use ; to introduce a comment ; use ; to introduce a comment
;prot intval uuid middleware options ;prot intval uuid middleware options
;1wire 3 52960fe0-8882-11e0-b356-85eba28c1922 http://localhost/workspace/volkszaehler.org/htdocs/middleware /mnt/1wire/10.12E6D3000800/temperature 1wire 10 371dd700-beb3-11e0-8dda-b961518a06f4 http://demo.volkszaehler.org/middleware.php /mnt/1wire/10.12E6D3000800/temperature
;obis 10 ef0e9adf-cd9e-4d9a-92c5-b4fb4c89ff98 http://volkszaehler.org/demo/middleware.php /dev/ttyS0 ;obis 10 ef0e9adf-cd9e-4d9a-92c5-b4fb4c89ff98 http://volkszaehler.org/demo/middleware.php /dev/ttyS0
;rawS0 10 27a1b4c0-8f8a-11e0-ad82-db6efbc4ba2e http://volkszaehler.org/demo/middleware.php /dev/ttyUSB2 ;rawS0 10 27a1b4c0-8f8a-11e0-ad82-db6efbc4ba2e http://volkszaehler.org/demo/middleware.php /dev/ttyUSB2
;random 3 52960fe0-8882-11e0-b356-85eba28c1922 http://localhost/workspace/volkszaehler.org/htdocs/middleware 40
;random 7 473d35b0-945b-11e0-beb1-918e8c2ce5a0 http://volkszaehler.org/demo/middleware.php 10
random 5 e4ff8f70-9f79-11e0-b44c-d1ce78df8288 http://localhost/workspace/volkszaehler.org/htdocs/middleware 40 random 5 e4ff8f70-9f79-11e0-b44c-d1ce78df8288 http://localhost/workspace/volkszaehler.org/htdocs/middleware 40

View file

@ -6,5 +6,11 @@ AM_LDFLAGS =
# the previous manual Makefile # the previous manual Makefile
bin_PROGRAMS = vzlogger bin_PROGRAMS = vzlogger
vzlogger_SOURCES = main.c api.c local.c queue.c ltqnorm.c protocols/1wire.c protocols/obis.c protocols/rawS0.c protocols/random.c vzlogger_SOURCES = main.c api.c queue.c ltqnorm.c protocols/1wire.c protocols/obis.c protocols/rawS0.c protocols/random.c
vzlogger_LDADD = -lpthread -lm $(DEPS_LIBS) vzlogger_LDADD = -lpthread -lm $(DEPS_LIBS)
if LOCAL
vzlogger_SOURCES += local.c
vzlogger_LDADD += $(DEPS_LOCAL_LIBS)
AM_CFLAGS += $(DEPS_LOCAL_CFLAGS)
endif

View file

@ -33,6 +33,9 @@ NORMAL_UNINSTALL = :
PRE_UNINSTALL = : PRE_UNINSTALL = :
POST_UNINSTALL = : POST_UNINSTALL = :
bin_PROGRAMS = vzlogger$(EXEEXT) bin_PROGRAMS = vzlogger$(EXEEXT)
@LOCAL_TRUE@am__append_1 = local.c
@LOCAL_TRUE@am__append_2 = $(DEPS_LOCAL_LIBS)
@LOCAL_TRUE@am__append_3 = $(DEPS_LOCAL_CFLAGS)
subdir = src subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@ -45,12 +48,17 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES = CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)" am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS) PROGRAMS = $(bin_PROGRAMS)
am_vzlogger_OBJECTS = main.$(OBJEXT) api.$(OBJEXT) local.$(OBJEXT) \ am__vzlogger_SOURCES_DIST = main.c api.c queue.c ltqnorm.c \
queue.$(OBJEXT) ltqnorm.$(OBJEXT) 1wire.$(OBJEXT) \ protocols/1wire.c protocols/obis.c protocols/rawS0.c \
obis.$(OBJEXT) rawS0.$(OBJEXT) random.$(OBJEXT) protocols/random.c local.c
@LOCAL_TRUE@am__objects_1 = local.$(OBJEXT)
am_vzlogger_OBJECTS = main.$(OBJEXT) api.$(OBJEXT) queue.$(OBJEXT) \
ltqnorm.$(OBJEXT) 1wire.$(OBJEXT) obis.$(OBJEXT) \
rawS0.$(OBJEXT) random.$(OBJEXT) $(am__objects_1)
vzlogger_OBJECTS = $(am_vzlogger_OBJECTS) vzlogger_OBJECTS = $(am_vzlogger_OBJECTS)
am__DEPENDENCIES_1 = am__DEPENDENCIES_1 =
vzlogger_DEPENDENCIES = $(am__DEPENDENCIES_1) @LOCAL_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
vzlogger_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles am__depfiles_maybe = depfiles
@ -60,7 +68,7 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
CCLD = $(CC) CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(vzlogger_SOURCES) SOURCES = $(vzlogger_SOURCES)
DIST_SOURCES = $(vzlogger_SOURCES) DIST_SOURCES = $(am__vzlogger_SOURCES_DIST)
ETAGS = etags ETAGS = etags
CTAGS = ctags CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@ -80,6 +88,8 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@ DEPDIR = @DEPDIR@
DEPS_CFLAGS = @DEPS_CFLAGS@ DEPS_CFLAGS = @DEPS_CFLAGS@
DEPS_LIBS = @DEPS_LIBS@ DEPS_LIBS = @DEPS_LIBS@
DEPS_LOCAL_CFLAGS = @DEPS_LOCAL_CFLAGS@
DEPS_LOCAL_LIBS = @DEPS_LOCAL_LIBS@
ECHO_C = @ECHO_C@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@ ECHO_T = @ECHO_T@
@ -157,10 +167,13 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
# what flags you want to pass to the C compiler & linker # what flags you want to pass to the C compiler & linker
AM_CFLAGS = -Wall -D_REENTRANT -std=gnu99 $(DEPS_CFLAGS) AM_CFLAGS = -Wall -D_REENTRANT -std=gnu99 $(DEPS_CFLAGS) \
$(am__append_3)
AM_LDFLAGS = AM_LDFLAGS =
vzlogger_SOURCES = main.c api.c local.c queue.c ltqnorm.c protocols/1wire.c protocols/obis.c protocols/rawS0.c protocols/random.c vzlogger_SOURCES = main.c api.c queue.c ltqnorm.c protocols/1wire.c \
vzlogger_LDADD = -lpthread -lm $(DEPS_LIBS) protocols/obis.c protocols/rawS0.c protocols/random.c \
$(am__append_1)
vzlogger_LDADD = -lpthread -lm $(DEPS_LIBS) $(am__append_2)
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:

View file

@ -98,7 +98,7 @@ json_object * api_json_tuples(channel_t *ch, bool_t all) {
if (rd.tv.tv_sec) { /* skip empty buffers */ if (rd.tv.tv_sec) { /* skip empty buffers */
struct json_object *json_tuple = json_object_new_array(); struct json_object *json_tuple = json_object_new_array();
unsigned long timestamp = rd.tv.tv_sec * 1000 + rd.tv.tv_usec / 1000; double timestamp = rd.tv.tv_sec * 1000.0 + rd.tv.tv_usec / 1000.0;
json_object_array_add(json_tuple, json_object_new_double(timestamp)); json_object_array_add(json_tuple, json_object_new_double(timestamp));
json_object_array_add(json_tuple, json_object_new_double(rd.value)); json_object_array_add(json_tuple, json_object_new_double(rd.value));
@ -120,7 +120,7 @@ CURL * api_curl_init(channel_t *ch) {
char url[255], agent[255]; char url[255], agent[255];
/* prepare header & url */ /* prepare header & url */
sprintf(agent, "User-Agent: vzlogger/%s (%s)", VZ_VERSION, curl_version()); /* build user agent */ sprintf(agent, "User-Agent: %s/%s (%s)", PACKAGE, VERSION, curl_version()); /* build user agent */
sprintf(url, "%s/data/%s.json", ch->middleware, ch->uuid); /* build url */ sprintf(url, "%s/data/%s.json", ch->middleware, ch->uuid); /* build url */
header = curl_slist_append(header, "Content-type: application/json"); header = curl_slist_append(header, "Content-type: application/json");

View file

@ -25,7 +25,6 @@
#include <json/json.h> #include <json/json.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include "main.h" #include "main.h"
@ -64,8 +63,8 @@ int handle_request(void *cls, struct MHD_Connection *connection, const char *url
} }
} }
json_object_object_add(json_obj, "version", json_object_new_string(VZ_VERSION)); json_object_object_add(json_obj, "version", json_object_new_string(VERSION));
json_object_object_add(json_obj, "generator", json_object_new_string("vzlogger")); json_object_object_add(json_obj, "generator", json_object_new_string(PACKAGE));
json_object_object_add(json_obj, "data", json_data); json_object_object_add(json_obj, "data", json_data);
json_str = json_object_to_json_string(json_obj); json_str = json_object_to_json_string(json_obj);

View file

@ -23,20 +23,24 @@
* along with volkszaehler.org. If not, see <http://www.gnu.org/licenses/>. * along with volkszaehler.org. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stdio.h>
#include <getopt.h>
#include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <stdarg.h>
#include <unistd.h>
#include <math.h>
#include <string.h> #include <string.h>
#include <curl/curl.h> #include <curl/curl.h>
#include <math.h> #include <getopt.h>
#include <stdint.h>
#ifdef LOCAL
#include <microhttpd.h> #include <microhttpd.h>
#include "local.h"
#endif
#include "main.h" #include "main.h"
#include "queue.h" #include "queue.h"
#include "api.h" #include "api.h"
#include "local.h"
#include "protocols/obis.h" #include "protocols/obis.h"
#include "protocols/1wire.h" #include "protocols/1wire.h"
@ -64,8 +68,10 @@ static protocol_t protocols[] = {
static struct option long_options[] = { static struct option long_options[] = {
{"config", required_argument, 0, 'c'}, {"config", required_argument, 0, 'c'},
{"daemon", required_argument, 0, 'd'}, {"daemon", required_argument, 0, 'd'},
#ifdef LOCAL
{"local", no_argument, 0, 'l'}, {"local", no_argument, 0, 'l'},
{"local-port", required_argument, 0, 'p'}, {"local-port", required_argument, 0, 'p'},
#endif /* LOCAL */
{"verbose", optional_argument, 0, 'v'}, {"verbose", optional_argument, 0, 'v'},
{"help", no_argument, 0, 'h'}, {"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'}, {"version", no_argument, 0, 'V'},
@ -78,8 +84,10 @@ static struct option long_options[] = {
static char *long_options_descs[] = { static char *long_options_descs[] = {
"config file with channel -> uuid mapping", "config file with channel -> uuid mapping",
"run as daemon", "run as daemon",
#ifdef LOCAL
"activate local interface (tiny webserver)", "activate local interface (tiny webserver)",
"TCP port for local interface", "TCP port for local interface",
#endif /* LOCAL */
"enable verbose output", "enable verbose output",
"show this help", "show this help",
"show version of vzlogger", "show version of vzlogger",
@ -123,8 +131,9 @@ void usage(char * argv[]) {
prot++; prot++;
} }
printf("\nvzlogger - volkszaehler.org logging utility %s\n", VZ_VERSION); printf("\n%s - volkszaehler.org logging utility\n", PACKAGE_STRING);
printf("by Steffen Vogel <stv0g@0l.de>\n"); printf("by Steffen Vogel <stv0g@0l.de>\n");
printf("send bugreports to %s\n", PACKAGE_BUGREPORT);
} }
/** /**
@ -202,7 +211,7 @@ void parse_options(int argc, char * argv[], options_t * opts) {
break; break;
case 'V': case 'V':
printf("%s\n", VZ_VERSION); printf("%s\n", VERSION);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
break; break;
@ -384,7 +393,10 @@ void *read_thread(void *arg) {
*/ */
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
int num_chans; int num_chans;
#ifdef LOCAL
struct MHD_Daemon *httpd_handle = NULL; struct MHD_Daemon *httpd_handle = NULL;
#endif /* LOCAL */
parse_options(argc, argv, &opts); /* parse command line arguments */ parse_options(argc, argv, &opts); /* parse command line arguments */
num_chans = parse_channels(opts.config, chans); /* parse channels from configuration */ num_chans = parse_channels(opts.config, chans); /* parse channels from configuration */
@ -408,6 +420,7 @@ int main(int argc, char *argv[]) {
pthread_create(&ch->logging_thread, NULL, api_thread, (void *) ch); pthread_create(&ch->logging_thread, NULL, api_thread, (void *) ch);
} }
#ifdef LOCAL
/* start webserver for local interface */ /* start webserver for local interface */
if (opts.local) { if (opts.local) {
httpd_handle = MHD_start_daemon( httpd_handle = MHD_start_daemon(
@ -419,6 +432,7 @@ int main(int argc, char *argv[]) {
MHD_OPTION_END MHD_OPTION_END
); );
} }
#endif /* LOCAL */
/* wait for all threads to terminate */ /* wait for all threads to terminate */
// TODO bind signal for termination // TODO bind signal for termination
@ -439,10 +453,12 @@ int main(int argc, char *argv[]) {
pthread_mutex_destroy(&ch->mutex); pthread_mutex_destroy(&ch->mutex);
} }
#ifdef LOCAL
/* stop webserver */ /* stop webserver */
if (httpd_handle) { if (httpd_handle) {
MHD_stop_daemon(httpd_handle); MHD_stop_daemon(httpd_handle);
} }
#endif /* LOCAL */
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View file

@ -30,10 +30,11 @@
#include <pthread.h> #include <pthread.h>
#include <errno.h> #include <errno.h>
#include "../config.h"
#include "protocol.h" #include "protocol.h"
#include "queue.h" #include "queue.h"
#define VZ_VERSION "0.2"
#define MAX_CHANNELS 16 #define MAX_CHANNELS 16
#define RETRY_PAUSE 10 //600 /* seconds to wait after failed request */ #define RETRY_PAUSE 10 //600 /* seconds to wait after failed request */

View file

@ -57,10 +57,10 @@ reading_t onewire_get(void *handle) {
char buffer[16]; char buffer[16];
int bytes; int bytes;
do { do {
rewind((FILE *) handle); rewind((FILE *) handle);
bytes = fread(buffer, 1, 16, (FILE *) handle); bytes = fread(buffer, 1, 16, (FILE *) handle);
buffer[bytes] = '\0'; /* zero terminated, required? */
if (bytes) { if (bytes) {
print(4, "Read from sensor file: %s", NULL, buffer); print(4, "Read from sensor file: %s", NULL, buffer);