* small performance optimization, code cleanup
* change copyright notice in makefile
* documentation update
Signed-off-by: Dirk Brenken <dev@brenken.org>
-# Copyright (C) 2016 OpenWrt.org
-#
+# Copyright (c) 2016 Dirk Brenken (dev@brenken.org)
# This is free software, licensed under the GNU General Public License v3.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=travelmate
# This is free software, licensed under the GNU General Public License v3.
#
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>
* iw (default) or iwinfo for wlan scanning
## OpenWrt / LEDE trunk Installation & Usage
* iw (default) or iwinfo for wlan scanning
## OpenWrt / LEDE trunk Installation & Usage
+* download the package [here](https://downloads.lede-project.org/snapshots/packages/x86_64/packages)
* install 'travelmate' (_opkg install travelmate_)
* configure your network to support (multiple) wlan uplinks and set travelmate config options (details see below)
* set 'trm\_enabled' option in travelmate config to '1'
* travelmate starts automatically during boot, triggered by procd as soon as the wireless subsystem is up & running
* install 'travelmate' (_opkg install travelmate_)
* configure your network to support (multiple) wlan uplinks and set travelmate config options (details see below)
* set 'trm\_enabled' option in travelmate config to '1'
* travelmate starts automatically during boot, triggered by procd as soon as the wireless subsystem is up & running
+## LuCI travelmate companion package
+* download the package [here](https://downloads.lede-project.org/snapshots/packages/x86_64/luci)
+* install 'luci-app-travelmate' (_opkg install luci-app-travelmate_)
+* the application is located in LuCI under 'Services' menu
+* _Thanks to Hannu Nyman for this great LuCI frontend!_
+
## Chaos Calmer installation notes
## Chaos Calmer installation notes
-* 'travelmate' is _not_ available as an ipk package in the Chaos Calmer download repository
-* download the package from a development snapshot package directory, i.e. look [here](https://downloads.lede-project.org/snapshots/packages/x86_64/packages/)
-* manually transfer the package to your routers temp directory (with tools like _sshfs_ or _winscp_)
-* install the package as described above
+* 'travelmate' and 'luci-app-travelmate' are _not_ available as ipk packages in the Chaos Calmer download repository
+* download the packages from a development snapshot directory (see download links above)
+* manually transfer the packages to your routers temp directory (with tools like _sshfs_ or _winscp_)
+* install the packages as described above
## Travelmate config options
* mandatory config options:
## Travelmate config options
* mandatory config options:
LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
trm_pid="${$}"
LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
trm_pid="${$}"
trm_debug=0
trm_loop=30
trm_maxretry=3
trm_debug=0
trm_loop=30
trm_maxretry=3
json_get_var trm_status up
if [ "${trm_status}" = "1" ] || [ -n "${trm_uplink}" ]
then
json_get_var trm_status up
if [ "${trm_status}" = "1" ] || [ -n "${trm_uplink}" ]
then
- trm_log "debug" "check::: interface: ${interface}, status: ${trm_status}, uplink-sta: ${trm_uplink}, uplink-ssid: ${trm_ssid} count: ${cnt}"
+ trm_log "debug" "check::: interface: ${interface}, status: ${trm_status}, uplink-cfg: ${trm_uplink}, uplink-ssid: ${trm_ssid}, loop-cnt: ${cnt}, error-cnt: $((trm_count_${trm_config}))"
ubus call network reload
eval "trm_count_${trm_uplink}=\$((trm_count_${trm_uplink}+1))"
trm_checklist=""
ubus call network reload
eval "trm_count_${trm_uplink}=\$((trm_count_${trm_uplink}+1))"
trm_checklist=""
trm_log "info" "uplink ${trm_ssid} get lost"
elif [ -z "${trm_uplink}" ] && [ -n "${trm_checklist}" ]
then
trm_log "info" "uplink ${trm_ssid} get lost"
elif [ -z "${trm_uplink}" ] && [ -n "${trm_checklist}" ]
then
do
if [ -z "${trm_uplink}" ] || [ "${trm_status}" = "0" ]
then
do
if [ -z "${trm_uplink}" ] || [ "${trm_status}" = "0" ]
then
trm_aplist=""
trm_stalist=""
config_load wireless
trm_aplist=""
trm_stalist=""
config_load wireless
trm_network="${sta##*_}"
trm_ifname="$(uci -q get wireless."${trm_config}".ifname)"
trm_ssid="\"$(uci -q get wireless."${trm_config}".ssid)\""
trm_network="${sta##*_}"
trm_ifname="$(uci -q get wireless."${trm_config}".ifname)"
trm_ssid="\"$(uci -q get wireless."${trm_config}".ssid)\""
- if [ $((trm_count_${trm_config}_${trm_network})) -lt $((trm_maxretry)) ] || [ $((trm_maxretry)) -eq 0 ]
+ if [ $((trm_count_${trm_config})) -lt $((trm_maxretry)) ] || [ $((trm_maxretry)) -eq 0 ]
then
if [ -n "$(printf "${trm_ssidlist}" | grep -Fo "${trm_ssid}")" ]
then
then
if [ -n "$(printf "${trm_ssidlist}" | grep -Fo "${trm_ssid}")" ]
then
if [ "${trm_status}" = "1" ]
then
trm_checklist="${trm_network}"
if [ "${trm_status}" = "1" ]
then
trm_checklist="${trm_network}"
- trm_uplink="${trm_config}_${trm_network}"
+ trm_uplink="${trm_config}"
trm_set "defer"
trm_log "info" "wwan interface \"${trm_ifname}\" connected to uplink ${trm_ssid}"
break 2
else
trm_set "revert"
trm_set "defer"
trm_log "info" "wwan interface \"${trm_ifname}\" connected to uplink ${trm_ssid}"
break 2
else
trm_set "revert"
- eval "trm_count_${trm_config}_${trm_network}=\$((trm_count_${trm_config}_${trm_network}+1))"
+ eval "trm_count_${trm_config}=\$((trm_count_${trm_config}+1))"
- elif [ $((trm_count_${trm_config}_${trm_network})) -eq $((trm_maxretry)) ] && [ $((trm_maxretry)) -ne 0 ]
+ elif [ $((trm_count_${trm_config})) -eq $((trm_maxretry)) ] && [ $((trm_maxretry)) -ne 0 ]
- eval "trm_count_${trm_config}_${trm_network}=\$((trm_count_${trm_config}_${trm_network}+1))"
+ eval "trm_count_${trm_config}=\$((trm_count_${trm_config}+1))"
trm_log "info" "uplink ${trm_ssid} disabled due to permanent connection failures"
fi
done
fi
sleep 5
done
trm_log "info" "uplink ${trm_ssid} disabled due to permanent connection failures"
fi
done
fi
sleep 5
done
- if [ -n "${trm_checklist}" ]
+ if [ -n "${trm_uplink}" ]
then
sleep ${trm_loop}
fi
then
sleep ${trm_loop}
fi