travelmate: update 0.2.5 3484/head
authorDirk Brenken <dev@brenken.org>
Sun, 6 Nov 2016 17:58:09 +0000 (18:58 +0100)
committerDirk Brenken <dev@brenken.org>
Sun, 6 Nov 2016 17:58:09 +0000 (18:58 +0100)
* small performance optimization, code cleanup
* change copyright notice in makefile
* documentation update

Signed-off-by: Dirk Brenken <dev@brenken.org>
net/travelmate/Makefile
net/travelmate/files/README.md
net/travelmate/files/travelmate.sh

index d9fe2a43205b03a8950e7991cd0496c0544175f3..4724e73079793d94c4d7ce88956f9273689c55d2 100644 (file)
@@ -1,13 +1,12 @@
 #
-# 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
-PKG_VERSION:=0.2.4
+PKG_VERSION:=0.2.5
 PKG_RELEASE:=1
 PKG_LICENSE:=GPL-3.0+
 PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
index d74b4b757c28f3e1da4f0f8bcc89ea5ac6cc761e..652feeab1b7241b05fa5edebf724aa14f97f8a2a 100644 (file)
@@ -18,16 +18,23 @@ To avoid these kind of deadlocks, travelmate set all station interfaces in an "a
 * 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
 
+## 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
-* '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:
index f6a9797b15722e034fb086642f65c4add9f2706d..ada67d8b2fc2cb922b1bdf979a55bb49ac4bd7e2 100755 (executable)
@@ -11,7 +11,7 @@
 LC_ALL=C
 PATH="/usr/sbin:/usr/bin:/sbin:/bin"
 trm_pid="${$}"
-trm_ver="0.2.4"
+trm_ver="0.2.5"
 trm_debug=0
 trm_loop=30
 trm_maxretry=3
@@ -106,7 +106,7 @@ trm_check()
             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}))"
                 json_cleanup
                 break
             fi
@@ -119,6 +119,7 @@ trm_check()
         ubus call network reload
         eval "trm_count_${trm_uplink}=\$((trm_count_${trm_uplink}+1))"
         trm_checklist=""
+        trm_uplink=""
         trm_log "info" "uplink ${trm_ssid} get lost"
     elif [ -z "${trm_uplink}" ] && [ -n "${trm_checklist}" ]
     then
@@ -189,7 +190,6 @@ while true
 do
     if [ -z "${trm_uplink}" ] || [ "${trm_status}" = "0" ]
     then
-        trm_uplink=""
         trm_aplist=""
         trm_stalist=""
         config_load wireless
@@ -213,7 +213,7 @@ do
                     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
@@ -221,28 +221,27 @@ do
                             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"
-                                eval "trm_count_${trm_config}_${trm_network}=\$((trm_count_${trm_config}_${trm_network}+1))"
+                                eval "trm_count_${trm_config}=\$((trm_count_${trm_config}+1))"
                             fi
                         fi
-                    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 ]
                     then
-                        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
-        sleep 5
     else
         trm_check
-        if [ -n "${trm_checklist}" ]
+        if [ -n "${trm_uplink}" ]
         then
             sleep ${trm_loop}
         fi