[PATCH v3 2/3] ltq-dsl-base: remove preformatted integer values from lucistat

Andre Heider a.heider at gmail.com
Fri Dec 4 08:32:46 EST 2020


luci has been converted to use the raw values, see [0].
Remove the now unused values.

[0] https://github.com/openwrt/luci/pull/4635

Signed-off-by: Andre Heider <a.heider at gmail.com>
---
 .../files/lib/functions/lantiq_dsl.sh         | 54 ++++++++-----------
 1 file changed, 22 insertions(+), 32 deletions(-)

diff --git a/package/network/utils/ltq-dsl-base/files/lib/functions/lantiq_dsl.sh b/package/network/utils/ltq-dsl-base/files/lib/functions/lantiq_dsl.sh
index 1a28633c79..169e602d4a 100755
--- a/package/network/utils/ltq-dsl-base/files/lib/functions/lantiq_dsl.sh
+++ b/package/network/utils/ltq-dsl-base/files/lib/functions/lantiq_dsl.sh
@@ -149,15 +149,13 @@ data_rates() {
 	[ -z "$drd" ] && drd=0
 	[ -z "$dru" ] && dru=0
 
-	sdrd=$(scale $drd)
-	sdru=$(scale $dru)
-
 	if [ "$action" = "lucistat" ]; then
 		echo "dsl.data_rate_down=$drd"
 		echo "dsl.data_rate_up=$dru"
-		echo "dsl.data_rate_down_s=\"$sdrd\""
-		echo "dsl.data_rate_up_s=\"$sdru\""
 	else
+		sdrd=$(scale $drd)
+		sdru=$(scale $dru)
+
 		echo "Data Rate:                                Down: ${sdrd}/s / Up: ${sdru}/s"
 	fi
 }
@@ -426,17 +424,15 @@ latency_delay() {
 		idu_s="Fast"
 	fi
 
-	sidu=$(scale_latency $idu)
-	sidd=$(scale_latency $idd)
-
 	if [ "$action" = "lucistat" ]; then
 		echo "dsl.latency_down=\"$(scale_latency_us $idd)\""
 		echo "dsl.latency_up=\"$(scale_latency_us $idu)\""
-		echo "dsl.latency_num_down=\"$sidd\""
-		echo "dsl.latency_num_up=\"$sidu\""
 		echo "dsl.latency_s_down=\"$idd_s\""
 		echo "dsl.latency_s_up=\"$idu_s\""
 	else
+		sidu=$(scale_latency $idu)
+		sidd=$(scale_latency $idd)
+
 		echo "Latency [Interleave Delay]:               ${sidd} [${idd_s}]   ${sidu} [${idu_s}]"
 	fi
 }
@@ -536,26 +532,22 @@ line_uptime() {
 
 	[ -z "$et" ] && et=0
 
-	d=$(expr $et / 86400)
-	etr=$(expr $et % 86400)
-	h=$(expr $etr / 3600)
-	etr=$(expr $etr % 3600)
-	m=$(expr $etr / 60)
-	s=$(expr $etr % 60)
-
-
-	[ "${d}${h}${m}${s}" -ne 0 ] && rc="${s}s"
-	[ "${d}${h}${m}" -ne 0 ] && rc="${m}m ${rc}"
-	[ "${d}${h}" -ne 0 ] && rc="${h}h ${rc}"
-	[ "${d}" -ne 0 ] && rc="${d}d ${rc}"
-
-	[ -z "$rc" ] && rc="down"
-
-
 	if [ "$action" = "lucistat" ]; then
 		echo "dsl.line_uptime=${et}"
-		echo "dsl.line_uptime_s=\"${rc}\""
 	else
+		d=$(expr $et / 86400)
+		etr=$(expr $et % 86400)
+		h=$(expr $etr / 3600)
+		etr=$(expr $etr % 3600)
+		m=$(expr $etr / 60)
+		s=$(expr $etr % 60)
+
+		[ "${d}${h}${m}${s}" -ne 0 ] && rc="${s}s"
+		[ "${d}${h}${m}" -ne 0 ] && rc="${m}m ${rc}"
+		[ "${d}${h}" -ne 0 ] && rc="${h}h ${rc}"
+		[ "${d}" -ne 0 ] && rc="${d}d ${rc}"
+
+		[ -z "$rc" ] && rc="down"
 
 		echo "Line Uptime Seconds:                      ${et}"
 		echo "Line Uptime:                              ${rc}"
@@ -615,9 +607,6 @@ line_data() {
 	[ -z "$attndrd" ] && attndrd=0
 	[ -z "$attndru" ] && attndru=0
 
-	sattndrd=$(scale $attndrd)
-	sattndru=$(scale $attndru)
-	
 	if [ "$action" = "lucistat" ]; then
 		echo "dsl.line_attenuation_down=\"$latnd\""
 		echo "dsl.line_attenuation_up=\"$latnu\""
@@ -629,9 +618,10 @@ line_data() {
 		echo "dsl.actatp_up=\"$actatpu\""
 		echo "dsl.max_data_rate_down=$attndrd"
 		echo "dsl.max_data_rate_up=$attndru"
-		echo "dsl.max_data_rate_down_s=\"$sattndrd\""
-		echo "dsl.max_data_rate_up_s=\"$sattndru\""
 	else
+		sattndrd=$(scale $attndrd)
+		sattndru=$(scale $attndru)
+
 		echo "Line Attenuation (LATN):                  Down: ${latnd} dB / Up: ${latnu} dB"
 		echo "Signal Attenuation (SATN):                Down: ${satnd} dB / Up: ${satnu} dB"
 		echo "Noise Margin (SNR):                       Down: ${snrd} dB / Up: ${snru} dB"
-- 
2.29.2




More information about the openwrt-devel mailing list