diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/wifi/pluginmain.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/imports/wifi/pluginmain.cpp b/src/imports/wifi/pluginmain.cpp index 6dc6cc9..51a2e7c 100644 --- a/src/imports/wifi/pluginmain.cpp +++ b/src/imports/wifi/pluginmain.cpp @@ -66,18 +66,19 @@ public: Q_INVOKABLE bool wifiSupported() const { - bool supported = false; + bool hasInterface = QDir().exists(QStringLiteral("/sys/class/net/wlan0")); + if (!hasInterface) + qWarning() << "QWifiGlobal: could not find wifi interface in /sys/class/net/"; #ifdef Q_OS_ANDROID - if (wifi_load_driver() == 0 && wifi_start_supplicant(0) == 0) - supported = true; - else + if (hasInterface && wifi_load_driver() == 0 && wifi_start_supplicant(0) == 0) { + return true; + } else { qWarning() << "QWifiGlobal: wifi driver is not available"; + return false; + } #else - supported = QDir().exists(QStringLiteral("/sys/class/net/wlan0")); - if (!supported) - qWarning() << "QWifiGlobal: could not find wifi interface in /sys/class/net/"; + return hasInterface; #endif - return supported; } }; |