mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Wire readApfPacketFilterData() to the legacy hal
Bug: 73804303
Bug: 36221302
Change-Id: If5d9d3afd40758aea98832e4b350216f496fc3bd
Test: built and flashed, verified boot
(cherry picked from commit efbb9c3f59)
This commit is contained in:
@@ -146,7 +146,7 @@ class WifiChipTest : public Test {
|
||||
} else if (type == IfaceType::STA) {
|
||||
chip_->createStaIface(
|
||||
[&iface_name](const WifiStatus& status,
|
||||
const sp<IWifiStaIface>& iface) {
|
||||
const sp<V1_0::IWifiStaIface>& iface) {
|
||||
if (WifiStatusCode::SUCCESS == status.code) {
|
||||
ASSERT_NE(iface.get(), nullptr);
|
||||
iface->getName([&iface_name](const WifiStatus& status,
|
||||
|
||||
@@ -492,6 +492,28 @@ wifi_error WifiLegacyHal::setPacketFilter(const std::string& iface_name,
|
||||
getIfaceHandle(iface_name), program.data(), program.size());
|
||||
}
|
||||
|
||||
std::pair<wifi_error, std::vector<uint8_t>>
|
||||
WifiLegacyHal::readApfPacketFilterData(const std::string& iface_name) {
|
||||
if (global_func_table_.wifi_read_packet_filter == nullptr) {
|
||||
return {WIFI_ERROR_NOT_SUPPORTED, {}};
|
||||
}
|
||||
|
||||
PacketFilterCapabilities caps;
|
||||
wifi_error status = global_func_table_.wifi_get_packet_filter_capabilities(
|
||||
getIfaceHandle(iface_name), &caps.version, &caps.max_len);
|
||||
if (status != WIFI_SUCCESS) {
|
||||
return {status, {}};
|
||||
}
|
||||
|
||||
// Size the buffer to read the entire program & work memory.
|
||||
std::vector<uint8_t> buffer(caps.max_len);
|
||||
|
||||
status = global_func_table_.wifi_read_packet_filter(
|
||||
getIfaceHandle(iface_name), /*src_offset=*/0, buffer.data(),
|
||||
buffer.size());
|
||||
return {status, move(buffer)};
|
||||
}
|
||||
|
||||
std::pair<wifi_error, wifi_gscan_capabilities>
|
||||
WifiLegacyHal::getGscanCapabilities(const std::string& iface_name) {
|
||||
wifi_gscan_capabilities caps;
|
||||
|
||||
@@ -156,7 +156,7 @@ using on_radio_mode_change_callback =
|
||||
* Class that encapsulates all legacy HAL interactions.
|
||||
* This class manages the lifetime of the event loop thread used by legacy HAL.
|
||||
*
|
||||
* Note: aThere will only be a single instance of this class created in the Wifi
|
||||
* Note: There will only be a single instance of this class created in the Wifi
|
||||
* object and will be valid for the lifetime of the process.
|
||||
*/
|
||||
class WifiLegacyHal {
|
||||
@@ -188,6 +188,8 @@ class WifiLegacyHal {
|
||||
const std::string& iface_name);
|
||||
wifi_error setPacketFilter(const std::string& iface_name,
|
||||
const std::vector<uint8_t>& program);
|
||||
std::pair<wifi_error, std::vector<uint8_t>> readApfPacketFilterData(
|
||||
const std::string& iface_name);
|
||||
// Gscan functions.
|
||||
std::pair<wifi_error, wifi_gscan_capabilities> getGscanCapabilities(
|
||||
const std::string& iface_name);
|
||||
|
||||
@@ -94,6 +94,13 @@ Return<void> WifiStaIface::installApfPacketFilter(
|
||||
hidl_status_cb, cmd_id, program);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::readApfPacketFilterData(
|
||||
readApfPacketFilterData_cb hidl_status_cb) {
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::readApfPacketFilterDataInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::getBackgroundScanCapabilities(
|
||||
getBackgroundScanCapabilities_cb hidl_status_cb) {
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
@@ -297,6 +304,15 @@ WifiStatus WifiStaIface::installApfPacketFilterInternal(
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::vector<uint8_t>>
|
||||
WifiStaIface::readApfPacketFilterDataInternal() {
|
||||
const std::pair<legacy_hal::wifi_error, std::vector<uint8_t>>
|
||||
legacy_status_and_data =
|
||||
legacy_hal_.lock()->readApfPacketFilterData(ifname_);
|
||||
return {createWifiStatusFromLegacyError(legacy_status_and_data.first),
|
||||
std::move(legacy_status_and_data.second)};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, StaBackgroundScanCapabilities>
|
||||
WifiStaIface::getBackgroundScanCapabilitiesInternal() {
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
#define WIFI_STA_IFACE_H_
|
||||
|
||||
#include <android-base/macros.h>
|
||||
#include <android/hardware/wifi/1.0/IWifiStaIface.h>
|
||||
#include <android/hardware/wifi/1.0/IWifiStaIfaceEventCallback.h>
|
||||
#include <android/hardware/wifi/1.2/IWifiStaIface.h>
|
||||
|
||||
#include "hidl_callback_util.h"
|
||||
#include "wifi_legacy_hal.h"
|
||||
@@ -34,7 +34,7 @@ using namespace android::hardware::wifi::V1_0;
|
||||
/**
|
||||
* HIDL interface object used to control a STA Iface instance.
|
||||
*/
|
||||
class WifiStaIface : public V1_0::IWifiStaIface {
|
||||
class WifiStaIface : public V1_2::IWifiStaIface {
|
||||
public:
|
||||
WifiStaIface(const std::string& ifname,
|
||||
const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
|
||||
@@ -56,6 +56,8 @@ class WifiStaIface : public V1_0::IWifiStaIface {
|
||||
Return<void> installApfPacketFilter(
|
||||
uint32_t cmd_id, const hidl_vec<uint8_t>& program,
|
||||
installApfPacketFilter_cb hidl_status_cb) override;
|
||||
Return<void> readApfPacketFilterData(
|
||||
readApfPacketFilterData_cb hidl_status_cb) override;
|
||||
Return<void> getBackgroundScanCapabilities(
|
||||
getBackgroundScanCapabilities_cb hidl_status_cb) override;
|
||||
Return<void> getValidFrequenciesForBand(
|
||||
@@ -113,6 +115,8 @@ class WifiStaIface : public V1_0::IWifiStaIface {
|
||||
getApfPacketFilterCapabilitiesInternal();
|
||||
WifiStatus installApfPacketFilterInternal(
|
||||
uint32_t cmd_id, const std::vector<uint8_t>& program);
|
||||
std::pair<WifiStatus, std::vector<uint8_t>>
|
||||
readApfPacketFilterDataInternal();
|
||||
std::pair<WifiStatus, StaBackgroundScanCapabilities>
|
||||
getBackgroundScanCapabilitiesInternal();
|
||||
std::pair<WifiStatus, std::vector<WifiChannelInMhz>>
|
||||
|
||||
Reference in New Issue
Block a user