summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.