summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2016-11-17 13:24:45 -0800
committerRoshan Pius <rpius@google.com>2016-11-17 14:59:03 -0800
commit6ce7173a9bab425b9760d880b3ebed46d2cd6a2b (patch)
treebb04f42e9f2515435bf09ff8f4d1582be025533d
parent4365d22b77f31af7567fc12a90786c63cdc5c484 (diff)
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
-rw-r--r--libwifi_hal/driver_tool.cpp4
-rw-r--r--libwifi_hal/include/wifi_hal/driver_tool.h6
2 files changed, 10 insertions, 0 deletions
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.