From 7ed76b3cf9388b71876cdcddb64f93ef226254e1 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Wed, 12 Feb 2014 16:00:54 +0100 Subject: Don't use wifi on Emulator Change-Id: I9ae1b5b68f3e3ec2c513ec5a6811ea5396425766 Reviewed-by: Eirik Aavitsland --- src/imports/wifi/pluginmain.cpp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'src/imports') 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 +#include #include #include -#include -#include +#include 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; } }; -- cgit v1.2.3