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.

106 lines
3.1 KiB

  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2014-2015 OpenWrt.org
  3. START=90
  4. STOP=10
  5. USE_PROCD=1
  6. append_arg() {
  7. local cfg="$1"
  8. local var="$2"
  9. local opt="$3"
  10. local def="$4"
  11. local val
  12. config_get val "$cfg" "$var"
  13. [ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}"
  14. }
  15. append_bool() {
  16. local cfg="$1"
  17. local var="$2"
  18. local opt="$3"
  19. local def="$4"
  20. local val
  21. config_get_bool val "$cfg" "$var" "$def"
  22. [ "$val" = 1 ] && procd_append_param command "$opt"
  23. }
  24. start_instance() {
  25. local cfg="$1"
  26. local aux
  27. config_get_bool aux "$cfg" 'disabled' '0'
  28. [ "$aux" = 1 ] && return 1
  29. procd_open_instance
  30. procd_set_param command /usr/bin/dump1090
  31. procd_append_param command "--quiet"
  32. append_arg "$cfg" device_index "--device-index"
  33. append_arg "$cfg" gain "--gain"
  34. append_bool "$cfg" enable_agc "--enable-agc"
  35. append_arg "$cfg" freq "--freq"
  36. append_arg "$cfg" ifile "--ifile"
  37. append_arg "$cfg" iformat "--iformat"
  38. append_bool "$cfg" throttle "--throttle"
  39. append_bool "$cfg" raw "--raw"
  40. append_bool "$cfg" net "--net"
  41. append_bool "$cfg" modeac "--modeac"
  42. append_bool "$cfg" net_beast "--net-beast"
  43. append_bool "$cfg" net_only "--net-only"
  44. append_arg "$cfg" net_bind_address "--net-bind-address"
  45. append_arg "$cfg" net_http_port "--net-http-port"
  46. append_arg "$cfg" net_ri_port "--net-ri-port"
  47. append_arg "$cfg" net_ro_port "--net-ro-port"
  48. append_arg "$cfg" net_sbs_port "--net-sbs-port"
  49. append_arg "$cfg" net_bi_port "--net-bi-port"
  50. append_arg "$cfg" net_bo_port "--net-bo-port"
  51. append_arg "$cfg" net_fatsv_port "net-fatsv-port"
  52. append_arg "$cfg" net_ro_size "--net-ro-size"
  53. append_arg "$cfg" net_ro_interval "--net-ro-interval"
  54. append_arg "$cfg" net_heartbeat "--net-heartbeat"
  55. append_arg "$cfg" net_buffer "--net-buffer"
  56. append_bool "$cfg" net_verbatim "--net-verbatim"
  57. append_bool "$cfg" forward_mlat "--forward-mlat"
  58. append_arg "$cfg" lat "--lat"
  59. append_arg "$cfg" lon "--lon"
  60. append_arg "$cfg" max_range "--max-range"
  61. append_bool "$cfg" fix "--fix"
  62. append_bool "$cfg" no_fix "--no-fix"
  63. append_bool "$cfg" no_crc_check "--no-crc-check"
  64. append_bool "$cfg" phase_enhance "--phase-enhance"
  65. append_bool "$cfg" aggressive "--aggressive"
  66. append_bool "$cfg" mlat "--mlat"
  67. append_bool "$cfg" stats "--stats"
  68. append_bool "$cfg" stats_range "--stats-range"
  69. append_arg "$cfg" stats_every "--stats-every"
  70. append_bool "$cfg" onlyaddr "--onlyaddr"
  71. append_bool "$cfg" metric "--metric"
  72. append_arg "$cfg" snip "--snip"
  73. append_arg "$cfg" debug "--debug"
  74. append_arg "$cfg" ppm "--ppm"
  75. append_arg "$cfg" html_dir "--html-dir"
  76. append_arg "$cfg" write_json "--write-json"
  77. append_arg "$cfg" write_json_every "write-json-every"
  78. append_arg "$cfg" json_location_accuracy "--json-location-accuracy"
  79. append_bool "$cfg" oversample "--oversample"
  80. append_bool "$cfg" dcfilter "--dcfilter"
  81. append_bool "$cfg" measure_noise "--measure-noise"
  82. config_get_bool aux "$cfg" 'respawn' '0'
  83. [ "$aux" = 1 ] && procd_set_param respawn
  84. procd_close_instance
  85. }
  86. service_triggers() {
  87. procd_add_reload_trigger "dump1090"
  88. }
  89. start_service() {
  90. config_load dump1090
  91. config_foreach start_instance dump1090
  92. }