@@ -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 ,
@@ -2702,43 +2761,36 @@ static int cmd_wifi_pmksa_flush(const struct shell *sh, size_t argc, char *argv[
27022761 return 0 ;
27032762}
27042763
2705- SHELL_STATIC_SUBCMD_SET_CREATE (wifi_cmd_ap ,
2706- SHELL_CMD_ARG (disable , NULL ,
2707- "Disable Access Point mode.\n" ,
2708- cmd_wifi_ap_disable ,
2709- 1 , 0 ),
2764+ SHELL_STATIC_SUBCMD_SET_CREATE (
2765+ wifi_cmd_ap ,
2766+ SHELL_CMD_ARG (disable , NULL , "Disable Access Point mode.\n" , cmd_wifi_ap_disable , 1 , 0 ),
27102767 SHELL_CMD_ARG (enable , NULL ,
2711- "-s --ssid=<SSID>\n"
2712- "-c --channel=<channel number>\n"
2713- "-p --passphrase=<PSK> (valid only for secure SSIDs)\n"
2714- "-k --key-mgmt=<Security type> (valid only for secure SSIDs)\n"
2715- "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP-TLS, 6:WEP\n"
2716- "7: WPA-PSK, 11: DPP\n"
2717- "-w --ieee-80211w=<MFP> (optional: needs security type to be specified)\n"
2718- "0:Disable, 1:Optional, 2:Required\n"
2719- "-b --band=<band> (2 -2.6GHz, 5 - 5Ghz, 6 - 6GHz)\n"
2720- "-m --bssid=<BSSID>\n"
2721- "-h --help (prints help)" ,
2722- cmd_wifi_ap_enable ,
2723- 2 , 13 ),
2724- SHELL_CMD_ARG (stations , NULL ,
2725- "List stations connected to the AP" ,
2726- cmd_wifi_ap_stations ,
2727- 1 , 0 ),
2768+ "-s --ssid=<SSID>\n"
2769+ "-c --channel=<channel number>\n"
2770+ "-p --passphrase=<PSK> (valid only for secure SSIDs)\n"
2771+ "-k --key-mgmt=<Security type> (valid only for secure SSIDs)\n"
2772+ "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP-TLS, 6:WEP\n"
2773+ "7: WPA-PSK, 11: DPP\n"
2774+ "-w --ieee-80211w=<MFP> (optional: needs security type to be specified)\n"
2775+ "0:Disable, 1:Optional, 2:Required\n"
2776+ "-b --band=<band> (2 -2.6GHz, 5 - 5Ghz, 6 - 6GHz)\n"
2777+ "-m --bssid=<BSSID>\n"
2778+ "-h --help (prints help)" ,
2779+ cmd_wifi_ap_enable , 2 , 13 ),
2780+ SHELL_CMD_ARG (stations , NULL , "List stations connected to the AP" , cmd_wifi_ap_stations , 1 ,
2781+ 0 ),
27282782 SHELL_CMD_ARG (disconnect , NULL ,
2729- "Disconnect a station from the AP\n"
2730- "<MAC address of the station>\n" ,
2731- cmd_wifi_ap_sta_disconnect ,
2732- 2 , 0 ),
2783+ "Disconnect a station from the AP\n"
2784+ "<MAC address of the station>\n" ,
2785+ cmd_wifi_ap_sta_disconnect , 2 , 0 ),
27332786 SHELL_CMD_ARG (config , NULL ,
2734- "Configure AP parameters.\n"
2735- "-i --max_inactivity=<time duration (in seconds)>\n"
2736- "-s --max_num_sta=<maximum number of stations>\n"
2737- "-h --help (prints help)" ,
2738- cmd_wifi_ap_config_params ,
2739- 2 , 5 ),
2740- SHELL_SUBCMD_SET_END
2741- );
2787+ "Configure AP parameters.\n"
2788+ "-i --max_inactivity=<time duration (in seconds)>\n"
2789+ "-s --max_num_sta=<maximum number of stations>\n"
2790+ "-h --help (prints help)" ,
2791+ cmd_wifi_ap_config_params , 2 , 5 ),
2792+ SHELL_CMD_ARG (status , NULL , "Status of Wi-Fi SAP\n" , cmd_wifi_ap_status , 1 , 0 ),
2793+ SHELL_SUBCMD_SET_END );
27422794
27432795SHELL_STATIC_SUBCMD_SET_CREATE (wifi_twt_ops ,
27442796 SHELL_CMD_ARG (quick_setup , NULL , " Start a TWT flow with defaults:\n"
0 commit comments