From 27d882e740bf883a43efe5067e3adc5ce8cdeb39 Mon Sep 17 00:00:00 2001 From: Fengming Ye Date: Mon, 24 Jun 2024 12:08:32 +0900 Subject: [PATCH] hostap: add hostapd cli shell command Add hostapd_cli shell command for test. Signed-off-by: Fengming Ye --- modules/hostap/src/wpa_cli.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/modules/hostap/src/wpa_cli.c b/modules/hostap/src/wpa_cli.c index 1ea6be54a5d..406008da101 100644 --- a/modules/hostap/src/wpa_cli.c +++ b/modules/hostap/src/wpa_cli.c @@ -13,6 +13,9 @@ #include #include "wpa_cli_zephyr.h" +#ifdef CONFIG_WIFI_NM_HOSTAPD_AP +#include "hostapd_cli_zephyr.h" +#endif static int cmd_wpa_cli(const struct shell *sh, size_t argc, @@ -32,6 +35,24 @@ static int cmd_wpa_cli(const struct shell *sh, return zephyr_wpa_ctrl_zephyr_cmd(argc - 1, &argv[1]); } +#ifdef CONFIG_WIFI_NM_HOSTAPD_AP +static int cmd_hostapd_cli(const struct shell *sh, size_t argc, const char *argv[]) +{ + ARG_UNUSED(sh); + + if (argc == 1) { + shell_error(sh, "Missing argument"); + return -EINVAL; + } + + argv[argc] = "interactive"; + argc++; + + /* Remove hostapd_cli from the argument list */ + return zephyr_hostapd_ctrl_zephyr_cmd(argc - 1, &argv[1]); +} +#endif + /* Persisting with "wpa_cli" naming for compatibility with Wi-Fi * certification applications and scripts. */ @@ -39,3 +60,7 @@ SHELL_CMD_REGISTER(wpa_cli, NULL, "wpa_cli commands (only for internal use)", cmd_wpa_cli); +#ifdef CONFIG_WIFI_NM_HOSTAPD_AP +SHELL_CMD_REGISTER(hostapd_cli, NULL, "hostapd_cli commands (only for internal use)", + cmd_hostapd_cli); +#endif