From 17b45773900039cb17eb6f30036d577174b4e383 Mon Sep 17 00:00:00 2001 From: Patrick Grimm Date: Sat, 2 Jan 2016 19:05:27 +0100 Subject: [PATCH] knxd: add one uci option for one cmdline arg. add a lot comments in the config file (closes #2233) Signed-off-by: Patrick Grimm Acked-by: Othmar Truniger [Squashed patches from PR into single one, bump PKG_RELEASE] Signed-off-by: Michael Heimpold --- net/knxd/Makefile | 2 +- net/knxd/files/knxd.config | 53 ++++++++++++++++++++++++++++++-------- net/knxd/files/knxd.init | 52 ++++++++++++++++++++++++++++++++----- 3 files changed, 89 insertions(+), 18 deletions(-) diff --git a/net/knxd/Makefile b/net/knxd/Makefile index a9885464ff..da6148e091 100644 --- a/net/knxd/Makefile +++ b/net/knxd/Makefile @@ -12,7 +12,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=knxd PKG_VERSION=2016-01-01-$(PKG_SOURCE_VERSION) -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/knxd/knxd.git diff --git a/net/knxd/files/knxd.config b/net/knxd/files/knxd.config index cd86a62afa..8a42854e64 100644 --- a/net/knxd/files/knxd.config +++ b/net/knxd/files/knxd.config @@ -1,12 +1,43 @@ config daemon args - # daemon is started as 'knxd $options $url' - # use 'knxd --help' to get all possible options' - # - # typical example for options for tunnel mode - option options '-D -T -S -d/tmp/knxd.log -i -p/var/run/knxd.pid' - # add '-t1023' or '--trace=1023' for full log trace - - # example with tpuarts interface - # option url 'tpuarts:/dev/ttyAMA0' - # example with IP interface in tunnel mode - option url 'ipt:192.168.1.20' + # driver:[arg] a Layer-2 driver to use (knxd supports more than one) + option layer2 "" + # enable caching of group communication networkstate + option GroupCache 0 + # FILE start the programm as daemon. Output will be written to FILE if given + option daemon "/var/log/knxd.log" + #enable the EIBnet/IP server to answer discovery and description requests (SEARCH, DESCRIPTION) + option Discovery 1 + # EIBADDR set our EIB address to EIBADDR (default 0.0.1) + option eibaddr "0.0.1" + # LEVEL set error level + option error 0 + # PORT listen at TCP port PORT (default 6720) + option listen_tcp "6720" + # wait for L_Data_ind while sending (for all EMI based backends) + option no_emisend_queuing 0 + # SERVERNAME name of the EIBnet/IP server (default is 'knxd') + option Name "OpenWrt" + # do not assume KNXnet/IP Tunneling bus interface can handle parallel cEMI requests + option no_tunnel_client_queuing 0 + # the next Layer2 interface may not enter monitor mode + option no_monitor 0 + # enable EIBnet/IP Routing in the EIBnet/IP server + option Routing 0 + # [ip[:port]] starts an EIBnet/IP multicast server + option Server 1 + # MASK set trace flags (bitmask) + option trace 0 + # tpuarts backend should generate L2 acks for all group telegrams + option tpuarts_ack_all_group 0 + # tpuarts backend should generate L2 acks for all individual telegrams + option tpuarts_ack_all_individual 0 + # tpuarts backend should should use a full interface reset (for Disch TPUART interfaces) + option tpuarts_disch_reset 0 + # enable EIBnet/IP Tunneling in the EIBnet/IP server + option Tunnelling 1 + # FILE listen at Unix domain socket FILE (default /tmp/eib) + option listen_local "/var/run/knxd" + # example with tpuarts interface + # option url 'tpuarts:/dev/ttyAMA0' + # example with IP interface in tunnel mode + option url 'ip:' diff --git a/net/knxd/files/knxd.init b/net/knxd/files/knxd.init index bb3e777d5d..df3c7c87c8 100644 --- a/net/knxd/files/knxd.init +++ b/net/knxd/files/knxd.init @@ -1,19 +1,59 @@ #!/bin/sh /etc/rc.common -# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2016 OpenWrt.org START=98 STOP=20 -NAME=knxd -PROG=/usr/bin/$NAME +PROG=/usr/bin/knxd USE_PROCD=1 +append_bool() { + local section="$1" + local option="$2" + local value="$3" + local _loctmp + local default="$4" + config_get_bool _loctmp "$section" "$option" + [ -z "$_loctmp" ] && _loctmp="$default" + [ "$_loctmp" -gt 0 ] && append params "--$value" +} + +append_parm() { + local section="$1" + local option="$2" + local switch="$3" + local _loctmp + local default="$4" + config_get _loctmp "$section" "$option" + [ -z "$_loctmp" ] && _loctmp="$default" + [ -z "$_loctmp" ] && return 0 + append params "--$switch=$_loctmp" +} + start_service() { local options url - config_load "$NAME" - config_get options args options '' + config_load knxd + append_parm args eibaddr "eibaddr" "0.0.1" + append_parm args layer2 "layer2" + append_bool args GroupCache "GroupCache" 0 + append_parm args daemon "daemon" "/var/log/knxd.log" + append_bool args Discovery "Discovery" 1 + append_parm args error "error" # "5" + append_parm args listen_tcp "listen-tcp" "6720" + append_bool args no_emisend_queuing "no-emisend-queuing" 0 + append_parm args Name "Name" "OpenWrt" + append_bool args no_tunnel_client_queuing "no-tunnel-client-queuing" 0 + append_bool args no_monitor "no-monitor" 0 + append_bool args Routing "Routing" 0 + append_parm args trace "trace" # "7" + append_bool args tpuarts_ack_all_group "tpuarts-ack-all-group" 0 + append_bool args tpuarts_ack_all_individual "tpuarts-ack-all-individual" 0 + append_bool args tpuarts_disch_reset "tpuarts-disch-reset" 0 + append_bool args Tunnelling "Tunnelling" 1 + append_parm args listen_local "listen-local" "/var/run/knxd" + append_bool args Server "Server" 1 config_get url args url procd_open_instance - procd_set_param command $PROG $options $url + procd_set_param command $PROG $params $url procd_set_param respawn procd_close_instance } -- 2.30.2