[openwrt/openwrt] wifi-scripts: ucode: improve formatting of expected throughput

LEDE Commits lede-commits at lists.infradead.org
Mon Dec 15 03:39:17 PST 2025


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/36da03a6c16b6e6c0d16b1471635647e46028ebc

commit 36da03a6c16b6e6c0d16b1471635647e46028ebc
Author: Rany Hany <rany_hany at riseup.net>
AuthorDate: Mon Oct 27 16:14:22 2025 +0000

    wifi-scripts: ucode: improve formatting of expected throughput
    
    Convert to MBit/s like all other fields and specify the unit.
    Most users probably aren't aware that this is in kilobits/s.
    
    Signed-off-by: Rany Hany <rany_hany at riseup.net>
    Link: https://github.com/openwrt/openwrt/pull/20567
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 package/network/config/wifi-scripts/files-ucode/usr/bin/iwinfo      | 3 ++-
 .../config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc       | 6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/package/network/config/wifi-scripts/files-ucode/usr/bin/iwinfo b/package/network/config/wifi-scripts/files-ucode/usr/bin/iwinfo
index a1290ac201..d36268b06e 100755
--- a/package/network/config/wifi-scripts/files-ucode/usr/bin/iwinfo
+++ b/package/network/config/wifi-scripts/files-ucode/usr/bin/iwinfo
@@ -25,7 +25,8 @@ function print_assoclist(stations) {
 				printf(', %s', flags);
 			printf('%10d Pkts.\n', bitrate.packets);
 		}
-		printf(`\texpected throughput: ${station.expected_throughput}\n\n`);
+		let expected_throughput = station.expected_throughput;
+		printf(`\texpected throughput: ${expected_throughput == 'unknown' ? 'unknown' : expected_throughput + ' MBit/s'}\n\n`);
 	}
 }
 
diff --git a/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc b/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc
index 21244089ab..b2eb8cfd10 100644
--- a/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc
+++ b/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc
@@ -169,6 +169,10 @@ function format_rate(rate) {
 	return rate ? sprintf('%.01f', rate / 10.0) : 'unknown';
 }
 
+function format_expected_throughput(rate) {
+	return rate ? sprintf('%.01f', rate / 1000.0) : 'unknown';
+}
+
 function format_mgmt_key(key) {
 	switch(+key) {
 	case 1:
@@ -352,7 +356,7 @@ export function assoclist(dev) {
 				packets: station.sta_info.tx_packets ?? 0,
 				flags: assoc_flags(station.sta_info.tx_bitrate ?? {}),
 			},
-			expected_throughput: station.sta_info.expected_throughput ?? 'unknown',
+			expected_throughput: format_expected_throughput(station.sta_info.expected_throughput ?? 0),
 		};
 		ret[sta.mac] = sta;
 	}




More information about the lede-commits mailing list