diff options
author | Gatis Paeglis <gatis.paeglis@digia.com> | 2014-03-28 13:32:05 +0100 |
---|---|---|
committer | Samuli Piippo <samuli.piippo@digia.com> | 2014-05-15 17:00:15 +0300 |
commit | 31f6f73a691ff49fc3aeba062f8561e6c981baff (patch) | |
tree | a7407e443e4c95840a89c3a3d6ba0b2bbfe9a1cb /src/imports/wifi/pluginmain.cpp | |
parent | 3022f83d1f7726bddbec3ca469baa3a6ecdde8ae (diff) |
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 <eirik.aavitsland@digia.com>
Diffstat (limited to 'src/imports/wifi/pluginmain.cpp')
-rw-r--r-- | src/imports/wifi/pluginmain.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
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 <QtCore/QDir> +#include <QtCore/QDebug> #include <QtCore/QByteArray> #include <QtQml/QQmlExtensionPlugin> #include <QtQml/qqml.h> +#ifdef Q_OS_ANDROID #include <hardware_legacy/wifi.h> - +#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; } }; |