From 6ce7173a9bab425b9760d880b3ebed46d2cd6a2b Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Thu, 17 Nov 2016 13:24:45 -0800 Subject: driver_tool: query if firmware mode changd is needed This is needed for the HIDL HAL to expose different modes of operation. Bug: 31997422 Test: Compiles Change-Id: I90e552dcaa8d34e2bd3a85439052effc7f060b5f --- libwifi_hal/driver_tool.cpp | 4 ++++ libwifi_hal/include/wifi_hal/driver_tool.h | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/libwifi_hal/driver_tool.cpp b/libwifi_hal/driver_tool.cpp index c05c00080..3089ee0a4 100644 --- a/libwifi_hal/driver_tool.cpp +++ b/libwifi_hal/driver_tool.cpp @@ -56,6 +56,10 @@ bool DriverTool::IsDriverLoaded() { return ::wifi_unload_driver() != 0; } +bool DriverTool::IsFirmwareModeChangeNeeded(int mode) { + return (wifi_get_fw_path(mode) != nullptr); +} + bool DriverTool::ChangeFirmwareMode(int mode) { const char* fwpath = wifi_get_fw_path(mode); if (!fwpath) { diff --git a/libwifi_hal/include/wifi_hal/driver_tool.h b/libwifi_hal/include/wifi_hal/driver_tool.h index e0941c0f9..a27641bd9 100644 --- a/libwifi_hal/include/wifi_hal/driver_tool.h +++ b/libwifi_hal/include/wifi_hal/driver_tool.h @@ -40,6 +40,12 @@ class DriverTool { virtual bool UnloadDriver(); virtual bool IsDriverLoaded(); + // Check if we need to invoke |ChangeFirmwareMode| to configure + // the firmware for the provided mode. + // |mode| is one of the kFirmwareMode* constants defined above. + // Returns true if needed, and false otherwise. + virtual bool IsFirmwareModeChangeNeeded(int mode); + // Change the firmware mode. // |mode| is one of the kFirmwareMode* constants defined above. // Returns true on success, and false otherwise. -- cgit v1.2.3