From 01c5a63934392ab66c66c594fbd93a796e36d6e6 Mon Sep 17 00:00:00 2001
From: Andre Heider <a.heider@gmail.com>
Date: Wed, 23 Nov 2022 13:29:22 +0100
Subject: luci-mod-network: use "band" from iwinfo freqlist

Instead of mapping it by frequency.

Signed-off-by: Andre Heider <a.heider@gmail.com>
---
 .../htdocs/luci-static/resources/view/network/wireless.js  | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

(limited to 'modules/luci-mod-network/htdocs/luci-static')

diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js
index 3c6f51afeb..a2b0c84ce2 100644
--- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js
+++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js
@@ -319,19 +319,11 @@ var CBIWifiFrequencyValue = form.Value.extend({
 			};
 
 			for (var i = 0; i < data[1].length; i++) {
-				var band;
-
-				if (data[1][i].mhz >= 2412 && data[1][i].mhz <= 2484)
-					band = '2g';
-				else if (data[1][i].mhz >= 5160 && data[1][i].mhz <= 5885)
-					band = '5g';
-				else if (data[1][i].mhz >= 5925 && data[1][i].mhz <= 7125)
-					band = '6g';
-				else if (data[1][i].mhz >= 58320 && data[1][i].mhz <= 69120)
-					band = '60g';
-				else
+				if (!data[1][i].band)
 					continue;
 
+				var band = '%dg'.format(data[1][i].band);
+
 				this.channels[band].push(
 					data[1][i].channel,
 					'%d (%d Mhz)'.format(data[1][i].channel, data[1][i].mhz),
-- 
cgit v1.2.3