1 /*
2  * Copyright (c) 2023 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /* @file
8  * @brief wpa_cli implementation for Zephyr OS
9  */
10 
11 #include <zephyr/kernel.h>
12 #include <zephyr/shell/shell.h>
13 #include <zephyr/init.h>
14 
15 #include "wpa_cli_zephyr.h"
16 
cmd_wpa_cli(const struct shell * sh,size_t argc,const char * argv[])17 static int cmd_wpa_cli(const struct shell *sh,
18 			  size_t argc,
19 			  const char *argv[])
20 {
21 	ARG_UNUSED(sh);
22 
23 	if (argc == 1) {
24 		shell_error(sh, "Missing argument");
25 		return -EINVAL;
26 	}
27 
28 	argv[argc] = "interactive";
29 	argc++;
30 
31 	/* Remove wpa_cli from the argument list */
32 	return zephyr_wpa_ctrl_zephyr_cmd(argc - 1, &argv[1]);
33 }
34 
35 /* Persisting with "wpa_cli" naming for compatibility with Wi-Fi
36  * certification applications and scripts.
37  */
38 SHELL_CMD_REGISTER(wpa_cli,
39 		   NULL,
40 		   "wpa_cli commands (only for internal use)",
41 		   cmd_wpa_cli);
42