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