diff options
author | Peng Xu <pxu@codeaurora.org> | 2018-03-14 14:11:37 -0700 |
---|---|---|
committer | Ahmed ElArabawy <arabawy@google.com> | 2019-02-06 10:03:30 -0800 |
commit | 1abf1675d4bb7f595d48de1f56aaee435c604279 (patch) | |
tree | 3b0ee65e0896aaa0e01649ea1a2428f8aa6a386d /qcwcn/wifi_hal/wificonfig.cpp | |
parent | 4333c0e76d0c8427e308d866ef0349753d2c984d (diff) | |
download | wlan-1abf1675d4bb7f595d48de1f56aaee435c604279.tar.gz |
WiFi-HAL: Add user hint sub-type to set country code commmand
Add new user hint sub-type NL80211_USER_REG_HINT_CELL_BASE to
wifi_set_country_code command if the feature is supported by
host driver.
Bug: 121154896
Test: Regression test
Change-Id: Ie1c0da1cc75aba02809ffd0f5d76bdb4f2ec680c
CRs-fixed: 2205885
Diffstat (limited to 'qcwcn/wifi_hal/wificonfig.cpp')
-rw-r--r-- | qcwcn/wifi_hal/wificonfig.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/qcwcn/wifi_hal/wificonfig.cpp b/qcwcn/wifi_hal/wificonfig.cpp index 40d765f..2c2d1cd 100644 --- a/qcwcn/wifi_hal/wificonfig.cpp +++ b/qcwcn/wifi_hal/wificonfig.cpp @@ -105,6 +105,14 @@ cleanup: return ret; } +int check_feature(enum qca_wlan_vendor_features feature, features_info *info) +{ + size_t idx = feature / 8; + + return (idx < info->flags_len) && + (info->flags[idx] & BIT(feature % 8)); +} + /* Set the country code to driver. */ wifi_error wifi_set_country_code(wifi_interface_handle iface, const char* country_code) @@ -113,6 +121,7 @@ wifi_error wifi_set_country_code(wifi_interface_handle iface, wifi_error ret; WiFiConfigCommand *wifiConfigCommand; wifi_handle wifiHandle = getWifiHandle(iface); + hal_info *info = getHalInfo(wifiHandle); ALOGV("%s: %s", __FUNCTION__, country_code); @@ -144,6 +153,18 @@ wifi_error wifi_set_country_code(wifi_interface_handle iface, goto cleanup; } + if (check_feature(QCA_WLAN_VENDOR_FEATURE_SELF_MANAGED_REGULATORY, + &info->driver_supported_features)) { + ret = wifiConfigCommand->put_u32(NL80211_ATTR_USER_REG_HINT_TYPE, + NL80211_USER_REG_HINT_CELL_BASE); + if (ret != WIFI_SUCCESS) { + ALOGE("wifi_set_country_code: put reg hint type failed. Error:%d", + ret); + goto cleanup; + } + } + + /* Send the NL msg. */ wifiConfigCommand->waitForRsp(false); ret = wifiConfigCommand->requestEvent(); |