diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index 078a2a408a7..751a12ecefd 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -646,14 +646,16 @@ int supplicant_status(const struct device *dev, struct wifi_iface_status *status } } - ret = z_wpa_ctrl_signal_poll(&signal_poll); - if (!ret) { - status->rssi = signal_poll.rssi; + if (IS_ENABLED(CONFIG_AP) && status->iface_mode == WIFI_MODE_INFRA) { + ret = z_wpa_ctrl_signal_poll(&signal_poll); + if (!ret) { + status->rssi = signal_poll.rssi; + } else { + wpa_printf(MSG_WARNING, "%s:Failed to read RSSI", __func__); + status->rssi = -WPA_INVALID_NOISE; + } } else { - wpa_printf(MSG_WARNING, "%s:Failed to read RSSI\n", - __func__); status->rssi = -WPA_INVALID_NOISE; - ret = 0; } conn_info = os_zalloc(sizeof(struct wpa_conn_info));