Files
wlan-ap/feeds/ipq807x_v5.4/hostapd/files/afcd.init
Tanya Singh ccd23cb4c1 hostapd: add afcd respawn
Customize the procd instance respawn time  parameters to avoid afcd instance
crash while creating afc-location.json

Fixes: WIFI-14261
Signed-off-by: Tanya Singh <tanya_singh@accton.com>
2024-11-11 07:00:41 +01:00

44 lines
872 B
Bash

#!/bin/sh /etc/rc.common
START=19
USE_PROCD=1
NAME=afcd
PROG=/usr/bin/ucode
add_afc() {
config_get_bool disabled "$1" disabled 0
[ "$disabled" -gt 0 ] && return
config_get url "$1" url
config_get cert "$1" cert
[ -n "$url" ] || return
procd_open_instance afcd
procd_set_param command "$PROG" /usr/share/hostap/afcd.uc -u "$url"
[ -n "$cert" ] && procd_append_param command -c "$cert"
procd_set_param respawn
procd_close_instance
}
_afc_location() {
# create afc-location.json
procd_open_instance
procd_set_param command "$PROG" /usr/share/hostap/afc_location.uc
procd_set_param respawn 0 60 5
procd_close_instance
}
start_service() {
config_load wireless
config_foreach add_afc afc-server
local gps_disabled=$(uci get gps.@gps[-1].disabled)
[ "$gps_disabled" -eq 0 ] && _afc_location
}
service_triggers()
{
procd_add_reload_trigger wireless
}