diff options
author | Purushottam Kushwaha <quic_pkushwah@quicinc.com> | 2021-03-09 18:30:48 +0530 |
---|---|---|
committer | lesl <lesl@google.com> | 2021-03-10 13:44:20 +0800 |
commit | c0975f94f04ba1bec99fc7072844c02036c9c8fc (patch) | |
tree | 3c60f81309b5c11d6425072393c8178ea71325d3 | |
parent | 982ed89de78e0186e02c220ad3ed294e69f98003 (diff) | |
download | wlan-c0975f94f04ba1bec99fc7072844c02036c9c8fc.tar.gz |
Wifi-Hal: Refresh interface details on wifi_get_ifaces.
With support of dynamic interface create/remove 'commit : 5780336d',
wifi interface details shall be refreshed to acoomodate change in
interface list.
Bug: 181828707
Test: Manual Test - force to create virtual interface to make sure Hal
works normally.
Change-Id: I35ae3260688dfddaae864676a7f45ce24d4d10a9
Signed-off-by: Purushottam Kushwaha <quic_pkushwah@quicinc.com>
-rw-r--r-- | qcwcn/wifi_hal/wifi_hal.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/qcwcn/wifi_hal/wifi_hal.cpp b/qcwcn/wifi_hal/wifi_hal.cpp index d64e3b8..f071dfc 100644 --- a/qcwcn/wifi_hal/wifi_hal.cpp +++ b/qcwcn/wifi_hal/wifi_hal.cpp @@ -1879,6 +1879,24 @@ wifi_error wifi_get_ifaces(wifi_handle handle, int *num, { hal_info *info = (hal_info *)handle; + /* In case of dynamic interface add/remove, interface handles need to be + * updated so that, interface specific APIs could be instantiated. + * Reload here to get interfaces which are dynamically added. */ + + if (info->num_interfaces > 0) { + for (int i = 0; i < info->num_interfaces; i++) + free(info->interfaces[i]); + free(info->interfaces); + info->interfaces = NULL; + info->num_interfaces = 0; + } + + wifi_error ret = wifi_init_interfaces(handle); + if (ret != WIFI_SUCCESS) { + ALOGE("Failed to init interfaces while wifi_get_ifaces"); + return ret; + } + *interfaces = (wifi_interface_handle *)info->interfaces; *num = info->num_interfaces; |