travelmate: bugfix 0.3.1
* fix error handling, i.e. a wrong uplink key in wireless config Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
parent
c4356a02d5
commit
50a51bcd06
3 changed files with 19 additions and 11 deletions
|
@ -1,12 +1,12 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2016 Dirk Brenken (dev@brenken.org)
|
# Copyright (c) 2016-2017 Dirk Brenken (dev@brenken.org)
|
||||||
# This is free software, licensed under the GNU General Public License v3.
|
# This is free software, licensed under the GNU General Public License v3.
|
||||||
#
|
#
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=travelmate
|
PKG_NAME:=travelmate
|
||||||
PKG_VERSION:=0.3.0
|
PKG_VERSION:=0.3.1
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
PKG_LICENSE:=GPL-3.0+
|
PKG_LICENSE:=GPL-3.0+
|
||||||
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
|
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
|
||||||
|
|
|
@ -7,7 +7,7 @@ To avoid these kind of deadlocks, travelmate set all station interfaces in an "a
|
||||||
|
|
||||||
## Main Features
|
## Main Features
|
||||||
* STA interfaces operating in an "always off" mode, to make sure that the AP is always accessible
|
* STA interfaces operating in an "always off" mode, to make sure that the AP is always accessible
|
||||||
* zero-conf like automatic installation & setup, usually no manual changes needed
|
* easy setup within normal OpenWrt/LEDE environment
|
||||||
* fast uplink connections
|
* fast uplink connections
|
||||||
* procd init system support
|
* procd init system support
|
||||||
* procd based hotplug support, the travelmate start will be triggered by interface triggers
|
* procd based hotplug support, the travelmate start will be triggered by interface triggers
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
LC_ALL=C
|
LC_ALL=C
|
||||||
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
trm_ver="0.3.0"
|
trm_ver="0.3.1"
|
||||||
trm_enabled=1
|
trm_enabled=1
|
||||||
trm_debug=0
|
trm_debug=0
|
||||||
trm_maxwait=20
|
trm_maxwait=20
|
||||||
|
@ -80,10 +80,10 @@ f_prepare()
|
||||||
|
|
||||||
f_check()
|
f_check()
|
||||||
{
|
{
|
||||||
local ifname cnt=0 mode="${1}"
|
local ifname cnt=1 mode="${1}"
|
||||||
trm_ifstatus="false"
|
trm_ifstatus="false"
|
||||||
|
|
||||||
while [ ${cnt} -lt ${trm_maxwait} ]
|
while [ ${cnt} -le ${trm_maxwait} ]
|
||||||
do
|
do
|
||||||
ifname="$(ubus -S call network.wireless status | jsonfilter -l 1 -e "@.*.interfaces[@.config.mode=\"${mode}\"].ifname")"
|
ifname="$(ubus -S call network.wireless status | jsonfilter -l 1 -e "@.*.interfaces[@.config.mode=\"${mode}\"].ifname")"
|
||||||
if [ "${mode}" = "sta" ]
|
if [ "${mode}" = "sta" ]
|
||||||
|
@ -121,7 +121,7 @@ f_log()
|
||||||
|
|
||||||
f_main()
|
f_main()
|
||||||
{
|
{
|
||||||
local ap_list ssid_list config network ssid cnt=0
|
local ap_list ssid_list config network ssid cnt=1
|
||||||
|
|
||||||
f_check "sta"
|
f_check "sta"
|
||||||
if [ "${trm_ifstatus}" != "true" ]
|
if [ "${trm_ifstatus}" != "true" ]
|
||||||
|
@ -142,7 +142,7 @@ f_main()
|
||||||
fi
|
fi
|
||||||
for ap in ${ap_list}
|
for ap in ${ap_list}
|
||||||
do
|
do
|
||||||
while [ ${cnt} -lt ${trm_maxretry} ]
|
while [ ${cnt} -le ${trm_maxretry} ]
|
||||||
do
|
do
|
||||||
if [ ${trm_iw} -eq 1 ]
|
if [ ${trm_iw} -eq 1 ]
|
||||||
then
|
then
|
||||||
|
@ -164,10 +164,18 @@ f_main()
|
||||||
then
|
then
|
||||||
uci -q set wireless."${config}".disabled=0
|
uci -q set wireless."${config}".disabled=0
|
||||||
uci -q commit wireless
|
uci -q commit wireless
|
||||||
ubus call network.interface."${network}" up
|
|
||||||
ubus call network reload
|
ubus call network reload
|
||||||
f_log "info " "main ::: wwan interface connected to uplink ${ssid}"
|
f_check "sta"
|
||||||
|
if [ "${trm_ifstatus}" = "true" ]
|
||||||
|
then
|
||||||
|
f_log "info " "main ::: wwan interface connected to uplink ${ssid} (${cnt}/${trm_maxretry})"
|
||||||
return 0
|
return 0
|
||||||
|
else
|
||||||
|
uci -q set wireless."${config}".disabled=1
|
||||||
|
uci -q commit wireless
|
||||||
|
ubus call network reload
|
||||||
|
f_log "info " "main ::: wwan interface can't connect to uplink ${ssid} (${cnt}/${trm_maxretry})"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue