@@ -954,6 +954,65 @@ static int cmd_wifi_status(const struct shell *sh, size_t argc, char *argv[])
954954 return 0 ;
955955}
956956
957+ static int cmd_wifi_ap_status (const struct shell * sh , size_t argc , char * argv [])
958+ {
959+ struct net_if * iface = net_if_get_wifi_sap ();
960+ struct wifi_iface_status status = {0 };
961+ uint8_t mac_string_buf [sizeof ("xx:xx:xx:xx:xx:xx" )];
962+
963+ context .sh = sh ;
964+
965+ if (net_mgmt (NET_REQUEST_WIFI_IFACE_STATUS , iface , & status ,
966+ sizeof (struct wifi_iface_status ))) {
967+ PR_WARNING ("Status request failed\n" );
968+
969+ return - ENOEXEC ;
970+ }
971+
972+ switch (status .state ) {
973+ case WIFI_HAPD_IFACE_UNINITIALIZED :
974+ PR ("State: %s\n" , "HAPD_IFACE_UNINITIALIZED" );
975+ return 0 ;
976+ case WIFI_HAPD_IFACE_DISABLED :
977+ PR ("State: %s\n" , "HAPD_IFACE_DISABLED" );
978+ return 0 ;
979+ case WIFI_HAPD_IFACE_COUNTRY_UPDATE :
980+ PR ("State: %s\n" , "HAPD_IFACE_DISABLED" );
981+ return 0 ;
982+ case WIFI_HAPD_IFACE_ACS :
983+ PR ("State: %s\n" , "HAPD_IFACE_DISABLED" );
984+ return 0 ;
985+ case WIFI_HAPD_IFACE_HT_SCAN :
986+ PR ("State: %s\n" , "HAPD_IFACE_DISABLED" );
987+ return 0 ;
988+ case WIFI_HAPD_IFACE_DFS :
989+ PR ("State: %s\n" , "HAPD_IFACE_DISABLED" );
990+ break ;
991+ case WIFI_HAPD_IFACE_ENABLED :
992+ break ;
993+ default :
994+ return 0 ;
995+ }
996+
997+ PR ("Interface Mode: %s\n" , wifi_mode_txt (status .iface_mode ));
998+ PR ("Link Mode: %s\n" , wifi_link_mode_txt (status .link_mode ));
999+ PR ("SSID: %.32s\n" , status .ssid );
1000+ PR ("BSSID: %s\n" , net_sprint_ll_addr_buf (status .bssid , WIFI_MAC_ADDR_LEN , mac_string_buf ,
1001+ sizeof (mac_string_buf )));
1002+ PR ("Band: %s\n" , wifi_band_txt (status .band ));
1003+ PR ("Channel: %d\n" , status .channel );
1004+ PR ("Security: %s\n" , wifi_security_txt (status .security ));
1005+ PR ("MFP: %s\n" , wifi_mfp_txt (status .mfp ));
1006+ if (status .iface_mode == WIFI_MODE_INFRA ) {
1007+ PR ("RSSI: %d\n" , status .rssi );
1008+ }
1009+ PR ("Beacon Interval: %d\n" , status .beacon_interval );
1010+ PR ("DTIM: %d\n" , status .dtim_period );
1011+ PR ("TWT: %s\n" , status .twt_capable ? "Supported" : "Not supported" );
1012+
1013+ return 0 ;
1014+ }
1015+
9571016#if defined(CONFIG_NET_STATISTICS_WIFI ) && \
9581017 defined(CONFIG_NET_STATISTICS_USER_API )
9591018static void print_wifi_stats (struct net_if * iface , struct net_stats_wifi * data ,
@@ -2754,43 +2813,36 @@ static int cmd_wifi_pmksa_flush(const struct shell *sh, size_t argc, char *argv[
27542813 return 0 ;
27552814}
27562815
2757- SHELL_STATIC_SUBCMD_SET_CREATE (wifi_cmd_ap ,
2758- SHELL_CMD_ARG (disable , NULL ,
2759- "Disable Access Point mode.\n" ,
2760- cmd_wifi_ap_disable ,
2761- 1 , 0 ),
2816+ SHELL_STATIC_SUBCMD_SET_CREATE (
2817+ wifi_cmd_ap ,
2818+ SHELL_CMD_ARG (disable , NULL , "Disable Access Point mode.\n" , cmd_wifi_ap_disable , 1 , 0 ),
27622819 SHELL_CMD_ARG (enable , NULL ,
2763- "-s --ssid=<SSID>\n"
2764- "-c --channel=<channel number>\n"
2765- "-p --passphrase=<PSK> (valid only for secure SSIDs)\n"
2766- "-k --key-mgmt=<Security type> (valid only for secure SSIDs)\n"
2767- "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP-TLS, 6:WEP\n"
2768- "7: WPA-PSK, 11: DPP\n"
2769- "-w --ieee-80211w=<MFP> (optional: needs security type to be specified)\n"
2770- "0:Disable, 1:Optional, 2:Required\n"
2771- "-b --band=<band> (2 -2.6GHz, 5 - 5Ghz, 6 - 6GHz)\n"
2772- "-m --bssid=<BSSID>\n"
2773- "-h --help (prints help)" ,
2774- cmd_wifi_ap_enable ,
2775- 2 , 13 ),
2776- SHELL_CMD_ARG (stations , NULL ,
2777- "List stations connected to the AP" ,
2778- cmd_wifi_ap_stations ,
2779- 1 , 0 ),
2820+ "-s --ssid=<SSID>\n"
2821+ "-c --channel=<channel number>\n"
2822+ "-p --passphrase=<PSK> (valid only for secure SSIDs)\n"
2823+ "-k --key-mgmt=<Security type> (valid only for secure SSIDs)\n"
2824+ "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP-TLS, 6:WEP\n"
2825+ "7: WPA-PSK, 11: DPP\n"
2826+ "-w --ieee-80211w=<MFP> (optional: needs security type to be specified)\n"
2827+ "0:Disable, 1:Optional, 2:Required\n"
2828+ "-b --band=<band> (2 -2.6GHz, 5 - 5Ghz, 6 - 6GHz)\n"
2829+ "-m --bssid=<BSSID>\n"
2830+ "-h --help (prints help)" ,
2831+ cmd_wifi_ap_enable , 2 , 13 ),
2832+ SHELL_CMD_ARG (stations , NULL , "List stations connected to the AP" , cmd_wifi_ap_stations , 1 ,
2833+ 0 ),
27802834 SHELL_CMD_ARG (disconnect , NULL ,
2781- "Disconnect a station from the AP\n"
2782- "<MAC address of the station>\n" ,
2783- cmd_wifi_ap_sta_disconnect ,
2784- 2 , 0 ),
2835+ "Disconnect a station from the AP\n"
2836+ "<MAC address of the station>\n" ,
2837+ cmd_wifi_ap_sta_disconnect , 2 , 0 ),
27852838 SHELL_CMD_ARG (config , NULL ,
2786- "Configure AP parameters.\n"
2787- "-i --max_inactivity=<time duration (in seconds)>\n"
2788- "-s --max_num_sta=<maximum number of stations>\n"
2789- "-h --help (prints help)" ,
2790- cmd_wifi_ap_config_params ,
2791- 2 , 5 ),
2792- SHELL_SUBCMD_SET_END
2793- );
2839+ "Configure AP parameters.\n"
2840+ "-i --max_inactivity=<time duration (in seconds)>\n"
2841+ "-s --max_num_sta=<maximum number of stations>\n"
2842+ "-h --help (prints help)" ,
2843+ cmd_wifi_ap_config_params , 2 , 5 ),
2844+ SHELL_CMD_ARG (status , NULL , "Status of Wi-Fi SAP\n" , cmd_wifi_ap_status , 1 , 0 ),
2845+ SHELL_SUBCMD_SET_END );
27942846
27952847SHELL_STATIC_SUBCMD_SET_CREATE (wifi_twt_ops ,
27962848 SHELL_CMD_ARG (quick_setup , NULL , " Start a TWT flow with defaults:\n"
0 commit comments