From c14a18402bc3abf4098916fefe6dafd0873c4586 Mon Sep 17 00:00:00 2001
From: Janusz Dziedzic <janusz.dziedzic@iopsys.eu>
Date: Fri, 7 Oct 2022 12:12:12 +0200
Subject: [PATCH] opclass preferences - show ctrl channels

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@iopsys.eu>
---
 gitlab-ci/install-dependencies.sh |  2 +-
 wifimngr.c                        | 10 ++++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/gitlab-ci/install-dependencies.sh b/gitlab-ci/install-dependencies.sh
index ec44375..ac72a99 100755
--- a/gitlab-ci/install-dependencies.sh
+++ b/gitlab-ci/install-dependencies.sh
@@ -9,7 +9,7 @@ cd /opt/dev
 rm -fr easy-soc-libs
 git clone https://dev.iopsys.eu/iopsys/easy-soc-libs.git
 cd easy-soc-libs
-git checkout cca36404d8e908fdfa40551593d0e6e74ec56caf
+git checkout f407805dd38ee6d6b7e7fb2ab769f056afdf9254
 cd libeasy
 make CFLAGS+="-I/usr/include/libnl3"
 mkdir -p /usr/include/easy
diff --git a/wifimngr.c b/wifimngr.c
index 9570687..8d01d2e 100644
--- a/wifimngr.c
+++ b/wifimngr.c
@@ -2173,11 +2173,11 @@ int wl_opclass_preferences(struct ubus_context *ctx, struct ubus_object *obj,
 			   struct blob_attr *msg)
 {
 	struct wifi_opclass supp_opclass[64] = {0};
-	void *a, *t, *aa, *tt;
+	void *a, *t, *aa, *tt, *aaa;
 	struct blob_buf bb;
 	const char *radio;
 	int num_opclass;
-	int i, j;
+	int i, j, k;
 
 	radio = ubus_radio_to_ifname(obj);
 
@@ -2206,6 +2206,12 @@ int wl_opclass_preferences(struct ubus_context *ctx, struct ubus_object *obj,
 				if (supp_opclass[i].opchannel.ch[j].dfs_state == WIFI_DFS_STATE_UNAVAILABLE)
 					blobmsg_add_u32(&bb, "nop_time", supp_opclass[i].opchannel.ch[j].nop_time);
 			}
+			aaa = blobmsg_open_array(&bb, "ctrl_channels");
+			for (k = 0; k < ARRAY_SIZE(supp_opclass[i].opchannel.ch[j].ctrl_channels); k++) {
+				if (supp_opclass[i].opchannel.ch[j].ctrl_channels[k])
+					blobmsg_add_u32(&bb, "", supp_opclass[i].opchannel.ch[j].ctrl_channels[k]);
+			}
+			blobmsg_close_array(&bb, aaa);
 			blobmsg_close_table(&bb, tt);
 		}
 		blobmsg_close_array(&bb, aa);
-- 
GitLab