summaryrefslogtreecommitdiffstats
path: root/src/imports/wifi
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@digia.com>2014-02-12 16:00:54 +0100
committerGatis Paeglis <gatis.paeglis@digia.com>2014-02-13 12:10:20 +0200
commit7ed76b3cf9388b71876cdcddb64f93ef226254e1 (patch)
treeb26fa67914f24951ef6df9493783e6fcdee40099 /src/imports/wifi
parent7a67c281301590b0f6305fc2cf118d28216b5362 (diff)
Don't use wifi on Emulator
Change-Id: I9ae1b5b68f3e3ec2c513ec5a6811ea5396425766 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@digia.com>
Diffstat (limited to 'src/imports/wifi')
-rw-r--r--src/imports/wifi/pluginmain.cpp28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/imports/wifi/pluginmain.cpp b/src/imports/wifi/pluginmain.cpp
index b1f1bed..3c560f9 100644
--- a/src/imports/wifi/pluginmain.cpp
+++ b/src/imports/wifi/pluginmain.cpp
@@ -18,11 +18,12 @@
****************************************************************************/
#include "qwifimanager.h"
+#include <QtCore/QDir>
+#include <QtCore/QByteArray>
#include <QtQml/QQmlExtensionPlugin>
#include <QtQml/qqml.h>
-#include <QtCore/QDir>
-#include <QtCore/QByteArray>
+#include <hardware_legacy/wifi.h>
class QWifiGlobal : public QObject
{
@@ -34,15 +35,20 @@ public:
Q_INVOKABLE bool wifiSupported() const
{
- char interface[PROPERTY_VALUE_MAX];
- property_get("wifi.interface", interface, NULL);
- // standard linux kernel path
- QByteArray path;
- path.append("/sys/class/net/").append(interface);
- bool interfaceFound = QDir().exists(path.constData());
- if (!interfaceFound)
- qWarning() << "QWifiGlobal: could not find wifi interface in " << path;
- return interfaceFound;
+ 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 {
+ qWarning() << "QWifiGlobal: wifi driver is not available";
+ }
+ return supported;
}
};