luci-mod-status: channel_analysis: fix 6 GHz support
authorAleksander Jan Bajkowski <olek2@wp.pl>
Sat, 15 Mar 2025 16:29:02 +0000 (17:29 +0100)
committerPaul Donald <newtwen+github@gmail.com>
Mon, 17 Mar 2025 14:33:55 +0000 (15:33 +0100)
This commit fixes  wrong channel width in the 6 GHz band. Now all APs
don't show a 20 MHz channel width.

Tested on ZyXEL EX5601 with MT7921 USB adapter.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
modules/luci-mod-status/htdocs/luci-static/resources/view/status/channel_analysis.js

index 32eb797dba17919d40d6d5cb34a75ba39f839331..cf123d6a9809a6d5399e018be15b76772b508ccb 100644 (file)
@@ -311,7 +311,7 @@ return view.extend({
                                /* if channel_width <= 40, refer to HT (above) for actual channel width,
                                 * as vht_operation.channel_width == 40 really only means that the used
                                 * bandwidth is <= 40 and could be 20 Mhz as well */
-                               if (res.vht_operation != null && res.vht_operation.channel_width > 40) {
+                               if (res.vht_operation?.channel_width > 40) {
                                        center_channels[0] = res.vht_operation.center_freq_1;
                                        if (res.vht_operation.channel_width == 80) {
                                                chan_width = 8;
@@ -342,6 +342,29 @@ return view.extend({
                                        }
                                }
 
+                               if (res.he_operation?.channel_width > 20) {
+                                       center_channels[0] = res.he_operation.center_freq_1;
+                                       chan_width = res.he_operation.channel_width / 10;
+                                       switch (res.he_operation.channel_width) {
+                                               case 40:
+                                                       res.channel_width = "40 MHz";
+                                                       break;
+                                               case 80:
+                                                       res.channel_width = "80 MHz";
+                                                       break;
+                                               case 160:
+                                                       res.channel_width = "160 MHz";
+                                                       center_channels.push(res.he_operation.center_freq_2);
+                                                       break;
+                                       }
+                               }
+
+                               if (res.eht_operation?.channel_width == 320) {
+                                       chan_width = 32;
+                                       res.channel_width = "320 MHz";
+                                       center_channels.push(res.eht_operation.center_freq_2);
+                               }
+
                                this.add_wifi_to_graph(chan_analysis, res, scanCache, center_channels, chan_width);
 
                                rows.push([