* always update the connection status, even in case of an error
* merge multiple ubus network calls in central check routine
Signed-off-by: Dirk Brenken <dev@brenken.org>
include $(TOPDIR)/rules.mk
PKG_NAME:=travelmate
include $(TOPDIR)/rules.mk
PKG_NAME:=travelmate
PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0+
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0+
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
local rtfile="$(uci -q get travelmate.global.trm_rtfile)"
rtfile="${rtfile:="/tmp/trm_runtime.json"}"
local rtfile="$(uci -q get travelmate.global.trm_rtfile)"
rtfile="${rtfile:="/tmp/trm_runtime.json"}"
- if [ -s "${rtfile}" ]
- then
- > "${rtfile}"
- fi
#
LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
#
LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
trm_sysver="$(ubus -S call system board | jsonfilter -e '@.release.description')"
trm_enabled=0
trm_debug=0
trm_sysver="$(ubus -S call system board | jsonfilter -e '@.release.description')"
trm_enabled=0
trm_debug=0
trm_maxwait=30
trm_timeout=60
trm_iw="$(command -v iw)"
trm_maxwait=30
trm_timeout=60
trm_iw="$(command -v iw)"
trm_rtfile="/tmp/trm_runtime.json"
trm_rtfile="/tmp/trm_runtime.json"
-# source required system library
+# source required system libraries
#
if [ -r "/lib/functions.sh" ] && [ -r "/usr/share/libubox/jshn.sh" ]
then
#
if [ -r "/lib/functions.sh" ] && [ -r "/usr/share/libubox/jshn.sh" ]
then
f_check()
{
local ifname radio status cnt=1 mode="${1}"
f_check()
{
local ifname radio status cnt=1 mode="${1}"
+ ubus call network reload
+ trm_ifstatus="false"
while [ ${cnt} -le ${trm_maxwait} ]
do
status="$(ubus -S call network.wireless status 2>/dev/null)"
while [ ${cnt} -le ${trm_maxwait} ]
do
status="$(ubus -S call network.wireless status 2>/dev/null)"
f_check "initial"
if [ "${trm_ifstatus}" != "true" ]
then
f_check "initial"
if [ "${trm_ifstatus}" != "true" ]
then
config_load wireless
config_foreach f_prepare wifi-iface
if [ -n "$(uci -q changes wireless)" ]
then
uci -q commit wireless
config_load wireless
config_foreach f_prepare wifi-iface
if [ -n "$(uci -q changes wireless)" ]
then
uci -q commit wireless
- ubus call network restart
fi
f_check "ap"
f_log "debug" "ap-list: ${trm_aplist}, sta-list: ${trm_stalist}"
fi
f_check "ap"
f_log "debug" "ap-list: ${trm_aplist}, sta-list: ${trm_stalist}"
if [ -n "$(printf "%s" "${ssid_list}" | grep -Fo "\"${sta_ssid}\"")" ] && [ "${ap_radio}" = "${sta_radio}" ]
then
uci -q set wireless."${config}".disabled=0
if [ -n "$(printf "%s" "${ssid_list}" | grep -Fo "\"${sta_ssid}\"")" ] && [ "${ap_radio}" = "${sta_radio}" ]
then
uci -q set wireless."${config}".disabled=0
- ubus call network reload
f_check "sta"
if [ "${trm_ifstatus}" = "true" ]
then
f_check "sta"
if [ "${trm_ifstatus}" = "true" ]
then
return 0
else
uci -q revert wireless
return 0
else
uci -q revert wireless
- ubus call network reload
f_log "info " "interface '${sta_iface}' on '${sta_radio}' can't connect to uplink '${sta_ssid}' (${trm_sysver})"
f_jsnupdate "${sta_iface}" "${sta_radio}" "${sta_ssid}"
fi
f_log "info " "interface '${sta_iface}' on '${sta_radio}' can't connect to uplink '${sta_ssid}' (${trm_sysver})"
f_jsnupdate "${sta_iface}" "${sta_radio}" "${sta_ssid}"
fi
+ if [ ! -s "${trm_rtfile}" ]
+ then
+ f_jsnupdate "n/a" "n/a" "n/a"
+ fi
else
if [ ! -s "${trm_rtfile}" ]
then
else
if [ ! -s "${trm_rtfile}" ]
then