summaryrefslogtreecommitdiff
path: root/qcwcn/wifi_hal
diff options
context:
space:
mode:
authormazumdar <mazumdar@codeaurora.org>2017-11-14 12:15:00 +0530
committerRoshan Pius <rpius@google.com>2018-03-30 10:55:03 -0700
commit370564aa2f05afbb333745293f6d80b52d9d6433 (patch)
tree4103ea6142fc35412fd99082e33c144a06bcedb7 /qcwcn/wifi_hal
parenteed6f6d6d3b2a1b07cf34a3cff341958d85a2195 (diff)
downloadwlan-370564aa2f05afbb333745293f6d80b52d9d6433.tar.gz
WiFi-Hal: Get the interface index only for wlan0
The current implementation gets the interface index for the first interface name. This would result in getting the interface index for non wlan0 interfaces too. Hence, check for the specific interface name of "wlan0" for getting the interface index. CRs-Fixed: 2139907 Change-Id: I088be24cac54fa7f66c6106030d9cb39e60f0963 Bug: 76133856 (cherry-picked from 9207f79db9552595e8264bb944f60ac220d9852c)
Diffstat (limited to 'qcwcn/wifi_hal')
-rw-r--r--qcwcn/wifi_hal/wifi_hal.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/qcwcn/wifi_hal/wifi_hal.cpp b/qcwcn/wifi_hal/wifi_hal.cpp
index e3e3df5..4ec60e7 100644
--- a/qcwcn/wifi_hal/wifi_hal.cpp
+++ b/qcwcn/wifi_hal/wifi_hal.cpp
@@ -440,6 +440,15 @@ static void cld80211lib_cleanup(hal_info *info)
info->cldctx = NULL;
}
+static int wifi_get_iface_id(hal_info *info, const char *iface)
+{
+ int i;
+ for (i = 0; i < info->num_interfaces; i++)
+ if (!strcmp(info->interfaces[i]->name, iface))
+ return i;
+ return -1;
+}
+
wifi_error wifi_initialize(wifi_handle *handle)
{
int err = 0;
@@ -449,6 +458,7 @@ wifi_error wifi_initialize(wifi_handle *handle)
struct nl_sock *event_sock = NULL;
struct nl_cb *cb = NULL;
int status = 0;
+ int index;
ALOGI("Initializing wifi");
hal_info *info = (hal_info *)malloc(sizeof(hal_info));
@@ -591,17 +601,17 @@ wifi_error wifi_initialize(wifi_handle *handle)
goto unload;
}
- iface_handle = wifi_get_iface_handle((info->interfaces[0])->handle,
- (info->interfaces[0])->name);
- if (iface_handle == NULL) {
+ index = wifi_get_iface_id(info, "wlan0");
+ if (index == -1) {
int i;
for (i = 0; i < info->num_interfaces; i++)
{
free(info->interfaces[i]);
}
- ALOGE("%s no iface with %s\n", __func__, info->interfaces[0]->name);
+ ALOGE("%s no iface with wlan0", __func__);
goto unload;
}
+ iface_handle = (wifi_interface_handle)info->interfaces[index];
ret = acquire_supported_features(iface_handle,
&info->supported_feature_set);