You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.9 KiB

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