Skip to content

Commit

Permalink
hostap: Implement detailed disconnection result
Browse files Browse the repository at this point in the history
Use the newly added enumerations to translate from WPA supplicant status
codes to Zephyr Wi-Fi management status codes.

Signed-off-by: Chaitanya Tata <[email protected]>
Signed-off-by: Jukka Rissanen <[email protected]>
  • Loading branch information
krish2718 authored and aescolar committed Mar 20, 2024
1 parent e5c90db commit 046edbb
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion modules/hostap/src/supp_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,20 @@ static enum wifi_conn_status wpas_to_wifi_mgmt_conn_status(int status)
}
}

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)
{
Expand Down Expand Up @@ -186,7 +200,9 @@ int supplicant_send_wifi_mgmt_event(const char *ifname, enum net_event_wifi_cmd
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;
Expand Down

0 comments on commit 046edbb

Please sign in to comment.