Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
[nrf noup] wpa_supplicant: Remove non-output status
Browse files Browse the repository at this point in the history
fixup! [nrf noup] zephyr: Add support for WPA CLI zephyr

There is "OK/FAIL" status multipal times during
wifi commands. Make new interactive api for wap_cli
commands which prints "OK/FAIL". It will avoid prints
for wifi commands.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
  • Loading branch information
kapbh committed Dec 21, 2023
1 parent bd3f174 commit b26675b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/common/wpa_ctrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ char * wpa_ctrl_get_remote_ifname(struct wpa_ctrl *ctrl);
#endif /* CONFIG_CTRL_IFACE_UDP */

int wpa_ctrl_command(struct wpa_ctrl *ctrl, const char *cmd);
int wpa_ctrl_command_interactive(struct wpa_ctrl *ctrl, const char *cmd);
int wpa_request(struct wpa_ctrl *ctrl, int argc, char *argv[]);

#ifdef __cplusplus
Expand Down
17 changes: 16 additions & 1 deletion wpa_supplicant/wpa_cli_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ static int wpa_cli_cmd(struct wpa_ctrl *ctrl, const char *cmd, int min_args,
{
char * buf = NULL;
int ret = 0;
bool interactive = 0;

for (int i = 0; i < argc; i++) {
if (strcmp(argv[i], "interactive") == 0) {
interactive = 1;
argv[i] = NULL;
argc--;
break;
}
}

if (argc < min_args) {
wpa_printf(MSG_INFO, "Invalid %s command - at least %d argument%s "
"required.\n", cmd, min_args,
Expand All @@ -58,7 +69,11 @@ static int wpa_cli_cmd(struct wpa_ctrl *ctrl, const char *cmd, int min_args,
ret = -1;
goto out;
}
ret = wpa_ctrl_command(ctrl, buf);

if (interactive)
ret = wpa_ctrl_command_interactive(ctrl, buf);
else
ret = wpa_ctrl_command(ctrl, buf);

out:
if (buf)
Expand Down
5 changes: 5 additions & 0 deletions wpa_supplicant/wpa_cli_zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,11 @@ char supp_make_argv(size_t *argc, const char **argv, char *cmd,
}

int wpa_ctrl_command(struct wpa_ctrl *ctrl, const char *cmd)
{
return _wpa_ctrl_command(ctrl, cmd, 0, NULL);
}

int wpa_ctrl_command_interactive(struct wpa_ctrl *ctrl, const char *cmd)
{
return _wpa_ctrl_command(ctrl, cmd, 1, NULL);
}
Expand Down

0 comments on commit b26675b

Please sign in to comment.