Sfoglia il codice sorgente

knxd: add one uci option for one cmdline arg. add a lot comments in the config file (closes #2233)

Signed-off-by: Patrick Grimm <patrick@lunatiki.de>
Acked-by: Othmar Truniger <github@truniger.ch>

[Squashed patches from PR into single one, bump PKG_RELEASE]

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
Patrick Grimm 9 anni fa
parent
commit
17b4577390
3 ha cambiato i file con 89 aggiunte e 18 eliminazioni
  1. 1
    1
      net/knxd/Makefile
  2. 42
    11
      net/knxd/files/knxd.config
  3. 46
    6
      net/knxd/files/knxd.init

+ 1
- 1
net/knxd/Makefile Vedi File

@@ -12,7 +12,7 @@ include $(TOPDIR)/rules.mk
12 12
 
13 13
 PKG_NAME:=knxd
14 14
 PKG_VERSION=2016-01-01-$(PKG_SOURCE_VERSION)
15
-PKG_RELEASE:=2
15
+PKG_RELEASE:=3
16 16
 
17 17
 PKG_SOURCE_PROTO:=git
18 18
 PKG_SOURCE_URL:=https://github.com/knxd/knxd.git

+ 42
- 11
net/knxd/files/knxd.config Vedi File

@@ -1,12 +1,43 @@
1 1
 config daemon args
2
-        # daemon is started as 'knxd $options $url'
3
-        # use 'knxd --help' to get all possible options'
4
-        #
5
-        # typical example for options for tunnel mode
6
-        option options '-D -T -S -d/tmp/knxd.log -i -p/var/run/knxd.pid'
7
-        # add '-t1023' or '--trace=1023' for full log trace
8
-
9
-        # example with tpuarts interface
10
-        # option url 'tpuarts:/dev/ttyAMA0'
11
-        # example with IP interface in tunnel mode
12
-        option url 'ipt:192.168.1.20'
2
+	# driver:[arg]  a Layer-2 driver to use (knxd supports more than one)
3
+	option layer2 ""
4
+	# enable caching of group communication networkstate
5
+	option GroupCache 0
6
+	# FILE start the programm as daemon. Output will be written to FILE if given
7
+	option daemon "/var/log/knxd.log"
8
+	#enable the EIBnet/IP server to answer discovery and description requests (SEARCH, DESCRIPTION)
9
+	option Discovery 1
10
+	# EIBADDR set our EIB address to EIBADDR (default 0.0.1)
11
+	option eibaddr "0.0.1"
12
+	# LEVEL set error level
13
+	option error 0
14
+	# PORT listen at TCP port PORT (default 6720)
15
+	option listen_tcp "6720"
16
+	# wait for L_Data_ind while sending (for all EMI based backends)
17
+	option no_emisend_queuing 0
18
+	# SERVERNAME name of the EIBnet/IP server (default is 'knxd')
19
+	option Name "OpenWrt"
20
+	# do not assume KNXnet/IP Tunneling bus interface can handle parallel cEMI requests
21
+	option no_tunnel_client_queuing 0
22
+	# the next Layer2 interface may not enter monitor mode
23
+	option no_monitor 0
24
+	# enable EIBnet/IP Routing in the EIBnet/IP server
25
+	option Routing 0
26
+	# [ip[:port]] starts an EIBnet/IP multicast server
27
+	option Server 1
28
+	# MASK set trace flags (bitmask)
29
+	option trace 0
30
+	# tpuarts backend should generate L2 acks for all group telegrams
31
+	option tpuarts_ack_all_group 0
32
+	# tpuarts backend should generate L2 acks for all individual telegrams
33
+	option tpuarts_ack_all_individual 0
34
+	# tpuarts backend should should use a full interface reset (for Disch TPUART interfaces)
35
+	option tpuarts_disch_reset 0
36
+	# enable EIBnet/IP Tunneling in the EIBnet/IP server
37
+	option Tunnelling 1
38
+	# FILE  listen at Unix domain socket FILE (default /tmp/eib)
39
+	option listen_local "/var/run/knxd"
40
+	# example with tpuarts interface
41
+	# option url 'tpuarts:/dev/ttyAMA0'
42
+	# example with IP interface in tunnel mode
43
+	option url 'ip:'

+ 46
- 6
net/knxd/files/knxd.init Vedi File

@@ -1,19 +1,59 @@
1 1
 #!/bin/sh /etc/rc.common
2
-# Copyright (C) 2006 OpenWrt.org
2
+# Copyright (C) 2016 OpenWrt.org
3 3
 
4 4
 START=98
5 5
 STOP=20
6
-NAME=knxd
7
-PROG=/usr/bin/$NAME
6
+PROG=/usr/bin/knxd
8 7
 USE_PROCD=1
9 8
 
9
+append_bool() {
10
+	local section="$1"
11
+	local option="$2"
12
+	local value="$3"
13
+	local _loctmp
14
+	local default="$4"
15
+	config_get_bool _loctmp "$section" "$option"
16
+	[ -z "$_loctmp" ] && _loctmp="$default"
17
+	[ "$_loctmp" -gt 0 ] && append params "--$value"
18
+}
19
+
20
+append_parm() {
21
+	local section="$1"
22
+	local option="$2"
23
+	local switch="$3"
24
+	local _loctmp
25
+	local default="$4"
26
+	config_get _loctmp "$section" "$option"
27
+	[ -z "$_loctmp" ] && _loctmp="$default"
28
+	[ -z "$_loctmp" ] && return 0
29
+	append params "--$switch=$_loctmp"
30
+}
31
+
10 32
 start_service() {
11 33
 	local options url
12
-	config_load "$NAME"
13
-	config_get options args options ''
34
+	config_load knxd
35
+	append_parm args eibaddr "eibaddr" "0.0.1"
36
+	append_parm args layer2 "layer2"
37
+	append_bool args GroupCache "GroupCache" 0
38
+	append_parm args daemon "daemon" "/var/log/knxd.log"
39
+	append_bool args Discovery "Discovery" 1
40
+	append_parm args error "error" # "5"
41
+	append_parm args listen_tcp "listen-tcp" "6720"
42
+	append_bool args no_emisend_queuing "no-emisend-queuing" 0
43
+	append_parm args Name "Name" "OpenWrt"
44
+	append_bool args no_tunnel_client_queuing "no-tunnel-client-queuing" 0
45
+	append_bool args no_monitor "no-monitor" 0
46
+	append_bool args Routing "Routing" 0
47
+	append_parm args trace "trace" # "7"
48
+	append_bool args tpuarts_ack_all_group "tpuarts-ack-all-group" 0
49
+	append_bool args tpuarts_ack_all_individual "tpuarts-ack-all-individual" 0
50
+	append_bool args tpuarts_disch_reset "tpuarts-disch-reset" 0
51
+	append_bool args Tunnelling "Tunnelling" 1
52
+	append_parm args listen_local "listen-local" "/var/run/knxd"
53
+	append_bool args Server "Server" 1
14 54
 	config_get url args url
15 55
 	procd_open_instance
16
-	procd_set_param command $PROG $options $url
56
+	procd_set_param command $PROG $params $url
17 57
 	procd_set_param respawn
18 58
 	procd_close_instance
19 59
 }