diff options
| -rw-r--r-- | include/hardware_legacy/wifi.h | 8 | ||||
| -rw-r--r-- | wifi/wifi.c | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/include/hardware_legacy/wifi.h b/include/hardware_legacy/wifi.h index 23cc92a..9b81677 100644 --- a/include/hardware_legacy/wifi.h +++ b/include/hardware_legacy/wifi.h @@ -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. diff --git a/wifi/wifi.c b/wifi/wifi.c index 3f8708d..e229120 100644 --- a/wifi/wifi.c +++ b/wifi/wifi.c @@ -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); } |
