mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:23:37 +00:00
Wifi: Support check on device capability for 6GHZ
This commit adds the HAL APIs and implementation to support checking whether device supports 6GHz band or not. VTS test has been added for the new api. Bug: 139354972 Test: Manual: Make sure capability is read correctly. Test: VTS test. Change-Id: I03b0c6017666ffd3663d5979d6e6a2bd93043c48
This commit is contained in:
@@ -13,6 +13,7 @@ hidl_interface {
|
||||
"IWifiChip.hal",
|
||||
"IWifiRttController.hal",
|
||||
"IWifiRttControllerEventCallback.hal",
|
||||
"IWifiStaIface.hal",
|
||||
],
|
||||
interfaces: [
|
||||
"android.hardware.wifi@1.0",
|
||||
|
||||
50
wifi/1.4/IWifiStaIface.hal
Normal file
50
wifi/1.4/IWifiStaIface.hal
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.wifi@1.4;
|
||||
|
||||
import @1.0::WifiStatus;
|
||||
import @1.0::MacAddress;
|
||||
import @1.0::IWifiStaIface;
|
||||
import @1.3::IWifiStaIface;
|
||||
|
||||
/**
|
||||
* Interface used to represent a single STA iface.
|
||||
*
|
||||
* IWifiChip.createStaIface() may return a @1.4::IWifiStaIface when supported.
|
||||
*/
|
||||
interface IWifiStaIface extends @1.3::IWifiStaIface {
|
||||
|
||||
enum StaIfaceCapabilityMask : @1.0::IWifiStaIface.StaIfaceCapabilityMask {
|
||||
STA_6G = 1 << 15
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the capabilities supported by this STA iface.
|
||||
*
|
||||
* @return status WifiStatus of the operation.
|
||||
* Possible status codes:
|
||||
* |WifiStatusCode.SUCCESS|,
|
||||
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
|
||||
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
|
||||
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
|
||||
* |WifiStatusCode.ERROR_UNKNOWN|
|
||||
* @return capabilities Bitset of |StaIfaceCapabilityMask| values.
|
||||
*/
|
||||
getCapabilities_1_4()
|
||||
generates (WifiStatus status,
|
||||
bitfield<StaIfaceCapabilityMask> capabilities);
|
||||
};
|
||||
@@ -91,7 +91,7 @@ V1_3::IWifiChip::ChipCapabilityMask convertLegacyFeatureToHidlChipCapability(
|
||||
}
|
||||
|
||||
IWifiStaIface::StaIfaceCapabilityMask
|
||||
convertLegacyFeatureToHidlStaIfaceCapability(uint32_t feature) {
|
||||
convertLegacyFeatureToHidlStaIfaceCapability(uint64_t feature) {
|
||||
using HidlStaIfaceCaps = IWifiStaIface::StaIfaceCapabilityMask;
|
||||
switch (feature) {
|
||||
case WIFI_FEATURE_GSCAN:
|
||||
@@ -120,6 +120,8 @@ convertLegacyFeatureToHidlStaIfaceCapability(uint32_t feature) {
|
||||
return HidlStaIfaceCaps::ND_OFFLOAD;
|
||||
case WIFI_FEATURE_MKEEP_ALIVE:
|
||||
return HidlStaIfaceCaps::KEEP_ALIVE;
|
||||
case WIFI_FEATURE_INFRA_6G:
|
||||
return HidlStaIfaceCaps::STA_6G;
|
||||
};
|
||||
CHECK(false) << "Unknown legacy feature: " << feature;
|
||||
return {};
|
||||
@@ -365,7 +367,7 @@ bool convertLegacyWifiMacInfosToHidl(
|
||||
}
|
||||
|
||||
bool convertLegacyFeaturesToHidlStaCapabilities(
|
||||
uint32_t legacy_feature_set, uint32_t legacy_logger_feature_set,
|
||||
uint64_t legacy_feature_set, uint32_t legacy_logger_feature_set,
|
||||
uint32_t* hidl_caps) {
|
||||
if (!hidl_caps) {
|
||||
return false;
|
||||
@@ -384,7 +386,8 @@ bool convertLegacyFeaturesToHidlStaCapabilities(
|
||||
WIFI_FEATURE_IE_WHITELIST, WIFI_FEATURE_SCAN_RAND,
|
||||
WIFI_FEATURE_INFRA_5G, WIFI_FEATURE_HOTSPOT, WIFI_FEATURE_PNO,
|
||||
WIFI_FEATURE_TDLS, WIFI_FEATURE_TDLS_OFFCHANNEL,
|
||||
WIFI_FEATURE_CONFIG_NDO, WIFI_FEATURE_MKEEP_ALIVE}) {
|
||||
WIFI_FEATURE_CONFIG_NDO, WIFI_FEATURE_MKEEP_ALIVE,
|
||||
WIFI_FEATURE_INFRA_6G}) {
|
||||
if (feature & legacy_feature_set) {
|
||||
*hidl_caps |= convertLegacyFeatureToHidlStaIfaceCapability(feature);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <android/hardware/wifi/1.2/types.h>
|
||||
#include <android/hardware/wifi/1.3/IWifiChip.h>
|
||||
#include <android/hardware/wifi/1.3/types.h>
|
||||
#include <android/hardware/wifi/1.4/IWifiStaIface.h>
|
||||
#include <android/hardware/wifi/1.4/types.h>
|
||||
|
||||
#include "wifi_legacy_hal.h"
|
||||
@@ -69,7 +70,7 @@ bool convertLegacyWifiMacInfosToHidl(
|
||||
|
||||
// STA iface conversion methods.
|
||||
bool convertLegacyFeaturesToHidlStaCapabilities(
|
||||
uint32_t legacy_feature_set, uint32_t legacy_logger_feature_set,
|
||||
uint64_t legacy_feature_set, uint32_t legacy_logger_feature_set,
|
||||
uint32_t* hidl_caps);
|
||||
bool convertLegacyApfCapabilitiesToHidl(
|
||||
const legacy_hal::PacketFilterCapabilities& legacy_caps,
|
||||
|
||||
@@ -479,7 +479,7 @@ WifiLegacyHal::requestFirmwareMemoryDump(const std::string& iface_name) {
|
||||
std::pair<wifi_error, uint32_t> WifiLegacyHal::getSupportedFeatureSet(
|
||||
const std::string& iface_name) {
|
||||
feature_set set;
|
||||
static_assert(sizeof(set) == sizeof(uint32_t),
|
||||
static_assert(sizeof(set) == sizeof(uint64_t),
|
||||
"Some feature_flags can not be represented in output");
|
||||
wifi_error status = global_func_table_.wifi_get_supported_feature_set(
|
||||
getIfaceHandle(iface_name), &set);
|
||||
|
||||
@@ -266,6 +266,13 @@ Return<void> WifiStaIface::getFactoryMacAddress(
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::getCapabilities_1_4(
|
||||
getCapabilities_cb hidl_status_cb) {
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getCapabilitiesInternal_1_4,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::string> WifiStaIface::getNameInternal() {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_};
|
||||
}
|
||||
@@ -283,26 +290,7 @@ WifiStatus WifiStaIface::registerEventCallbackInternal(
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, uint32_t> WifiStaIface::getCapabilitiesInternal() {
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
uint32_t legacy_feature_set;
|
||||
std::tie(legacy_status, legacy_feature_set) =
|
||||
legacy_hal_.lock()->getSupportedFeatureSet(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
return {createWifiStatusFromLegacyError(legacy_status), 0};
|
||||
}
|
||||
uint32_t legacy_logger_feature_set;
|
||||
std::tie(legacy_status, legacy_logger_feature_set) =
|
||||
legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
// some devices don't support querying logger feature set
|
||||
legacy_logger_feature_set = 0;
|
||||
}
|
||||
uint32_t hidl_caps;
|
||||
if (!hidl_struct_util::convertLegacyFeaturesToHidlStaCapabilities(
|
||||
legacy_feature_set, legacy_logger_feature_set, &hidl_caps)) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), 0};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps};
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), 0};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, StaApfPacketFilterCapabilities>
|
||||
@@ -640,6 +628,29 @@ WifiStaIface::getFactoryMacAddressInternal() {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), mac};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, uint32_t> WifiStaIface::getCapabilitiesInternal_1_4() {
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
uint64_t legacy_feature_set;
|
||||
std::tie(legacy_status, legacy_feature_set) =
|
||||
legacy_hal_.lock()->getSupportedFeatureSet(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
return {createWifiStatusFromLegacyError(legacy_status), 0};
|
||||
}
|
||||
uint32_t legacy_logger_feature_set;
|
||||
std::tie(legacy_status, legacy_logger_feature_set) =
|
||||
legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
// some devices don't support querying logger feature set
|
||||
legacy_logger_feature_set = 0;
|
||||
}
|
||||
uint32_t hidl_caps;
|
||||
if (!hidl_struct_util::convertLegacyFeaturesToHidlStaCapabilities(
|
||||
legacy_feature_set, legacy_logger_feature_set, &hidl_caps)) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), 0};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps};
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_4
|
||||
} // namespace wifi
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include <android-base/macros.h>
|
||||
#include <android/hardware/wifi/1.0/IWifiStaIfaceEventCallback.h>
|
||||
#include <android/hardware/wifi/1.3/IWifiStaIface.h>
|
||||
#include <android/hardware/wifi/1.4/IWifiStaIface.h>
|
||||
|
||||
#include "hidl_callback_util.h"
|
||||
#include "wifi_iface_util.h"
|
||||
@@ -35,7 +35,7 @@ using namespace android::hardware::wifi::V1_0;
|
||||
/**
|
||||
* HIDL interface object used to control a STA Iface instance.
|
||||
*/
|
||||
class WifiStaIface : public V1_3::IWifiStaIface {
|
||||
class WifiStaIface : public V1_4::IWifiStaIface {
|
||||
public:
|
||||
WifiStaIface(const std::string& ifname,
|
||||
const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal,
|
||||
@@ -111,6 +111,8 @@ class WifiStaIface : public V1_3::IWifiStaIface {
|
||||
setMacAddress_cb hidl_status_cb) override;
|
||||
Return<void> getFactoryMacAddress(
|
||||
getFactoryMacAddress_cb hidl_status_cb) override;
|
||||
Return<void> getCapabilities_1_4(
|
||||
getCapabilities_1_4_cb hidl_status_cb) override;
|
||||
|
||||
private:
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
@@ -159,6 +161,7 @@ class WifiStaIface : public V1_3::IWifiStaIface {
|
||||
WifiStatus setMacAddressInternal(const std::array<uint8_t, 6>& mac);
|
||||
std::pair<WifiStatus, std::array<uint8_t, 6>>
|
||||
getFactoryMacAddressInternal();
|
||||
std::pair<WifiStatus, uint32_t> getCapabilitiesInternal_1_4();
|
||||
|
||||
std::string ifname_;
|
||||
std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
|
||||
|
||||
62
wifi/1.4/vts/functional/wifi_sta_iface_hidl_test.cpp
Normal file
62
wifi/1.4/vts/functional/wifi_sta_iface_hidl_test.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Staache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <android/hardware/wifi/1.4/IWifiStaIface.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
|
||||
#include "wifi_hidl_call_util.h"
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
|
||||
using ::android::sp;
|
||||
using ::android::hardware::hidl_array;
|
||||
using ::android::hardware::wifi::V1_0::WifiStatus;
|
||||
using ::android::hardware::wifi::V1_0::WifiStatusCode;
|
||||
using ::android::hardware::wifi::V1_4::IWifiStaIface;
|
||||
|
||||
/**
|
||||
* Fixture to use for all STA Iface HIDL interface tests.
|
||||
*/
|
||||
class WifiStaIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
wifi_sta_iface_ = IWifiStaIface::castFrom(getWifiStaIface());
|
||||
ASSERT_NE(nullptr, wifi_sta_iface_.get());
|
||||
}
|
||||
|
||||
virtual void TearDown() override { stopWifi(); }
|
||||
|
||||
protected:
|
||||
sp<IWifiStaIface> wifi_sta_iface_;
|
||||
};
|
||||
|
||||
/*
|
||||
* GetCapabilities_1_4
|
||||
*/
|
||||
TEST_F(WifiStaIfaceHidlTest, GetCapabilities_1_4) {
|
||||
configureChipForIfaceType(IfaceType::STA, true);
|
||||
|
||||
const auto& status_and_caps =
|
||||
HIDL_INVOKE(wifi_sta_iface_, getCapabilities_1_4);
|
||||
if (status_and_caps.first.code != WifiStatusCode::SUCCESS) {
|
||||
EXPECT_EQ(WifiStatusCode::ERROR_NOT_SUPPORTED,
|
||||
status_and_caps.first.code);
|
||||
return;
|
||||
}
|
||||
EXPECT_NE(0u, status_and_caps.second);
|
||||
}
|
||||
Reference in New Issue
Block a user