net: l2: wifi: fix invalid option error when use -i

For 'wifi connect' or 'wifi ap enable' CMD, there is 'invalid option'
error log when input '-i' parameter. Parsing '-i' can fix this issue.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
This commit is contained in:
Maochen Wang 2025-06-10 15:49:49 +08:00 committed by Benjamin Cabé
commit d4648a6767

View file

@ -1147,6 +1147,9 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv
case 'g':
params->ignore_broadcast_ssid = shell_strtol(state->optarg, 10, &ret);
break;
case 'i':
/* Unused, but parsing to avoid unknown option error */
break;
case 'h':
return -ENOEXEC;
default:
@ -2142,6 +2145,10 @@ static int twt_args_to_params(const struct shell *sh, size_t argc, char *argv[],
params->setup.twt_mantissa = (uint16_t)value;
break;
case 'i':
/* Unused, but parsing to avoid unknown option error */
break;
case 'h':
return -ENOEXEC;
}
@ -2452,6 +2459,9 @@ static int wifi_ap_config_args_to_params(const struct shell *sh, size_t argc, ch
params->type |= WIFI_AP_CONFIG_PARAM_VHT_CAPAB;
break;
#endif
case 'i':
/* Unused, but parsing to avoid unknown option error */
break;
case 'h':
shell_help(sh);
return SHELL_CMD_HELP_PRINTED;
@ -2548,6 +2558,9 @@ static int cmd_wifi_reg_domain(const struct shell *sh, size_t argc,
case 'v':
verbose = true;
break;
case 'i':
/* Unused, but parsing to avoid unknown option error */
break;
default:
return -ENOEXEC;
}
@ -3254,6 +3267,9 @@ static int parse_dpp_args_auth_init(const struct shell *sh, size_t argc, char *a
case 's':
strncpy(params->auth_init.ssid, state->optarg, WIFI_SSID_MAX_LEN);
break;
case 'i':
/* Unused, but parsing to avoid unknown option error */
break;
default:
PR_ERROR("Invalid option %c\n", state->optopt);
return -EINVAL;
@ -3291,6 +3307,9 @@ static int parse_dpp_args_chirp(const struct shell *sh, size_t argc, char *argv[
case 'f':
params->chirp.freq = shell_strtol(state->optarg, 10, &ret);
break;
case 'i':
/* Unused, but parsing to avoid unknown option error */
break;
default:
PR_ERROR("Invalid option %c\n", state->optopt);
return -EINVAL;
@ -3328,6 +3347,9 @@ static int parse_dpp_args_listen(const struct shell *sh, size_t argc, char *argv
case 'f':
params->listen.freq = shell_strtol(state->optarg, 10, &ret);
break;
case 'i':
/* Unused, but parsing to avoid unknown option error */
break;
default:
PR_ERROR("Invalid option %c\n", state->optopt);
return -EINVAL;
@ -3374,6 +3396,9 @@ static int parse_dpp_args_btstrap_gen(const struct shell *sh, size_t argc, char
ret = net_bytes_from_str(params->bootstrap_gen.mac,
WIFI_MAC_ADDR_LEN, state->optarg);
break;
case 'i':
/* Unused, but parsing to avoid unknown option error */
break;
default:
PR_ERROR("Invalid option %c\n", state->optopt);
return -EINVAL;
@ -3433,6 +3458,9 @@ static int parse_dpp_args_set_config_param(const struct shell *sh, size_t argc,
case 's':
strncpy(params->configurator_set.ssid, state->optarg, WIFI_SSID_MAX_LEN);
break;
case 'i':
/* Unused, but parsing to avoid unknown option error */
break;
default:
PR_ERROR("Invalid option %c\n", state->optopt);
return -EINVAL;
@ -3717,6 +3745,9 @@ static int cmd_wifi_dpp_ap_auth_init(const struct shell *sh, size_t argc, char *
case 'p':
params.auth_init.peer = shell_strtol(state->optarg, 10, &ret);
break;
case 'i':
/* Unused, but parsing to avoid unknown option error */
break;
default:
PR_ERROR("Invalid option %c\n", state->optopt);
return -EINVAL;