iwinfo: add flags to freqlist output
authorChristian Marangi <ansuelsmth@gmail.com>
Fri, 21 Jan 2022 00:07:51 +0000 (01:07 +0100)
committerChristian 'Ansuel' Marangi <ansuelsmth@gmail.com>
Sat, 21 Jan 2023 00:18:08 +0000 (01:18 +0100)
A channel can declare restriction where it should be used only indoors
or should not be used at all.
Expose these restriction in the channel data as additional info with the
restricted info.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
iwinfo.c

index c93982f273e51f3220b389dfb922145a1c7eca16..e088ea68430738504a54fbc66f126180fabe3ae8 100644 (file)
--- a/iwinfo.c
+++ b/iwinfo.c
@@ -635,6 +635,11 @@ rpc_iwinfo_freqlist(struct ubus_context *ctx, struct ubus_object *obj,
                        blobmsg_add_u32(&buf, "mhz", f->mhz);
                        blobmsg_add_u8(&buf, "restricted", f->restricted);
 
+                       rpc_iwinfo_add_bit_array("flags", f->flags,
+                                               IWINFO_FREQ_FLAG_NAMES,
+                                               IWINFO_FREQ_FLAG_COUNT,
+                                               true, 0);
+
                        if (ch > -1)
                                blobmsg_add_u8(&buf, "active", f->channel == ch);