@@ -953,6 +953,65 @@ static int cmd_wifi_status(const struct shell *sh, size_t argc, char *argv[])
953953 return 0 ;
954954}
955955
956+ static int cmd_wifi_ap_status (const struct shell * sh , size_t argc , char * argv [])
957+ {
958+ struct net_if * iface = net_if_get_wifi_sap ();
959+ struct wifi_iface_status status = {0 };
960+ uint8_t mac_string_buf [sizeof ("xx:xx:xx:xx:xx:xx" )];
961+
962+ context .sh = sh ;
963+
964+ if (net_mgmt (NET_REQUEST_WIFI_IFACE_STATUS , iface , & status ,
965+ sizeof (struct wifi_iface_status ))) {
966+ PR_WARNING ("Status request failed\n" );
967+
968+ return - ENOEXEC ;
969+ }
970+
971+ switch (status .state ) {
972+ case WIFI_HAPD_IFACE_UNINITIALIZED :
973+ PR ("State: %s\n" , "HAPD_IFACE_UNINITIALIZED" );
974+ return 0 ;
975+ case WIFI_HAPD_IFACE_DISABLED :
976+ PR ("State: %s\n" , "HAPD_IFACE_DISABLED" );
977+ return 0 ;
978+ case WIFI_HAPD_IFACE_COUNTRY_UPDATE :
979+ PR ("State: %s\n" , "HAPD_IFACE_DISABLED" );
980+ return 0 ;
981+ case WIFI_HAPD_IFACE_ACS :
982+ PR ("State: %s\n" , "HAPD_IFACE_DISABLED" );
983+ return 0 ;
984+ case WIFI_HAPD_IFACE_HT_SCAN :
985+ PR ("State: %s\n" , "HAPD_IFACE_DISABLED" );
986+ return 0 ;
987+ case WIFI_HAPD_IFACE_DFS :
988+ PR ("State: %s\n" , "HAPD_IFACE_DISABLED" );
989+ break ;
990+ case WIFI_HAPD_IFACE_ENABLED :
991+ break ;
992+ default :
993+ return 0 ;
994+ }
995+
996+ PR ("Interface Mode: %s\n" , wifi_mode_txt (status .iface_mode ));
997+ PR ("Link Mode: %s\n" , wifi_link_mode_txt (status .link_mode ));
998+ PR ("SSID: %.32s\n" , status .ssid );
999+ PR ("BSSID: %s\n" , net_sprint_ll_addr_buf (status .bssid , WIFI_MAC_ADDR_LEN , mac_string_buf ,
1000+ sizeof (mac_string_buf )));
1001+ PR ("Band: %s\n" , wifi_band_txt (status .band ));
1002+ PR ("Channel: %d\n" , status .channel );
1003+ PR ("Security: %s\n" , wifi_security_txt (status .security ));
1004+ PR ("MFP: %s\n" , wifi_mfp_txt (status .mfp ));
1005+ if (status .iface_mode == WIFI_MODE_INFRA ) {
1006+ PR ("RSSI: %d\n" , status .rssi );
1007+ }
1008+ PR ("Beacon Interval: %d\n" , status .beacon_interval );
1009+ PR ("DTIM: %d\n" , status .dtim_period );
1010+ PR ("TWT: %s\n" , status .twt_capable ? "Supported" : "Not supported" );
1011+
1012+ return 0 ;
1013+ }
1014+
9561015#if defined(CONFIG_NET_STATISTICS_WIFI ) && \
9571016 defined(CONFIG_NET_STATISTICS_USER_API )
9581017static void print_wifi_stats (struct net_if * iface , struct net_stats_wifi * data ,
@@ -2716,43 +2775,36 @@ static int cmd_wifi_pmksa_flush(const struct shell *sh, size_t argc, char *argv[
27162775 return 0 ;
27172776}
27182777
2719- SHELL_STATIC_SUBCMD_SET_CREATE (wifi_cmd_ap ,
2720- SHELL_CMD_ARG (disable , NULL ,
2721- "Disable Access Point mode.\n" ,
2722- cmd_wifi_ap_disable ,
2723- 1 , 0 ),
2778+ SHELL_STATIC_SUBCMD_SET_CREATE (
2779+ wifi_cmd_ap ,
2780+ SHELL_CMD_ARG (disable , NULL , "Disable Access Point mode.\n" , cmd_wifi_ap_disable , 1 , 0 ),
27242781 SHELL_CMD_ARG (enable , NULL ,
2725- "-s --ssid=<SSID>\n"
2726- "-c --channel=<channel number>\n"
2727- "-p --passphrase=<PSK> (valid only for secure SSIDs)\n"
2728- "-k --key-mgmt=<Security type> (valid only for secure SSIDs)\n"
2729- "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP-TLS, 6:WEP\n"
2730- "7: WPA-PSK, 11: DPP\n"
2731- "-w --ieee-80211w=<MFP> (optional: needs security type to be specified)\n"
2732- "0:Disable, 1:Optional, 2:Required\n"
2733- "-b --band=<band> (2 -2.6GHz, 5 - 5Ghz, 6 - 6GHz)\n"
2734- "-m --bssid=<BSSID>\n"
2735- "-h --help (prints help)" ,
2736- cmd_wifi_ap_enable ,
2737- 2 , 13 ),
2738- SHELL_CMD_ARG (stations , NULL ,
2739- "List stations connected to the AP" ,
2740- cmd_wifi_ap_stations ,
2741- 1 , 0 ),
2782+ "-s --ssid=<SSID>\n"
2783+ "-c --channel=<channel number>\n"
2784+ "-p --passphrase=<PSK> (valid only for secure SSIDs)\n"
2785+ "-k --key-mgmt=<Security type> (valid only for secure SSIDs)\n"
2786+ "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP-TLS, 6:WEP\n"
2787+ "7: WPA-PSK, 11: DPP\n"
2788+ "-w --ieee-80211w=<MFP> (optional: needs security type to be specified)\n"
2789+ "0:Disable, 1:Optional, 2:Required\n"
2790+ "-b --band=<band> (2 -2.6GHz, 5 - 5Ghz, 6 - 6GHz)\n"
2791+ "-m --bssid=<BSSID>\n"
2792+ "-h --help (prints help)" ,
2793+ cmd_wifi_ap_enable , 2 , 13 ),
2794+ SHELL_CMD_ARG (stations , NULL , "List stations connected to the AP" , cmd_wifi_ap_stations , 1 ,
2795+ 0 ),
27422796 SHELL_CMD_ARG (disconnect , NULL ,
2743- "Disconnect a station from the AP\n"
2744- "<MAC address of the station>\n" ,
2745- cmd_wifi_ap_sta_disconnect ,
2746- 2 , 0 ),
2797+ "Disconnect a station from the AP\n"
2798+ "<MAC address of the station>\n" ,
2799+ cmd_wifi_ap_sta_disconnect , 2 , 0 ),
27472800 SHELL_CMD_ARG (config , NULL ,
2748- "Configure AP parameters.\n"
2749- "-i --max_inactivity=<time duration (in seconds)>\n"
2750- "-s --max_num_sta=<maximum number of stations>\n"
2751- "-h --help (prints help)" ,
2752- cmd_wifi_ap_config_params ,
2753- 2 , 5 ),
2754- SHELL_SUBCMD_SET_END
2755- );
2801+ "Configure AP parameters.\n"
2802+ "-i --max_inactivity=<time duration (in seconds)>\n"
2803+ "-s --max_num_sta=<maximum number of stations>\n"
2804+ "-h --help (prints help)" ,
2805+ cmd_wifi_ap_config_params , 2 , 5 ),
2806+ SHELL_CMD_ARG (status , NULL , "Status of Wi-Fi SAP\n" , cmd_wifi_ap_status , 1 , 0 ),
2807+ SHELL_SUBCMD_SET_END );
27562808
27572809SHELL_SUBCMD_ADD ((wifi ), ap , & wifi_cmd_ap ,
27582810 "Access Point mode commands." ,
0 commit comments