hostap: Implement detailed disconnection result
Use the newly added enumerations to translate from WPA supplicant status
codes to Zephyr Wi-Fi management status codes.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
diff --git a/modules/hostap/src/supp_events.c b/modules/hostap/src/supp_events.c
index 3ba1a28..5c2354f 100644
--- a/modules/hostap/src/supp_events.c
+++ b/modules/hostap/src/supp_events.c
@@ -55,6 +55,20 @@
}
}
+static enum wifi_disconn_reason wpas_to_wifi_mgmt_diconn_status(int status)
+{
+ switch (status) {
+ case WLAN_REASON_DEAUTH_LEAVING:
+ return WIFI_REASON_DISCONN_AP_LEAVING;
+ case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY:
+ return WIFI_REASON_DISCONN_INACTIVITY;
+ case WLAN_REASON_UNSPECIFIED:
+ /* fall through */
+ default:
+ return WIFI_REASON_DISCONN_UNSPECIFIED;
+ }
+}
+
static int supplicant_process_status(struct supplicant_int_event_data *event_data,
char *supplicant_status)
{
@@ -186,7 +200,9 @@
wpas_to_wifi_mgmt_conn_status(*(int *)supplicant_status));
break;
case NET_EVENT_WIFI_CMD_DISCONNECT_RESULT:
- wifi_mgmt_raise_disconnect_result_event(iface, *(int *)supplicant_status);
+ wifi_mgmt_raise_disconnect_result_event(
+ iface,
+ wpas_to_wifi_mgmt_diconn_status(*(int *)supplicant_status));
break;
case NET_EVENT_SUPPLICANT_CMD_INT_EVENT:
event_data.data = &data;