@@ -1974,7 +1974,7 @@ static int cmd_wifi_btm_query(const struct shell *sh, size_t argc, char *argv[])
19741974
19751975static int cmd_wifi_wps_pbc (const struct shell * sh , size_t argc , char * argv [])
19761976{
1977- struct net_if * iface = net_if_get_first_wifi ();
1977+ struct net_if * iface = net_if_get_wifi_sta ();
19781978 struct wifi_wps_config_params params = {0 };
19791979
19801980 context .sh = sh ;
@@ -1996,7 +1996,7 @@ static int cmd_wifi_wps_pbc(const struct shell *sh, size_t argc, char *argv[])
19961996
19971997static int cmd_wifi_wps_pin (const struct shell * sh , size_t argc , char * argv [])
19981998{
1999- struct net_if * iface = net_if_get_first_wifi ();
1999+ struct net_if * iface = net_if_get_wifi_sta ();
20002000 struct wifi_wps_config_params params = {0 };
20012001
20022002 context .sh = sh ;
@@ -2023,6 +2023,57 @@ static int cmd_wifi_wps_pin(const struct shell *sh, size_t argc, char *argv[])
20232023 return 0 ;
20242024}
20252025
2026+ static int cmd_wifi_ap_wps_pbc (const struct shell * sh , size_t argc , char * argv [])
2027+ {
2028+ struct net_if * iface = net_if_get_wifi_sap ();
2029+ struct wifi_wps_config_params params = {0 };
2030+
2031+ context .sh = sh ;
2032+
2033+ if (argc == 1 ) {
2034+ params .oper = WIFI_WPS_PBC ;
2035+ } else {
2036+ shell_help (sh );
2037+ return - ENOEXEC ;
2038+ }
2039+
2040+ if (net_mgmt (NET_REQUEST_WIFI_WPS_CONFIG , iface , & params , sizeof (params ))) {
2041+ PR_WARNING ("Start AP WPS PBC failed\n" );
2042+ return - ENOEXEC ;
2043+ }
2044+
2045+ return 0 ;
2046+ }
2047+
2048+ static int cmd_wifi_ap_wps_pin (const struct shell * sh , size_t argc , char * argv [])
2049+ {
2050+ struct net_if * iface = net_if_get_wifi_sap ();
2051+ struct wifi_wps_config_params params = {0 };
2052+
2053+ context .sh = sh ;
2054+
2055+ if (argc == 1 ) {
2056+ params .oper = WIFI_WPS_PIN_GET ;
2057+ } else if (argc == 2 ) {
2058+ params .oper = WIFI_WPS_PIN_SET ;
2059+ strncpy (params .pin , argv [1 ], WIFI_WPS_PIN_MAX_LEN );
2060+ } else {
2061+ shell_help (sh );
2062+ return - ENOEXEC ;
2063+ }
2064+
2065+ if (net_mgmt (NET_REQUEST_WIFI_WPS_CONFIG , iface , & params , sizeof (params ))) {
2066+ PR_WARNING ("Start AP WPS PIN failed\n" );
2067+ return - ENOEXEC ;
2068+ }
2069+
2070+ if (params .oper == WIFI_WPS_PIN_GET ) {
2071+ PR ("WPS PIN is: %s\n" , params .pin );
2072+ }
2073+
2074+ return 0 ;
2075+ }
2076+
20262077static int cmd_wifi_ps_wakeup_mode (const struct shell * sh , size_t argc , char * argv [])
20272078{
20282079 struct net_if * iface = net_if_get_first_wifi ();
@@ -3054,6 +3105,13 @@ SHELL_STATIC_SUBCMD_SET_CREATE(
30543105 "-s --max_num_sta=<maximum number of stations>\n"
30553106 "-h --help (prints help)" ,
30563107 cmd_wifi_ap_config_params , 2 , 5 ),
3108+ SHELL_CMD_ARG (wps_pbc , NULL ,
3109+ "Start AP WPS PBC session.\n" ,
3110+ cmd_wifi_ap_wps_pbc , 1 , 0 ),
3111+ SHELL_CMD_ARG (wps_pin , NULL ,
3112+ "Get or Set AP WPS PIN.\n"
3113+ "[pin] Only applicable for set.\n" ,
3114+ cmd_wifi_ap_wps_pin , 1 , 1 ),
30573115 SHELL_CMD_ARG (status , NULL , "Status of Wi-Fi SAP\n" , cmd_wifi_ap_status , 1 , 0 ),
30583116 SHELL_SUBCMD_SET_END );
30593117
0 commit comments