From 31f6f73a691ff49fc3aeba062f8561e6c981baff Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Fri, 28 Mar 2014 13:32:05 +0100 Subject: Port QtWifi to eLinux Current limitations: - Wifi adapter must be connected before staring the device (and ethernet cable should not be connected at the same time). "allow-hotplug wlan0" in /etc/network/interfaces doesn't seem to help for detecting wifi adapter on-the-fly. Change-Id: I8be407e9e042fc86136efd3e220680fb2ce64bd6 Reviewed-by: Eirik Aavitsland --- src/imports/wifi/pluginmain.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/imports/wifi/pluginmain.cpp') diff --git a/src/imports/wifi/pluginmain.cpp b/src/imports/wifi/pluginmain.cpp index fdf07e9..6dc6cc9 100644 --- a/src/imports/wifi/pluginmain.cpp +++ b/src/imports/wifi/pluginmain.cpp @@ -19,12 +19,14 @@ #include "qwifimanager.h" #include +#include #include #include #include +#ifdef Q_OS_ANDROID #include - +#endif /*! \qmltype Interface \inqmlmodule Qt.labs.wifi @@ -65,18 +67,16 @@ public: Q_INVOKABLE bool wifiSupported() const { bool supported = false; - if (wifi_load_driver() == 0 && wifi_start_supplicant(0) == 0) { - char interface[PROPERTY_VALUE_MAX]; - property_get("wifi.interface", interface, NULL); - // standard linux kernel path - QByteArray path; - path.append("/sys/class/net/").append(interface); - supported = QDir().exists(path.constData()); - if (!supported) - qWarning() << "QWifiGlobal: could not find wifi interface in " << path; - } else { +#ifdef Q_OS_ANDROID + if (wifi_load_driver() == 0 && wifi_start_supplicant(0) == 0) + supported = true; + else qWarning() << "QWifiGlobal: wifi driver is not available"; - } +#else + supported = QDir().exists(QStringLiteral("/sys/class/net/wlan0")); + if (!supported) + qWarning() << "QWifiGlobal: could not find wifi interface in /sys/class/net/"; +#endif return supported; } }; -- cgit v1.2.3