Skip to content

Commit cf7ecb1

Browse files
krish2718kartben
authored andcommitted
net: l2: wifi: Add a verbose option for reg_domain
Most users won't be interested in the per-channel rules but only in the country code, so, add a verbose option to hiden per-channel rules which are too verbose. Signed-off-by: Chaitanya Tata <[email protected]>
1 parent 6223c4a commit cf7ecb1

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

subsys/net/l2/wifi/wifi_shell.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,17 +1942,22 @@ static int cmd_wifi_reg_domain(const struct shell *sh, size_t argc,
19421942
int ret, chan_idx = 0;
19431943
int opt;
19441944
bool force = false;
1945+
bool verbose = false;
19451946
int opt_index = 0;
19461947
static const struct option long_options[] = {
19471948
{"force", no_argument, 0, 'f'},
1949+
{"verbose", no_argument, 0, 'v'},
19481950
{NULL, 0, NULL, 0}
19491951
};
19501952

1951-
while ((opt = getopt_long(argc, argv, "f", long_options, &opt_index)) != -1) {
1953+
while ((opt = getopt_long(argc, argv, "fv", long_options, &opt_index)) != -1) {
19521954
switch (opt) {
19531955
case 'f':
19541956
force = true;
19551957
break;
1958+
case 'v':
1959+
verbose = true;
1960+
break;
19561961
default:
19571962
return -ENOEXEC;
19581963
}
@@ -1993,6 +1998,9 @@ static int cmd_wifi_reg_domain(const struct shell *sh, size_t argc,
19931998
if (regd.oper == WIFI_MGMT_GET) {
19941999
PR("Wi-Fi Regulatory domain is: %c%c\n",
19952000
regd.country_code[0], regd.country_code[1]);
2001+
if (!verbose) {
2002+
return 0;
2003+
}
19962004
PR("<channel>\t<center frequency>\t<supported(y/n)>\t"
19972005
"<max power(dBm)>\t<passive transmission only(y/n)>\t<DFS supported(y/n)>\n");
19982006
for (chan_idx = 0; chan_idx < regd.num_channels; chan_idx++) {
@@ -3508,9 +3516,10 @@ SHELL_SUBCMD_ADD((wifi), reg_domain, NULL,
35083516
"[ISO/IEC 3166-1 alpha2]: Regulatory domain\n"
35093517
"[-f]: Force to use this regulatory hint over any other regulatory hints\n"
35103518
"Note1: The behavior of this command is dependent on the Wi-Fi driver/chipset implementation\n"
3511-
"Note2: This may cause regulatory compliance issues, use it at your own risk.\n",
3519+
"Note2: This may cause regulatory compliance issues, use it at your own risk.\n"
3520+
"[-v]: Verbose, display the per-channel regulatory information\n",
35123521
cmd_wifi_reg_domain,
3513-
1, 2);
3522+
1, 3);
35143523

35153524
SHELL_SUBCMD_ADD((wifi), rts_threshold, NULL,
35163525
"<rts_threshold: rts threshold/off>.\n",

0 commit comments

Comments
 (0)