WiFi-HAL: get base wlan interface index from global handle am: 24c9cf0854
Change-Id: I78d5aac4d510c3063210ed3ad8f0140145331657
diff --git a/qcwcn/wifi_hal/wificonfig.cpp b/qcwcn/wifi_hal/wificonfig.cpp
index 1bf71c6..7590f62 100644
--- a/qcwcn/wifi_hal/wificonfig.cpp
+++ b/qcwcn/wifi_hal/wificonfig.cpp
@@ -554,6 +554,13 @@
WiFiConfigCommand *wifiConfigCommand;
struct nlattr *nlData;
u32 qca_vendor_thermal_level;
+ hal_info *info = getHalInfo(handle);
+
+ if (!info || info->num_interfaces < 1) {
+ ALOGE("%s: Error wifi_handle NULL or base wlan interface not present",
+ __FUNCTION__);
+ return WIFI_ERROR_UNKNOWN;
+ }
wifiConfigCommand = new WiFiConfigCommand(
handle,
@@ -573,10 +580,9 @@
}
/* Set the interface Id of the message. */
- ret = wifiConfigCommand->set_iface_id("wlan0");
- if (ret != WIFI_SUCCESS) {
- ALOGE("%s: failed to set iface id. Error:%d",
- __FUNCTION__, ret);
+ if (wifiConfigCommand->put_u32(NL80211_ATTR_IFINDEX,
+ info->interfaces[0]->id)) {
+ ALOGE("%s: Failed to put iface id", __FUNCTION__);
goto cleanup;
}