OSDN Git Service

Add is_wifi_driver_loaded
authorIrfan Sheriff <isheriff@google.com>
Tue, 27 Jul 2010 19:16:08 +0000 (12:16 -0700)
committerIrfan Sheriff <isheriff@google.com>
Tue, 27 Jul 2010 19:17:08 +0000 (12:17 -0700)
Change-Id: I73600a11891b1380d8bc1bfbc24494410a989fcb

include/hardware_legacy/wifi.h
wifi/wifi.c

index 23cc92a..9b81677 100644 (file)
@@ -36,6 +36,14 @@ int wifi_load_driver();
 int wifi_unload_driver();
 
 /**
+ * Check if the Wi-Fi driver is loaded.
+ *
+ * @return 0 on success, < 0 on failure.
+ */
+int is_wifi_driver_loaded();
+
+
+/**
  * Start supplicant.
  *
  * @return 0 on success, < 0 on failure.
index 3f8708d..e229120 100644 (file)
@@ -135,7 +135,7 @@ const char *get_dhcp_error_string() {
     return dhcp_lasterror();
 }
 
-static int check_driver_loaded() {
+int is_wifi_driver_loaded() {
     char driver_status[PROPERTY_VALUE_MAX];
     FILE *proc;
     char line[sizeof(DRIVER_MODULE_TAG)+10];
@@ -171,7 +171,7 @@ int wifi_load_driver()
     char driver_status[PROPERTY_VALUE_MAX];
     int count = 100; /* wait at most 20 seconds for completion */
 
-    if (check_driver_loaded()) {
+    if (is_wifi_driver_loaded()) {
         return 0;
     }
 
@@ -208,7 +208,7 @@ int wifi_unload_driver()
 
     if (rmmod(DRIVER_MODULE_NAME) == 0) {
        while (count-- > 0) {
-           if (!check_driver_loaded())
+           if (!is_wifi_driver_loaded())
                break;
            usleep(500000);
        }