Lines Matching +full:check +full:- +full:pr

5  * SPDX-License-Identifier: Apache-2.0
45 #include <wifi_enterprise_test_certs/client-key.pem.inc>
58 #include <wifi_enterprise_test_certs/client-key2.pem.inc>
67 #include <wifi_enterprise_test_certs/server-key.pem.inc>
143 return -1; in cmd_wifi_set_enterprise_creds()
171 PR_WARNING("%s value out of range: %s, (%ld-%ld)\n", in parse_number()
174 PR_WARNING("Value out of range: %s, (%ld-%ld)\n", in parse_number()
186 (const struct wifi_scan_result *)cb->info; in handle_wifi_scan_result()
194 PR("\n%-4s | %-32s %-5s | %-13s | %-4s | %-15s | %-17s | %-8s\n", in handle_wifi_scan_result()
198 strncpy(ssid_print, entry->ssid, sizeof(ssid_print) - 1); in handle_wifi_scan_result()
199 ssid_print[sizeof(ssid_print) - 1] = '\0'; in handle_wifi_scan_result()
201 PR("%-4d | %-32s %-5u | %-4u (%-6s) | %-4d | %-15s | %-17s | %-8s\n", in handle_wifi_scan_result()
202 context.scan_result, ssid_print, entry->ssid_length, entry->channel, in handle_wifi_scan_result()
203 wifi_band_txt(entry->band), in handle_wifi_scan_result()
204 entry->rssi, in handle_wifi_scan_result()
205 wifi_security_txt(entry->security), in handle_wifi_scan_result()
206 ((entry->mac_length) ? in handle_wifi_scan_result()
207 net_sprint_ll_addr_buf(entry->mac, WIFI_MAC_ADDR_LEN, in handle_wifi_scan_result()
210 wifi_mfp_txt(entry->mfp)); in handle_wifi_scan_result()
220 channel = ((frequency - 2412) / 5) + 1; in wifi_freq_to_channel()
222 channel = ((frequency - 5180) / 5) + 36; in wifi_freq_to_channel()
224 channel = ((frequency - 5500) / 5) + 100; in wifi_freq_to_channel()
226 channel = ((frequency - 5745) / 5) + 149; in wifi_freq_to_channel()
253 (struct wifi_raw_scan_result *)cb->info; in handle_wifi_raw_scan_result()
263 PR("\n%-4s | %-13s | %-4s | %-15s | %-15s | %-32s\n", in handle_wifi_raw_scan_result()
267 rssi = raw->rssi; in handle_wifi_raw_scan_result()
268 channel = wifi_freq_to_channel(raw->frequency); in handle_wifi_raw_scan_result()
269 band = wifi_freq_to_band(raw->frequency); in handle_wifi_raw_scan_result()
271 PR("%-4d | %-4u (%-6s) | %-4d | %s | %-4d ", in handle_wifi_raw_scan_result()
276 net_sprint_ll_addr_buf(raw->data + 10, WIFI_MAC_ADDR_LEN, mac_string_buf, in handle_wifi_raw_scan_result()
277 sizeof(mac_string_buf)), raw->frame_length); in handle_wifi_raw_scan_result()
280 PR("%02X ", *(raw->data + i)); in handle_wifi_raw_scan_result()
283 PR("\n"); in handle_wifi_raw_scan_result()
290 (const struct wifi_status *)cb->info; in handle_wifi_scan_done()
293 if (status->status) { in handle_wifi_scan_done()
294 PR_WARNING("Scan request failed (%d)\n", status->status); in handle_wifi_scan_done()
296 PR("Scan request done\n"); in handle_wifi_scan_done()
305 (const struct wifi_status *) cb->info; in handle_wifi_connect_result()
308 if (status->status) { in handle_wifi_connect_result()
309 PR_WARNING("Connection request failed (%d)\n", status->status); in handle_wifi_connect_result()
311 PR("Connected\n"); in handle_wifi_connect_result()
320 (const struct wifi_status *) cb->info; in handle_wifi_disconnect_result()
324 if (status->status) { in handle_wifi_disconnect_result()
325 PR_WARNING("Disconnection request failed (%d)\n", status->status); in handle_wifi_disconnect_result()
327 PR("Disconnection request done (%d)\n", status->status); in handle_wifi_disconnect_result()
331 PR("Disconnected\n"); in handle_wifi_disconnect_result()
343 PR("TWT Dialog token: %d\n", in print_twt_params()
345 PR("TWT flow ID: %d\n", in print_twt_params()
347 PR("TWT negotiation type: %s\n", in print_twt_params()
349 PR("TWT responder: %s\n", in print_twt_params()
351 PR("TWT implicit: %s\n", in print_twt_params()
353 PR("TWT announce: %s\n", in print_twt_params()
355 PR("TWT trigger: %s\n", in print_twt_params()
357 PR("TWT wake interval: %d us\n", in print_twt_params()
359 PR("TWT interval: %lld us\n", in print_twt_params()
361 PR("========================\n"); in print_twt_params()
367 (const struct wifi_twt_params *)cb->info; in handle_wifi_twt_event()
370 if (resp->operation == WIFI_TWT_TEARDOWN) { in handle_wifi_twt_event()
371 if (resp->teardown_status == WIFI_TWT_TEARDOWN_SUCCESS) { in handle_wifi_twt_event()
372 PR("TWT teardown succeeded for flow ID %d\n", in handle_wifi_twt_event()
373 resp->flow_id); in handle_wifi_twt_event()
375 PR("TWT teardown failed for flow ID %d\n", in handle_wifi_twt_event()
376 resp->flow_id); in handle_wifi_twt_event()
381 if (resp->resp_status == WIFI_TWT_RESP_RECEIVED) { in handle_wifi_twt_event()
382 PR("TWT response: %s\n", in handle_wifi_twt_event()
383 wifi_twt_setup_cmd_txt(resp->setup_cmd)); in handle_wifi_twt_event()
384 PR("== TWT negotiated parameters ==\n"); in handle_wifi_twt_event()
385 print_twt_params(resp->dialog_token, in handle_wifi_twt_event()
386 resp->flow_id, in handle_wifi_twt_event()
387 resp->negotiation_type, in handle_wifi_twt_event()
388 resp->setup.responder, in handle_wifi_twt_event()
389 resp->setup.implicit, in handle_wifi_twt_event()
390 resp->setup.announce, in handle_wifi_twt_event()
391 resp->setup.trigger, in handle_wifi_twt_event()
392 resp->setup.twt_wake_interval, in handle_wifi_twt_event()
393 resp->setup.twt_interval); in handle_wifi_twt_event()
395 PR("TWT response timed out\n"); in handle_wifi_twt_event()
402 (const struct wifi_status *)cb->info; in handle_wifi_ap_enable_result()
405 if (status->status) { in handle_wifi_ap_enable_result()
406 PR_WARNING("AP enable request failed (%d)\n", status->status); in handle_wifi_ap_enable_result()
408 PR("AP enabled\n"); in handle_wifi_ap_enable_result()
415 (const struct wifi_status *)cb->info; in handle_wifi_ap_disable_result()
418 if (status->status) { in handle_wifi_ap_disable_result()
419 PR_WARNING("AP disable request failed (%d)\n", status->status); in handle_wifi_ap_disable_result()
421 PR("AP disabled\n"); in handle_wifi_ap_disable_result()
432 (const struct wifi_ap_sta_info *)cb->info; in handle_wifi_ap_sta_connected()
437 PR("Station connected: %s\n", in handle_wifi_ap_sta_connected()
438 net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, in handle_wifi_ap_sta_connected()
459 (const struct wifi_ap_sta_info *)cb->info; in handle_wifi_ap_sta_disconnected()
463 PR("Station disconnected: %s\n", in handle_wifi_ap_sta_disconnected()
464 net_sprint_ll_addr_buf(sta_info->mac, WIFI_MAC_ADDR_LEN, in handle_wifi_ap_sta_disconnected()
473 if (!memcmp(sta_list[i].sta_info.mac, sta_info->mac, in handle_wifi_ap_sta_disconnected()
495 PR("Start roaming requested\n"); in handle_wifi_signal_change()
510 PR("Neighbor report complete requested\n"); in handle_wifi_neighbor_rep_complete()
573 {"key-mgmt", required_argument, 0, 'k'}, in __wifi_args_to_params()
574 {"ieee-80211w", required_argument, 0, 'w'}, in __wifi_args_to_params()
579 {"anon-id", required_argument, 0, 'a'}, in __wifi_args_to_params()
581 {"key1-pwd", required_argument, 0, 'K'}, in __wifi_args_to_params()
582 {"key2-pwd", required_argument, 0, 'K'}, in __wifi_args_to_params()
583 {"suiteb-type", required_argument, 0, 'S'}, in __wifi_args_to_params()
584 {"TLS-cipher", required_argument, 0, 'T'}, in __wifi_args_to_params()
585 {"eap-version", required_argument, 0, 'V'}, in __wifi_args_to_params()
586 {"eap-id1", required_argument, 0, 'I'}, in __wifi_args_to_params()
587 {"eap-id2", required_argument, 0, 'I'}, in __wifi_args_to_params()
588 {"eap-id3", required_argument, 0, 'I'}, in __wifi_args_to_params()
589 {"eap-id4", required_argument, 0, 'I'}, in __wifi_args_to_params()
590 {"eap-id5", required_argument, 0, 'I'}, in __wifi_args_to_params()
591 {"eap-id6", required_argument, 0, 'I'}, in __wifi_args_to_params()
592 {"eap-id7", required_argument, 0, 'I'}, in __wifi_args_to_params()
593 {"eap-id8", required_argument, 0, 'I'}, in __wifi_args_to_params()
594 {"eap-pwd1", required_argument, 0, 'P'}, in __wifi_args_to_params()
595 {"eap-pwd2", required_argument, 0, 'P'}, in __wifi_args_to_params()
596 {"eap-pwd3", required_argument, 0, 'P'}, in __wifi_args_to_params()
597 {"eap-pwd4", required_argument, 0, 'P'}, in __wifi_args_to_params()
598 {"eap-pwd5", required_argument, 0, 'P'}, in __wifi_args_to_params()
599 {"eap-pwd6", required_argument, 0, 'P'}, in __wifi_args_to_params()
600 {"eap-pwd7", required_argument, 0, 'P'}, in __wifi_args_to_params()
601 {"eap-pwd8", required_argument, 0, 'P'}, in __wifi_args_to_params()
602 {"ignore-broadcast-ssid", required_argument, 0, 'i'}, in __wifi_args_to_params()
603 {"ieee-80211r", no_argument, 0, 'R'}, in __wifi_args_to_params()
623 params->band = WIFI_FREQ_BAND_UNKNOWN; in __wifi_args_to_params()
624 params->channel = WIFI_CHANNEL_ANY; in __wifi_args_to_params()
625 params->security = WIFI_SECURITY_TYPE_NONE; in __wifi_args_to_params()
626 params->mfp = WIFI_MFP_OPTIONAL; in __wifi_args_to_params()
627 params->eap_ver = 1; in __wifi_args_to_params()
628 params->ignore_broadcast_ssid = 0; in __wifi_args_to_params()
629 params->bandwidth = WIFI_FREQ_BANDWIDTH_20MHZ; in __wifi_args_to_params()
632 long_options, &opt_index)) != -1) { in __wifi_args_to_params()
636 params->ssid = state->optarg; in __wifi_args_to_params()
637 params->ssid_length = strlen(params->ssid); in __wifi_args_to_params()
638 if (params->ssid_length > WIFI_SSID_MAX_LEN) { in __wifi_args_to_params()
641 return -EINVAL; in __wifi_args_to_params()
645 params->security = atoi(state->optarg); in __wifi_args_to_params()
646 if (params->security) { in __wifi_args_to_params()
651 params->psk = state->optarg; in __wifi_args_to_params()
652 params->psk_length = strlen(params->psk); in __wifi_args_to_params()
655 channel = strtol(state->optarg, &endptr, 10); in __wifi_args_to_params()
658 params->channel = channel; in __wifi_args_to_params()
664 sizeof(bands_str) - offset, in __wifi_args_to_params()
672 return -EINVAL; in __wifi_args_to_params()
686 return -EINVAL; in __wifi_args_to_params()
689 params->channel = channel; in __wifi_args_to_params()
694 switch (atoi(state->optarg)) { in __wifi_args_to_params()
696 params->band = WIFI_FREQ_BAND_2_4_GHZ; in __wifi_args_to_params()
699 params->band = WIFI_FREQ_BAND_5_GHZ; in __wifi_args_to_params()
702 params->band = WIFI_FREQ_BAND_6_GHZ; in __wifi_args_to_params()
705 PR_ERROR("Invalid band: %d\n", atoi(state->optarg)); in __wifi_args_to_params()
706 return -EINVAL; in __wifi_args_to_params()
711 if (params->security == WIFI_SECURITY_TYPE_NONE || in __wifi_args_to_params()
712 params->security == WIFI_SECURITY_TYPE_WPA_PSK) { in __wifi_args_to_params()
714 wifi_security_txt(params->security)); in __wifi_args_to_params()
715 return -EINVAL; in __wifi_args_to_params()
717 params->mfp = atoi(state->optarg); in __wifi_args_to_params()
720 if (net_bytes_from_str(params->bssid, sizeof(params->bssid), in __wifi_args_to_params()
721 state->optarg) < 0) { in __wifi_args_to_params()
723 return -EINVAL; in __wifi_args_to_params()
728 params->timeout = strtol(state->optarg, &endptr, 10); in __wifi_args_to_params()
730 PR_ERROR("Invalid timeout: %s\n", state->optarg); in __wifi_args_to_params()
731 return -EINVAL; in __wifi_args_to_params()
736 params->anon_id = state->optarg; in __wifi_args_to_params()
737 params->aid_length = strlen(params->anon_id); in __wifi_args_to_params()
738 if (params->aid_length > WIFI_ENT_IDENTITY_MAX_LEN) { in __wifi_args_to_params()
741 return -EINVAL; in __wifi_args_to_params()
746 switch (atoi(state->optarg)) { in __wifi_args_to_params()
748 params->bandwidth = WIFI_FREQ_BANDWIDTH_20MHZ; in __wifi_args_to_params()
751 params->bandwidth = WIFI_FREQ_BANDWIDTH_40MHZ; in __wifi_args_to_params()
754 params->bandwidth = WIFI_FREQ_BANDWIDTH_80MHZ; in __wifi_args_to_params()
757 PR_ERROR("Invalid bandwidth: %d\n", atoi(state->optarg)); in __wifi_args_to_params()
758 return -EINVAL; in __wifi_args_to_params()
765 return -EINVAL; in __wifi_args_to_params()
769 params->key_passwd = state->optarg; in __wifi_args_to_params()
770 params->key_passwd_length = strlen(params->key_passwd); in __wifi_args_to_params()
771 if (params->key_passwd_length > WIFI_ENT_PSWD_MAX_LEN) { in __wifi_args_to_params()
774 return -EINVAL; in __wifi_args_to_params()
777 params->key2_passwd = state->optarg; in __wifi_args_to_params()
778 params->key2_passwd_length = strlen(params->key2_passwd); in __wifi_args_to_params()
779 if (params->key2_passwd_length > WIFI_ENT_PSWD_MAX_LEN) { in __wifi_args_to_params()
782 return -EINVAL; in __wifi_args_to_params()
788 params->suiteb_type = atoi(state->optarg); in __wifi_args_to_params()
791 params->TLS_cipher = atoi(state->optarg); in __wifi_args_to_params()
794 params->eap_ver = atoi(state->optarg); in __wifi_args_to_params()
795 if (params->eap_ver != 0U && params->eap_ver != 1U) { in __wifi_args_to_params()
796 PR_WARNING("eap_ver error %d\n", params->eap_ver); in __wifi_args_to_params()
797 return -EINVAL; in __wifi_args_to_params()
801 if (params->nusers >= WIFI_ENT_IDENTITY_MAX_USERS) { in __wifi_args_to_params()
804 return -EINVAL; in __wifi_args_to_params()
807 params->eap_identity = state->optarg; in __wifi_args_to_params()
808 params->eap_id_length = strlen(params->eap_identity); in __wifi_args_to_params()
810 params->identities[params->nusers] = state->optarg; in __wifi_args_to_params()
811 params->nusers++; in __wifi_args_to_params()
812 if (params->eap_id_length > WIFI_ENT_IDENTITY_MAX_LEN) { in __wifi_args_to_params()
815 return -EINVAL; in __wifi_args_to_params()
819 if (params->passwds >= WIFI_ENT_IDENTITY_MAX_USERS) { in __wifi_args_to_params()
822 return -EINVAL; in __wifi_args_to_params()
825 params->eap_password = state->optarg; in __wifi_args_to_params()
826 params->eap_passwd_length = strlen(params->eap_password); in __wifi_args_to_params()
828 params->passwords[params->passwds] = state->optarg; in __wifi_args_to_params()
829 params->passwds++; in __wifi_args_to_params()
830 if (params->eap_passwd_length > WIFI_ENT_PSWD_MAX_LEN) { in __wifi_args_to_params()
833 return -EINVAL; in __wifi_args_to_params()
837 params->ft_used = true; in __wifi_args_to_params()
840 params->ignore_broadcast_ssid = shell_strtol(state->optarg, 10, &ret); in __wifi_args_to_params()
843 return -ENOEXEC; in __wifi_args_to_params()
845 PR_ERROR("Invalid option %c\n", state->optopt); in __wifi_args_to_params()
846 return -EINVAL; in __wifi_args_to_params()
851 return -EINVAL; in __wifi_args_to_params()
855 if (params->psk && !secure_connection) { in __wifi_args_to_params()
859 if (!params->ssid) { in __wifi_args_to_params()
861 return -EINVAL; in __wifi_args_to_params()
864 if (iface_mode == WIFI_MODE_AP && params->channel == WIFI_CHANNEL_ANY) { in __wifi_args_to_params()
866 return -EINVAL; in __wifi_args_to_params()
871 if (params->channel == 0 && params->band == WIFI_FREQ_BAND_UNKNOWN) { in __wifi_args_to_params()
873 return -EINVAL; in __wifi_args_to_params()
876 if (params->channel > 0 && params->channel <= 14 && in __wifi_args_to_params()
877 (params->band != WIFI_FREQ_BAND_2_4_GHZ && in __wifi_args_to_params()
878 params->band != WIFI_FREQ_BAND_UNKNOWN)) { in __wifi_args_to_params()
880 return -EINVAL; in __wifi_args_to_params()
883 if (params->channel >= 36 && in __wifi_args_to_params()
884 (params->band != WIFI_FREQ_BAND_5_GHZ && in __wifi_args_to_params()
885 params->band != WIFI_FREQ_BAND_UNKNOWN)) { in __wifi_args_to_params()
887 return -EINVAL; in __wifi_args_to_params()
891 if (params->ignore_broadcast_ssid > 2) { in __wifi_args_to_params()
893 return -EINVAL; in __wifi_args_to_params()
909 return -ENOEXEC; in cmd_wifi_connect()
930 return -ENOEXEC; in cmd_wifi_connect()
933 PR("Connection requested\n"); in cmd_wifi_connect()
952 if (status == -EALREADY) { in cmd_wifi_disconnect()
956 return -ENOEXEC; in cmd_wifi_disconnect()
959 PR("Disconnect requested\n"); in cmd_wifi_disconnect()
990 long_options, &opt_index)) != -1) { in wifi_scan_args_to_params()
994 if (!strncasecmp(state->optarg, "passive", 7)) { in wifi_scan_args_to_params()
995 params->scan_type = WIFI_SCAN_TYPE_PASSIVE; in wifi_scan_args_to_params()
996 } else if (!strncasecmp(state->optarg, "active", 6)) { in wifi_scan_args_to_params()
997 params->scan_type = WIFI_SCAN_TYPE_ACTIVE; in wifi_scan_args_to_params()
999 PR_ERROR("Invalid scan type %s\n", state->optarg); in wifi_scan_args_to_params()
1000 return -ENOEXEC; in wifi_scan_args_to_params()
1006 if (wifi_utils_parse_scan_bands(state->optarg, &params->bands)) { in wifi_scan_args_to_params()
1008 return -ENOEXEC; in wifi_scan_args_to_params()
1014 val = atoi(state->optarg); in wifi_scan_args_to_params()
1018 return -ENOEXEC; in wifi_scan_args_to_params()
1021 params->dwell_time_active = val; in wifi_scan_args_to_params()
1025 val = atoi(state->optarg); in wifi_scan_args_to_params()
1029 return -ENOEXEC; in wifi_scan_args_to_params()
1032 params->dwell_time_passive = val; in wifi_scan_args_to_params()
1036 if (wifi_utils_parse_scan_ssids(state->optarg, in wifi_scan_args_to_params()
1037 params->ssids, in wifi_scan_args_to_params()
1038 ARRAY_SIZE(params->ssids))) { in wifi_scan_args_to_params()
1040 return -ENOEXEC; in wifi_scan_args_to_params()
1046 val = atoi(state->optarg); in wifi_scan_args_to_params()
1050 return -ENOEXEC; in wifi_scan_args_to_params()
1053 params->max_bss_cnt = val; in wifi_scan_args_to_params()
1057 if (wifi_utils_parse_scan_chan(state->optarg, in wifi_scan_args_to_params()
1058 params->band_chan, in wifi_scan_args_to_params()
1059 ARRAY_SIZE(params->band_chan))) { in wifi_scan_args_to_params()
1061 return -ENOEXEC; in wifi_scan_args_to_params()
1075 return -ENOEXEC; in wifi_scan_args_to_params()
1096 return -ENOEXEC; in cmd_wifi_scan()
1106 return -ENOEXEC; in cmd_wifi_scan()
1109 PR("Scan requested\n"); in cmd_wifi_scan()
1115 return -ENOEXEC; in cmd_wifi_scan()
1129 return -ENOEXEC; in cmd_wifi_status()
1132 PR("Status: successful\n"); in cmd_wifi_status()
1133 PR("==================\n"); in cmd_wifi_status()
1134 PR("State: %s\n", wifi_state_txt(status.state)); in cmd_wifi_status()
1139 PR("Interface Mode: %s\n", wifi_mode_txt(status.iface_mode)); in cmd_wifi_status()
1140 PR("Link Mode: %s\n", wifi_link_mode_txt(status.link_mode)); in cmd_wifi_status()
1141 PR("SSID: %.32s\n", status.ssid); in cmd_wifi_status()
1142 PR("BSSID: %s\n", in cmd_wifi_status()
1146 PR("Band: %s\n", wifi_band_txt(status.band)); in cmd_wifi_status()
1147 PR("Channel: %d\n", status.channel); in cmd_wifi_status()
1148 PR("Security: %s\n", wifi_security_txt(status.security)); in cmd_wifi_status()
1149 PR("MFP: %s\n", wifi_mfp_txt(status.mfp)); in cmd_wifi_status()
1151 PR("RSSI: %d\n", status.rssi); in cmd_wifi_status()
1153 PR("Beacon Interval: %d\n", status.beacon_interval); in cmd_wifi_status()
1154 PR("DTIM: %d\n", status.dtim_period); in cmd_wifi_status()
1155 PR("TWT: %s\n", in cmd_wifi_status()
1157 PR("Current PHY TX rate (Mbps) : %d\n", status.current_phy_tx_rate); in cmd_wifi_status()
1175 return -ENOEXEC; in cmd_wifi_ap_status()
1180 PR("State: %s\n", "UNINITIALIZED"); in cmd_wifi_ap_status()
1183 PR("State: %s\n", "DISABLED"); in cmd_wifi_ap_status()
1186 PR("State: %s\n", "COUNTRY_UPDATE"); in cmd_wifi_ap_status()
1189 PR("State: %s\n", "ACS"); in cmd_wifi_ap_status()
1192 PR("State: %s\n", "HT_SCAN"); in cmd_wifi_ap_status()
1195 PR("State: %s\n", "DFS"); in cmd_wifi_ap_status()
1198 PR("State: %s\n", "NO_IR"); in cmd_wifi_ap_status()
1201 PR("State: %s\n", "ENABLED"); in cmd_wifi_ap_status()
1207 PR("Interface Mode: %s\n", wifi_mode_txt(status.iface_mode)); in cmd_wifi_ap_status()
1208 PR("Link Mode: %s\n", wifi_link_mode_txt(status.link_mode)); in cmd_wifi_ap_status()
1209 PR("SSID: %.32s\n", status.ssid); in cmd_wifi_ap_status()
1210 PR("BSSID: %s\n", net_sprint_ll_addr_buf(status.bssid, WIFI_MAC_ADDR_LEN, mac_string_buf, in cmd_wifi_ap_status()
1212 PR("Band: %s\n", wifi_band_txt(status.band)); in cmd_wifi_ap_status()
1213 PR("Channel: %d\n", status.channel); in cmd_wifi_ap_status()
1214 PR("Security: %s\n", wifi_security_txt(status.security)); in cmd_wifi_ap_status()
1215 PR("MFP: %s\n", wifi_mfp_txt(status.mfp)); in cmd_wifi_ap_status()
1217 PR("RSSI: %d\n", status.rssi); in cmd_wifi_ap_status()
1219 PR("Beacon Interval: %d\n", status.beacon_interval); in cmd_wifi_ap_status()
1220 PR("DTIM: %d\n", status.dtim_period); in cmd_wifi_ap_status()
1221 PR("TWT: %s\n", status.twt_capable ? "Supported" : "Not supported"); in cmd_wifi_ap_status()
1231 PR("Statistics for Wi-Fi interface %p [%d]\n", iface, in print_wifi_stats()
1234 PR("Bytes received : %u\n", data->bytes.received); in print_wifi_stats()
1235 PR("Bytes sent : %u\n", data->bytes.sent); in print_wifi_stats()
1236 PR("Packets received : %u\n", data->pkts.rx); in print_wifi_stats()
1237 PR("Packets sent : %u\n", data->pkts.tx); in print_wifi_stats()
1238 PR("Receive errors : %u\n", data->errors.rx); in print_wifi_stats()
1239 PR("Send errors : %u\n", data->errors.tx); in print_wifi_stats()
1240 PR("Bcast received : %u\n", data->broadcast.rx); in print_wifi_stats()
1241 PR("Bcast sent : %u\n", data->broadcast.tx); in print_wifi_stats()
1242 PR("Mcast received : %u\n", data->multicast.rx); in print_wifi_stats()
1243 PR("Mcast sent : %u\n", data->multicast.tx); in print_wifi_stats()
1244 PR("Beacons received : %u\n", data->sta_mgmt.beacons_rx); in print_wifi_stats()
1245 PR("Beacons missed : %u\n", data->sta_mgmt.beacons_miss); in print_wifi_stats()
1246 PR("Unicast received : %u\n", data->unicast.rx); in print_wifi_stats()
1247 PR("Unicast sent : %u\n", data->unicast.tx); in print_wifi_stats()
1248 PR("Overrun count : %u\n", data->overrun_count); in print_wifi_stats()
1275 PR("Wi-Fi interface statistics have been reset.\n"); in cmd_wifi_stats()
1282 return -ENOEXEC; in cmd_wifi_stats()
1306 return -ENOEXEC; in cmd_wifi_11k()
1319 return -ENOEXEC; in cmd_wifi_11k()
1325 return -ENOEXEC; in cmd_wifi_11k()
1329 PR("11k is %s\n", params.enable_11k ? "enabled" : "disabled"); in cmd_wifi_11k()
1331 PR("%s %s requested\n", argv[0], argv[1]); in cmd_wifi_11k()
1349 return -ENOEXEC; in cmd_wifi_11k_neighbor_request()
1353 if (strlen(argv[2]) > (sizeof(params.ssid) - 1)) { in cmd_wifi_11k_neighbor_request()
1355 return -ENOEXEC; in cmd_wifi_11k_neighbor_request()
1363 return -ENOEXEC; in cmd_wifi_11k_neighbor_request()
1367 PR("%s %s %s requested\n", argv[0], argv[1], argv[2]); in cmd_wifi_11k_neighbor_request()
1369 PR("%s requested\n", argv[0]); in cmd_wifi_11k_neighbor_request()
1384 return -ENOEXEC; in cmd_wifi_ps()
1393 return -ENOEXEC; in cmd_wifi_ps()
1396 PR("PS status: %s\n", in cmd_wifi_ps()
1399 PR("PS mode: %s\n", in cmd_wifi_ps()
1403 PR("PS listen_interval: %d\n", in cmd_wifi_ps()
1406 PR("PS wake up mode: %s\n", in cmd_wifi_ps()
1410 PR("PS timeout: %d ms\n", in cmd_wifi_ps()
1413 PR("PS timeout: disabled\n"); in cmd_wifi_ps()
1420 PR("No TWT flows\n"); in cmd_wifi_ps()
1433 PR("TWT Wake ahead duration : %d us\n", in cmd_wifi_ps()
1446 return -ENOEXEC; in cmd_wifi_ps()
1455 return -ENOEXEC; in cmd_wifi_ps()
1458 PR("%s\n", wifi_ps_txt(params.enabled)); in cmd_wifi_ps()
1476 return -ENOEXEC; in cmd_wifi_ps_mode()
1485 return -ENOEXEC; in cmd_wifi_ps_mode()
1488 PR("%s\n", wifi_ps_mode_txt(params.mode)); in cmd_wifi_ps_mode()
1515 return -ENOEXEC; in cmd_wifi_ps_timeout()
1519 PR("PS timeout: %d ms\n", params.timeout_ms); in cmd_wifi_ps_timeout()
1521 PR("PS timeout: disabled\n"); in cmd_wifi_ps_timeout()
1553 return -EINVAL; in cmd_wifi_twt_setup_quick()
1558 return -EINVAL; in cmd_wifi_twt_setup_quick()
1575 return -ENOEXEC; in cmd_wifi_twt_setup_quick()
1578 PR("TWT operation %s with dg: %d, flow_id: %d requested\n", in cmd_wifi_twt_setup_quick()
1600 return -EINVAL; in cmd_wifi_btwt_setup()
1607 return -EINVAL; in cmd_wifi_btwt_setup()
1615 return -EINVAL; in cmd_wifi_btwt_setup()
1622 return -ENOEXEC; in cmd_wifi_btwt_setup()
1625 PR("BTWT setup\n"); in cmd_wifi_btwt_setup()
1642 {"negotiation-type", required_argument, 0, 'n'}, in twt_args_to_params()
1643 {"setup-cmd", required_argument, 0, 'c'}, in twt_args_to_params()
1644 {"dialog-token", required_argument, 0, 't'}, in twt_args_to_params()
1645 {"flow-id", required_argument, 0, 'f'}, in twt_args_to_params()
1650 {"wake-interval", required_argument, 0, 'w'}, in twt_args_to_params()
1652 {"wake-ahead-duration", required_argument, 0, 'D'}, in twt_args_to_params()
1653 {"info-disable", required_argument, 0, 'd'}, in twt_args_to_params()
1659 params->operation = WIFI_TWT_SETUP; in twt_args_to_params()
1662 long_options, &opt_index)) != -1) { in twt_args_to_params()
1666 if (!parse_number(sh, &value, state->optarg, NULL, in twt_args_to_params()
1669 return -EINVAL; in twt_args_to_params()
1671 params->negotiation_type = (enum wifi_twt_negotiation_type)value; in twt_args_to_params()
1675 if (!parse_number(sh, &value, state->optarg, NULL, in twt_args_to_params()
1678 return -EINVAL; in twt_args_to_params()
1680 params->setup_cmd = (enum wifi_twt_setup_cmd)value; in twt_args_to_params()
1684 if (!parse_number(sh, &value, state->optarg, NULL, 1, 255)) { in twt_args_to_params()
1685 return -EINVAL; in twt_args_to_params()
1687 params->dialog_token = (uint8_t)value; in twt_args_to_params()
1691 if (!parse_number(sh, &value, state->optarg, NULL, 0, in twt_args_to_params()
1692 (WIFI_MAX_TWT_FLOWS - 1))) { in twt_args_to_params()
1693 return -EINVAL; in twt_args_to_params()
1695 params->flow_id = (uint8_t)value; in twt_args_to_params()
1699 if (!parse_number(sh, &value, state->optarg, NULL, 0, 1)) { in twt_args_to_params()
1700 return -EINVAL; in twt_args_to_params()
1702 params->setup.responder = (bool)value; in twt_args_to_params()
1706 if (!parse_number(sh, &value, state->optarg, NULL, 0, 1)) { in twt_args_to_params()
1707 return -EINVAL; in twt_args_to_params()
1709 params->setup.trigger = (bool)value; in twt_args_to_params()
1713 if (!parse_number(sh, &value, state->optarg, NULL, 0, 1)) { in twt_args_to_params()
1714 return -EINVAL; in twt_args_to_params()
1716 params->setup.implicit = (bool)value; in twt_args_to_params()
1720 if (!parse_number(sh, &value, state->optarg, NULL, 0, 1)) { in twt_args_to_params()
1721 return -EINVAL; in twt_args_to_params()
1723 params->setup.announce = (bool)value; in twt_args_to_params()
1727 if (!parse_number(sh, &value, state->optarg, NULL, 1, in twt_args_to_params()
1729 return -EINVAL; in twt_args_to_params()
1731 params->setup.twt_wake_interval = (uint32_t)value; in twt_args_to_params()
1735 if (!parse_number(sh, &value, state->optarg, NULL, 1, in twt_args_to_params()
1737 return -EINVAL; in twt_args_to_params()
1739 params->setup.twt_interval = (uint64_t)value; in twt_args_to_params()
1743 if (!parse_number(sh, &value, state->optarg, NULL, 0, in twt_args_to_params()
1745 return -EINVAL; in twt_args_to_params()
1747 params->setup.twt_wake_ahead_duration = (uint32_t)value; in twt_args_to_params()
1751 if (!parse_number(sh, &value, state->optarg, NULL, 0, 1)) { in twt_args_to_params()
1752 return -EINVAL; in twt_args_to_params()
1754 params->setup.twt_info_disable = (bool)value; in twt_args_to_params()
1758 if (!parse_number(sh, &value, state->optarg, NULL, 0, in twt_args_to_params()
1760 return -EINVAL; in twt_args_to_params()
1762 params->setup.twt_exponent = (uint8_t)value; in twt_args_to_params()
1766 if (!parse_number(sh, &value, state->optarg, NULL, 0, 0xFFFF)) { in twt_args_to_params()
1767 return -EINVAL; in twt_args_to_params()
1769 params->setup.twt_mantissa = (uint16_t)value; in twt_args_to_params()
1773 return -ENOEXEC; in twt_args_to_params()
1777 if ((params->setup.twt_interval != 0) && in twt_args_to_params()
1778 ((params->setup.twt_exponent != 0) || in twt_args_to_params()
1779 (params->setup.twt_mantissa != 0))) { in twt_args_to_params()
1781 return -EINVAL; in twt_args_to_params()
1784 if (params->setup.twt_interval) { in twt_args_to_params()
1786 twt_interval_scale = (double)(params->setup.twt_interval / scale); in twt_args_to_params()
1789 params->setup.twt_mantissa = ceil(twt_mantissa_scale * scale); in twt_args_to_params()
1790 params->setup.twt_exponent = exponent; in twt_args_to_params()
1791 } else if ((params->setup.twt_exponent != 0) || in twt_args_to_params()
1792 (params->setup.twt_mantissa != 0)) { in twt_args_to_params()
1793 params->setup.twt_interval = floor(ldexp(params->setup.twt_mantissa, in twt_args_to_params()
1794 params->setup.twt_exponent)); in twt_args_to_params()
1797 return -EINVAL; in twt_args_to_params()
1813 return -ENOEXEC; in cmd_wifi_twt_setup()
1822 return -ENOEXEC; in cmd_wifi_twt_setup()
1825 PR("TWT operation %s with dg: %d, flow_id: %d requested\n", in cmd_wifi_twt_setup()
1846 return -EINVAL; in cmd_wifi_twt_teardown()
1852 return -EINVAL; in cmd_wifi_twt_teardown()
1857 return -EINVAL; in cmd_wifi_twt_teardown()
1861 if (!parse_number(sh, &value, argv[idx++], NULL, 0, (WIFI_MAX_TWT_FLOWS - 1))) { in cmd_wifi_twt_teardown()
1862 return -EINVAL; in cmd_wifi_twt_teardown()
1872 return -ENOEXEC; in cmd_wifi_twt_teardown()
1875 PR("TWT operation %s with dg: %d, flow_id: %d success\n", in cmd_wifi_twt_teardown()
1899 return -ENOEXEC; in cmd_wifi_twt_teardown_all()
1902 PR("TWT operation %s all flows success\n", in cmd_wifi_twt_teardown_all()
1918 return -ENOEXEC; in cmd_wifi_ap_enable()
1938 PR_WARNING("AP mode enable failed: %s\n", strerror(-ret)); in cmd_wifi_ap_enable()
1939 return -ENOEXEC; in cmd_wifi_ap_enable()
1942 PR("AP mode enable requested\n"); in cmd_wifi_ap_enable()
1955 PR_WARNING("AP mode disable failed: %s\n", strerror(-ret)); in cmd_wifi_ap_disable()
1956 return -ENOEXEC; in cmd_wifi_ap_disable()
1959 PR("AP mode disable requested\n"); in cmd_wifi_ap_disable()
1971 PR("AP stations:\n"); in cmd_wifi_ap_stations()
1972 PR("============\n"); in cmd_wifi_ap_stations()
1985 PR("Station %zu:\n", id++); in cmd_wifi_ap_stations()
1986 PR("==========\n"); in cmd_wifi_ap_stations()
1987 PR("MAC: %s\n", in cmd_wifi_ap_stations()
1988 net_sprint_ll_addr_buf(sta->mac, in cmd_wifi_ap_stations()
1992 PR("Link mode: %s\n", in cmd_wifi_ap_stations()
1993 wifi_link_mode_txt(sta->link_mode)); in cmd_wifi_ap_stations()
1994 PR("TWT: %s\n", in cmd_wifi_ap_stations()
1995 sta->twt_capable ? "Supported" : "Not supported"); in cmd_wifi_ap_stations()
1999 PR("No stations connected\n"); in cmd_wifi_ap_stations()
2015 return -ENOEXEC; in cmd_wifi_ap_sta_disconnect()
2021 strerror(-ret)); in cmd_wifi_ap_sta_disconnect()
2022 return -ENOEXEC; in cmd_wifi_ap_sta_disconnect()
2025 PR("AP station disconnect requested\n"); in cmd_wifi_ap_sta_disconnect()
2047 long_options, &opt_index)) != -1) { in wifi_ap_config_args_to_params()
2051 if (!parse_number(sh, &val, state->optarg, "max_inactivity", in wifi_ap_config_args_to_params()
2053 return -EINVAL; in wifi_ap_config_args_to_params()
2055 params->max_inactivity = (uint32_t)val; in wifi_ap_config_args_to_params()
2056 params->type |= WIFI_AP_CONFIG_PARAM_MAX_INACTIVITY; in wifi_ap_config_args_to_params()
2059 if (!parse_number(sh, &val, state->optarg, "max_num_sta", in wifi_ap_config_args_to_params()
2061 return -EINVAL; in wifi_ap_config_args_to_params()
2063 params->max_num_sta = (uint32_t)val; in wifi_ap_config_args_to_params()
2064 params->type |= WIFI_AP_CONFIG_PARAM_MAX_NUM_STA; in wifi_ap_config_args_to_params()
2068 strncpy(params->ht_capab, state->optarg, WIFI_AP_IEEE_80211_CAPAB_MAX_LEN); in wifi_ap_config_args_to_params()
2069 params->type |= WIFI_AP_CONFIG_PARAM_HT_CAPAB; in wifi_ap_config_args_to_params()
2072 strncpy(params->vht_capab, state->optarg, WIFI_AP_IEEE_80211_CAPAB_MAX_LEN); in wifi_ap_config_args_to_params()
2073 params->type |= WIFI_AP_CONFIG_PARAM_VHT_CAPAB; in wifi_ap_config_args_to_params()
2080 PR_ERROR("Invalid option %c\n", state->optopt); in wifi_ap_config_args_to_params()
2094 int ret = -1; in cmd_wifi_ap_config_params()
2099 return -ENOEXEC; in cmd_wifi_ap_config_params()
2106 strerror(-ret)); in cmd_wifi_ap_config_params()
2107 return -ENOEXEC; in cmd_wifi_ap_config_params()
2116 unsigned int rts_threshold = -1; /* Default value if user supplies "off" argument */ in cmd_wifi_ap_set_rts_threshold()
2136 return -ENOEXEC; in cmd_wifi_ap_set_rts_threshold()
2163 while ((opt = getopt_long(argc, argv, "fv", long_options, &opt_index)) != -1) { in cmd_wifi_reg_domain()
2172 return -ENOEXEC; in cmd_wifi_reg_domain()
2179 } else if (optind == argc - 1) { in cmd_wifi_reg_domain()
2182 return -ENOEXEC; in cmd_wifi_reg_domain()
2190 return -ENOEXEC; in cmd_wifi_reg_domain()
2197 return -ENOEXEC; in cmd_wifi_reg_domain()
2205 return -ENOEXEC; in cmd_wifi_reg_domain()
2209 PR("Wi-Fi Regulatory domain is: %c%c\n", in cmd_wifi_reg_domain()
2214 PR("<channel>\t<center frequency>\t<supported(y/n)>\t" in cmd_wifi_reg_domain()
2217 PR(" %d\t\t\t%d\t\t\t%s\t\t\t%d\t\t\t%s\t\t\t\t%s\n", in cmd_wifi_reg_domain()
2226 PR("Wi-Fi Regulatory domain set to: %c%c\n", in cmd_wifi_reg_domain()
2244 return -EINVAL; in cmd_wifi_listen_interval()
2259 return -ENOEXEC; in cmd_wifi_listen_interval()
2262 PR("Listen interval %hu\n", params.listen_interval); in cmd_wifi_listen_interval()
2278 return -EINVAL; in cmd_wifi_btm_query()
2285 return -ENOEXEC; in cmd_wifi_btm_query()
2288 PR("Query reason %d\n", query_reason); in cmd_wifi_btm_query()
2305 return -ENOEXEC; in cmd_wifi_wps_pbc()
2310 return -ENOEXEC; in cmd_wifi_wps_pbc()
2330 return -ENOEXEC; in cmd_wifi_wps_pin()
2335 return -ENOEXEC; in cmd_wifi_wps_pin()
2339 PR("WPS PIN is: %s\n", params.pin); in cmd_wifi_wps_pin()
2356 return -ENOEXEC; in cmd_wifi_ap_wps_pbc()
2361 return -ENOEXEC; in cmd_wifi_ap_wps_pbc()
2381 return -ENOEXEC; in cmd_wifi_ap_wps_pin()
2386 return -ENOEXEC; in cmd_wifi_ap_wps_pin()
2390 PR("WPS PIN is: %s\n", params.pin); in cmd_wifi_ap_wps_pin()
2410 return -ENOEXEC; in cmd_wifi_ps_wakeup_mode()
2419 return -ENOEXEC; in cmd_wifi_ps_wakeup_mode()
2422 PR("%s\n", wifi_ps_wakeup_mode_txt(params.wakeup_mode)); in cmd_wifi_ps_wakeup_mode()
2430 unsigned int rts_threshold = -1; /* Default value if user supplies "off" argument */ in cmd_wifi_set_rts_threshold()
2437 return -ENOEXEC; in cmd_wifi_set_rts_threshold()
2444 return -ENOEXEC; in cmd_wifi_set_rts_threshold()
2448 PR("RTS threshold is off\n"); in cmd_wifi_set_rts_threshold()
2450 PR("RTS threshold: %d\n", rts_threshold); in cmd_wifi_set_rts_threshold()
2470 return -ENOEXEC; in cmd_wifi_set_rts_threshold()
2498 return -ENOEXEC; in cmd_wifi_ps_exit_strategy()
2508 return -ENOEXEC; in cmd_wifi_ps_exit_strategy()
2525 {"if-index", optional_argument, 0, 'i'}, in parse_mode_args_to_params()
2535 long_options, &opt_index)) != -1) { in parse_mode_args_to_params()
2539 mode->mode |= WIFI_STA_MODE; in parse_mode_args_to_params()
2542 mode->mode |= WIFI_MONITOR_MODE; in parse_mode_args_to_params()
2545 mode->mode |= WIFI_AP_MODE; in parse_mode_args_to_params()
2548 mode->mode |= WIFI_SOFTAP_MODE; in parse_mode_args_to_params()
2551 mode->oper = WIFI_MGMT_GET; in parse_mode_args_to_params()
2554 mode->if_index = (uint8_t)atoi(state->optarg); in parse_mode_args_to_params()
2579 return -EINVAL; in cmd_wifi_mode()
2583 /* Check interface index value. Mode validation must be performed by in cmd_wifi_mode()
2590 return -ENOEXEC; in cmd_wifi_mode()
2598 return -ENOEXEC; in cmd_wifi_mode()
2607 return -ENOEXEC; in cmd_wifi_mode()
2611 PR("Wi-Fi current mode is %x\n", mode_info.mode); in cmd_wifi_mode()
2613 PR("Wi-Fi mode set to %x\n", mode_info.mode); in cmd_wifi_mode()
2627 {"if-index", optional_argument, 0, 'i'}, in parse_channel_args_to_params()
2634 long_options, &opt_index)) != -1) { in parse_channel_args_to_params()
2638 channel->channel = (uint16_t)atoi(state->optarg); in parse_channel_args_to_params()
2641 channel->if_index = (uint8_t)atoi(state->optarg); in parse_channel_args_to_params()
2644 channel->oper = WIFI_MGMT_GET; in parse_channel_args_to_params()
2679 return -ENOEXEC; in cmd_wifi_channel()
2687 return -ENOEXEC; in cmd_wifi_channel()
2694 PR_ERROR("Invalid channel number. Range is (1-233)\n"); in cmd_wifi_channel()
2695 return -ENOEXEC; in cmd_wifi_channel()
2705 return -ENOEXEC; in cmd_wifi_channel()
2709 PR("Wi-Fi current channel is: %d\n", channel_info.channel); in cmd_wifi_channel()
2711 PR("Wi-Fi channel set to %d\n", channel_info.channel); in cmd_wifi_channel()
2725 {"if-index", optional_argument, 0, 'i'}, in parse_filter_args_to_params()
2726 {"capture-len", optional_argument, 0, 'b'}, in parse_filter_args_to_params()
2736 long_options, &opt_index)) != -1) { in parse_filter_args_to_params()
2740 filter->filter |= WIFI_PACKET_FILTER_ALL; in parse_filter_args_to_params()
2743 filter->filter |= WIFI_PACKET_FILTER_MGMT; in parse_filter_args_to_params()
2746 filter->filter |= WIFI_PACKET_FILTER_CTRL; in parse_filter_args_to_params()
2749 filter->filter |= WIFI_PACKET_FILTER_DATA; in parse_filter_args_to_params()
2752 filter->if_index = (uint8_t)atoi(state->optarg); in parse_filter_args_to_params()
2755 filter->buffer_size = (uint16_t)atoi(state->optarg); in parse_filter_args_to_params()
2762 filter->oper = WIFI_MGMT_GET; in parse_filter_args_to_params()
2793 return -ENOEXEC; in cmd_wifi_packet_filter()
2801 return -ENOEXEC; in cmd_wifi_packet_filter()
2809 PR_ERROR("Wi-Fi packet filter %s operation failed with reason %d\n", in cmd_wifi_packet_filter()
2811 return -ENOEXEC; in cmd_wifi_packet_filter()
2815 PR("Wi-Fi current mode packet filter is %d\n", in cmd_wifi_packet_filter()
2818 PR("Wi-Fi mode packet filter set to %d\n", in cmd_wifi_packet_filter()
2832 return -ENOEXEC; in cmd_wifi_version()
2836 PR_WARNING("Failed to get Wi-Fi versions\n"); in cmd_wifi_version()
2837 return -ENOEXEC; in cmd_wifi_version()
2840 PR("Wi-Fi Driver Version: %s\n", version.drv_version); in cmd_wifi_version()
2841 PR("Wi-Fi Firmware Version: %s\n", version.fw_version); in cmd_wifi_version()
2863 long_options, &opt_index)) != -1) { in parse_dpp_args_auth_init()
2867 params->auth_init.peer = shell_strtol(state->optarg, 10, &ret); in parse_dpp_args_auth_init()
2870 params->auth_init.role = shell_strtol(state->optarg, 10, &ret); in parse_dpp_args_auth_init()
2873 params->auth_init.configurator = shell_strtol(state->optarg, 10, &ret); in parse_dpp_args_auth_init()
2876 params->auth_init.conf = shell_strtol(state->optarg, 10, &ret); in parse_dpp_args_auth_init()
2879 strncpy(params->auth_init.ssid, state->optarg, WIFI_SSID_MAX_LEN); in parse_dpp_args_auth_init()
2882 PR_ERROR("Invalid option %c\n", state->optopt); in parse_dpp_args_auth_init()
2883 return -EINVAL; in parse_dpp_args_auth_init()
2888 return -EINVAL; in parse_dpp_args_auth_init()
2908 long_options, &opt_index)) != -1) { in parse_dpp_args_chirp()
2912 params->chirp.id = shell_strtol(state->optarg, 10, &ret); in parse_dpp_args_chirp()
2915 params->chirp.freq = shell_strtol(state->optarg, 10, &ret); in parse_dpp_args_chirp()
2918 PR_ERROR("Invalid option %c\n", state->optopt); in parse_dpp_args_chirp()
2919 return -EINVAL; in parse_dpp_args_chirp()
2924 return -EINVAL; in parse_dpp_args_chirp()
2944 long_options, &opt_index)) != -1) { in parse_dpp_args_listen()
2948 params->listen.role = shell_strtol(state->optarg, 10, &ret); in parse_dpp_args_listen()
2951 params->listen.freq = shell_strtol(state->optarg, 10, &ret); in parse_dpp_args_listen()
2954 PR_ERROR("Invalid option %c\n", state->optopt); in parse_dpp_args_listen()
2955 return -EINVAL; in parse_dpp_args_listen()
2960 return -EINVAL; in parse_dpp_args_listen()
2982 long_options, &opt_index)) != -1) { in parse_dpp_args_btstrap_gen()
2986 params->bootstrap_gen.type = shell_strtol(state->optarg, 10, &ret); in parse_dpp_args_btstrap_gen()
2989 params->bootstrap_gen.op_class = shell_strtol(state->optarg, 10, &ret); in parse_dpp_args_btstrap_gen()
2992 params->bootstrap_gen.chan = shell_strtol(state->optarg, 10, &ret); in parse_dpp_args_btstrap_gen()
2995 ret = net_bytes_from_str(params->bootstrap_gen.mac, in parse_dpp_args_btstrap_gen()
2996 WIFI_MAC_ADDR_LEN, state->optarg); in parse_dpp_args_btstrap_gen()
2999 PR_ERROR("Invalid option %c\n", state->optopt); in parse_dpp_args_btstrap_gen()
3000 return -EINVAL; in parse_dpp_args_btstrap_gen()
3005 return -EINVAL; in parse_dpp_args_btstrap_gen()
3010 if (params->bootstrap_gen.type == 0) { in parse_dpp_args_btstrap_gen()
3011 params->bootstrap_gen.type = WIFI_DPP_BOOTSTRAP_TYPE_QRCODE; in parse_dpp_args_btstrap_gen()
3014 if (params->bootstrap_gen.type != WIFI_DPP_BOOTSTRAP_TYPE_QRCODE) { in parse_dpp_args_btstrap_gen()
3016 return -ENOTSUP; in parse_dpp_args_btstrap_gen()
3020 if ((params->bootstrap_gen.op_class && !params->bootstrap_gen.chan) || in parse_dpp_args_btstrap_gen()
3021 (!params->bootstrap_gen.op_class && params->bootstrap_gen.chan)) { in parse_dpp_args_btstrap_gen()
3023 return -EINVAL; in parse_dpp_args_btstrap_gen()
3043 long_options, &opt_index)) != -1) { in parse_dpp_args_set_config_param()
3047 params->configurator_set.configurator = in parse_dpp_args_set_config_param()
3048 shell_strtol(state->optarg, 10, &ret); in parse_dpp_args_set_config_param()
3051 params->configurator_set.conf = shell_strtol(state->optarg, 10, &ret); in parse_dpp_args_set_config_param()
3054 strncpy(params->configurator_set.ssid, state->optarg, WIFI_SSID_MAX_LEN); in parse_dpp_args_set_config_param()
3057 PR_ERROR("Invalid option %c\n", state->optopt); in parse_dpp_args_set_config_param()
3058 return -EINVAL; in parse_dpp_args_set_config_param()
3063 return -EINVAL; in parse_dpp_args_set_config_param()
3079 return -ENOEXEC; in cmd_wifi_dpp_configurator_add()
3095 return -EINVAL; in cmd_wifi_dpp_auth_init()
3100 return -ENOEXEC; in cmd_wifi_dpp_auth_init()
3118 return -ENOEXEC; in cmd_wifi_dpp_qr_code()
3134 return -EINVAL; in cmd_wifi_dpp_chirp()
3139 return -ENOEXEC; in cmd_wifi_dpp_chirp()
3155 return -EINVAL; in cmd_wifi_dpp_listen()
3160 return -ENOEXEC; in cmd_wifi_dpp_listen()
3176 return -EINVAL; in cmd_wifi_dpp_btstrap_gen()
3181 return -ENOEXEC; in cmd_wifi_dpp_btstrap_gen()
3200 return -EINVAL; in cmd_wifi_dpp_btstrap_get_uri()
3205 return -ENOEXEC; in cmd_wifi_dpp_btstrap_get_uri()
3221 return -EINVAL; in cmd_wifi_dpp_configurator_set()
3226 return -ENOEXEC; in cmd_wifi_dpp_configurator_set()
3245 return -EINVAL; in cmd_wifi_dpp_resp_timeout_set()
3250 return -ENOEXEC; in cmd_wifi_dpp_resp_timeout_set()
3266 return -EINVAL; in cmd_wifi_dpp_ap_btstrap_gen()
3271 return -ENOEXEC; in cmd_wifi_dpp_ap_btstrap_gen()
3290 return -EINVAL; in cmd_wifi_dpp_ap_btstrap_get_uri()
3295 return -ENOEXEC; in cmd_wifi_dpp_ap_btstrap_get_uri()
3313 return -ENOEXEC; in cmd_wifi_dpp_ap_qr_code()
3333 long_options, &opt_index)) != -1) { in cmd_wifi_dpp_ap_auth_init()
3337 params.auth_init.peer = shell_strtol(state->optarg, 10, &ret); in cmd_wifi_dpp_ap_auth_init()
3340 PR_ERROR("Invalid option %c\n", state->optopt); in cmd_wifi_dpp_ap_auth_init()
3341 return -EINVAL; in cmd_wifi_dpp_ap_auth_init()
3346 return -EINVAL; in cmd_wifi_dpp_ap_auth_init()
3355 return -ENOEXEC; in cmd_wifi_dpp_ap_auth_init()
3374 return -EINVAL; in cmd_wifi_dpp_reconfig()
3379 return -ENOEXEC; in cmd_wifi_dpp_reconfig()
3393 return -ENOEXEC; in cmd_wifi_pmksa_flush()
3403 "-s --ssid=<SSID>\n"
3404 "-c --channel=<channel number>\n"
3405 "-p --passphrase=<PSK> (valid only for secure SSIDs)\n"
3406 "-k --key-mgmt=<Security type> (valid only for secure SSIDs)\n"
3407 "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE-HNP, 4:SAE-H2E, 5:SAE-AUTO, 6:WAPI,"
3408 "7:EAP-TLS, 8:WEP, 9: WPA-PSK, 10: WPA-Auto-Personal, 11: DPP\n"
3409 "12: EAP-PEAP-MSCHAPv2, 13: EAP-PEAP-GTC, 14: EAP-TTLS-MSCHAPv2,\n"
3410 "15: EAP-PEAP-TLS, 16:EAP_TLS_SHA256\n"
3411 "-w --ieee-80211w=<MFP> (optional: needs security type to be specified)\n"
3413 "-b --band=<band> (2 -2.6GHz, 5 - 5Ghz, 6 - 6GHz)\n"
3414 "-m --bssid=<BSSID>\n"
3415 "-i --ignore-broadcast-ssid=<type>. Hide SSID in AP mode.\n"
3421 "[-B, --bandwidth=<bandwidth>]: 1:20MHz, 2:40MHz, 3:80MHz\n"
3422 "[-K, --key1-pwd for eap phase1 or --key2-pwd for eap phase2]:\n"
3424 "[-S, --suiteb-type]: 1:suiteb, 2:suiteb-192. Default 0: not suiteb mode.\n"
3425 "[-V, --eap-version]: 0 or 1. Default 1: eap version 1.\n"
3426 "[-I, --eap-id1...--eap-id8]: Client Identity. Default no eap identity.\n"
3427 "[-P, --eap-pwd1...--eap-pwd8]: Client Password.\n"
3429 "-h --help (prints help)",
3439 "-i --max_inactivity=<time duration (in seconds)>\n"
3440 "-s --max_num_sta=<maximum number of stations>\n"
3444 "-n --ht_capab=<HT capabilities (string)>\n"
3445 "(e.g. \"ht_capab=[HT40+]\" is that \"-n [HT40+]\")\n"
3446 "-c --vht_capab=<VHT capabilities (string)>\n"
3447 "(e.g. \"vht_capab=[SU-BEAMFORMEE][BF-ANTENNA-4]\" is that\n"
3448 "\"-c [SU-BEAMFORMEE][BF-ANTENNA-4]\")\n"
3451 "-h --help (prints help)",
3460 SHELL_CMD_ARG(status, NULL, "Status of Wi-Fi SAP\n", cmd_wifi_ap_status, 1, 0),
3476 "<twt_wake_interval: 1-262144us> <twt_interval: 1us-2^31us>.\n",
3480 "<-n --negotiation-type>: 0: Individual, 1: Broadcast, 2: Wake TBTT\n"
3481 "<-c --setup-cmd>: 0: Request, 1: Suggest, 2: Demand\n"
3482 "<-t --dialog-token>: 1-255\n"
3483 "<-f --flow-id>: 0-7\n"
3484 "<-r --responder>: 0/1\n"
3485 "<-T --trigger>: 0/1\n"
3486 "<-I --implicit>:0/1\n"
3487 "<-a --announce>: 0/1\n"
3488 "<-w --wake-interval>: 1-262144us\n"
3489 "<-i --interval>: 1us-2^31us\n"
3490 "<-D --wake-ahead-duration>: 0us-2^31us\n"
3491 "<-d --info-disable>: 0/1\n"
3492 "<-e --exponent>: 0-31\n"
3493 "<-m --mantissa>: 1-2^16\n"
3494 "[-h, --help]: Print out command usage.\n",
3500 "<sub_id: Broadcast TWT AP config> <nominal_wake: 64-255> <max_sta_support>"
3501 "<twt_mantissa:0-sizeof(UINT16)> <twt_offset> <twt_exponent: 0-31> <sp_gap>.\n",
3507 "<dialog_token: 1-255> <flow_id: 0-7>.\n",
3529 "-p --peer <peer_bootstrap_id>\n"
3530 "[-r --role <1/2>]: DPP role default 1. 1: configurator, 2: enrollee\n"
3532 "[-c --configurator <configurator_id>]\n"
3533 "[-m --mode <1/2>]: Peer mode. 1: STA, 2: AP\n"
3534 "[-s --ssid <SSID>]: SSID\n",
3542 "-i --own <own_bootstrap_id>\n"
3543 "-f --freq <listen_freq>\n",
3547 "-f --freq <listen_freq>\n"
3548 "-r --role <1/2>: DPP role. 1: configurator, 2: enrollee\n",
3552 "[-t --type <1/2/3>]: Bootstrap type. 1: qr_code, 2: pkex, 3: nfc."
3554 "[-o --opclass <operating_class>]\n"
3555 "[-h --channel <channel>]\n"
3556 "[-a --mac <mac_addr>]\n",
3564 "-c --configurator <configurator_id>\n"
3565 "[-m --mode <1/2>]: Peer mode. 1: STA, 2: AP\n"
3566 "[-s --ssid <SSID>]: SSID\n",
3574 "[-t --type <1/2/3>]: Bootstrap type. 1: qr_code, 2: pkex, 3: nfc."
3576 "[-o --opclass <operating_class>]\n"
3577 "[-h --channel <channel>]\n"
3578 "[-a --mac <mac_addr>]\n",
3590 "-p --peer <peer_bootstrap_id>\n",
3629 "monitor or TX-Injection mode is enabled\n"
3631 "[-i, --if-index <idx>] : Interface index\n"
3632 "[-c, --channel <chan>] : Set a specific channel number to the lower layer\n"
3633 "[-g, --get] : Get current set channel number from the lower layer\n"
3634 "[-h, --help] : Help\n"
3636 "wifi channel -g -i1\n"
3638 "wifi -i1 -c5.\n",
3643 "Connect to a Wi-Fi AP\n"
3644 "<-s --ssid \"<SSID>\">: SSID.\n"
3645 "[-c --channel]: Channel that needs to be scanned for connection. "
3647 "[-b, --band] 0: any band (2:2.4GHz, 5:5GHz, 6:6GHz]\n"
3648 "[-p, --psk]: Passphrase (valid only for secure SSIDs)\n"
3649 "[-k, --key-mgmt]: Key Management type (valid only for secure SSIDs)\n"
3650 "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE-HNP, 4:SAE-H2E, 5:SAE-AUTO, 6:WAPI,"
3651 "7:EAP-TLS, 8:WEP, 9: WPA-PSK, 10: WPA-Auto-Personal, 11: DPP\n"
3652 "12: EAP-PEAP-MSCHAPv2, 13: EAP-PEAP-GTC, 14: EAP-TTLS-MSCHAPv2,\n"
3653 "15: EAP-PEAP-TLS, 16:EAP_TLS_SHA256\n"
3654 "[-w, --ieee-80211w]: MFP (optional: needs security type to be specified)\n"
3656 "[-m, --bssid]: MAC address of the AP (BSSID).\n"
3657 "[-t, --timeout]: Timeout for the connection attempt (in seconds).\n"
3658 "[-a, --anon-id]: Anonymous identity for enterprise mode.\n"
3659 "[-K, --key1-pwd for eap phase1 or --key2-pwd for eap phase2]:\n"
3661 "[-S, --suiteb-type]: 1:suiteb, 2:suiteb-192. Default 0: not suiteb mode.\n"
3662 "[-T, --TLS-cipher]: 0:TLS-NONE, 1:TLS-ECC-P384, 2:TLS-RSA-3K.\n"
3663 "[-V, --eap-version]: 0 or 1. Default 1: eap version 1.\n"
3664 "[-I, --eap-id1]: Client Identity. Default no eap identity.\n"
3665 "[-P, --eap-pwd1]: Client Password.\n"
3667 "[-R, --ieee-80211r]: Use IEEE80211R fast BSS transition connect."
3668 "[-h, --help]: Print out the help for the connect command.\n",
3673 "Disconnect from the Wi-Fi AP.\n",
3679 "This command may be used to set the Wi-Fi device into a specific "
3681 "[-i, --if-index <idx>] : Interface index\n"
3682 "[-s, --sta] : Station mode\n"
3683 "[-m, --monitor] : Monitor mode\n"
3684 "[-a, --ap] : AP mode\n"
3685 "[-k, --softap] : Softap mode\n"
3686 "[-h, --help] : Help\n"
3687 "[-g, --get] : Get current mode for a specific interface index\n"
3689 "wifi mode -g -i1\n"
3690 "Set operation example for interface index 1 - set station+promiscuous\n"
3691 "wifi mode -i1 -sp.\n",
3698 "monitor, TX-Injection and promiscuous mode is enabled\n"
3701 "[-i, --if-index <idx>] : Interface index\n"
3702 "[-a, --all] : Enable all packet filter modes\n"
3703 "[-m, --mgmt] : Enable management packets to allowed up the stack\n"
3704 "[-c, --ctrl] : Enable control packets to be allowed up the stack\n"
3705 "[-d, --data] : Enable Data packets to be allowed up the stack\n"
3706 "[-g, --get] : Get current filter settings for a specific interface index\n"
3707 "[-b, --capture-len <len>] : Capture length buffer size for each packet "
3709 "[-h, --help] : Help\n"
3711 "wifi packet_filter -g -i1\n"
3712 "Set operation example for interface index 1 - set data+management frame filter\n"
3713 "wifi packet_filter -i1 -md.\n",
3723 "Configure or display Wi-Fi power save state.\n[on/off]\n",
3728 "<val> - Listen interval in the range of <0-65535>.\n",
3738 "<val> - PS inactivity timer(in ms).\n",
3748 "Set or Get Wi-Fi regulatory domain\n"
3749 "[ISO/IEC 3166-1 alpha2]: Regulatory domain\n"
3750 "[-f]: Force to use this regulatory hint over any other regulatory hints\n"
3751 "Note1: The behavior of this command is dependent on the Wi-Fi driver/chipset implementation\n"
3753 "[-v]: Verbose, display the per-channel regulatory information\n",
3763 "Scan for Wi-Fi APs\n"
3764 "[-t, --type <active/passive>] : Preferred mode of scan. "
3765 "The actual mode of scan can depend on factors such as the Wi-Fi chip "
3767 "[-b, --bands <Comma separated list of band values (2/5/6)>] : "
3769 "[-a, --dwell_time_active <val_in_ms>] : "
3771 "[-p, --dwell_time_passive <val_in_ms>] : "
3773 "[-s, --ssid] : SSID to scan for. Can be provided multiple times\n"
3774 "[-m, --max_bss <val>] : Maximum BSSes to scan for. Range 1 - 65535\n"
3775 "[-c, --chans <Comma separated list of channel ranges>] : "
3780 "channel range specified as chan_start-chan_end. Each band channel "
3782 "specification can be 2:1,6_5:36 or 2:1,6-11,14_5:36,163-177,52. "
3785 "[-h, --help] : Print out the help for the scan command.\n",
3790 "Wi-Fi interface statistics.\n"
3791 "[reset] : Reset Wi-Fi interface statistics\n"
3797 "Status of the Wi-Fi interface.\n",
3802 "Print Wi-Fi Driver and Firmware versions\n",
3823 SHELL_CMD_REGISTER(wifi, &wifi_commands, "Wi-Fi commands", NULL);