diff options
author | Kalle Viironen <kalle.viironen@digia.com> | 2014-02-25 13:58:01 +0200 |
---|---|---|
committer | Kalle Viironen <kalle.viironen@digia.com> | 2014-02-25 13:58:07 +0200 |
commit | 4987da748585642b8fcfaa488b1591d47390bb54 (patch) | |
tree | ab5e6b48e711a3c3a2e2cd4399ce1b3d34347406 /src/imports/wifi/pluginmain.cpp | |
parent | 711bfedc706f609cce586406647cfb4ef4547f15 (diff) | |
parent | 4738811e35a559d238ba20703eb792fca8f5756b (diff) |
Merge branch 'stable' into dev
* stable: (28 commits)
Doc: Document support services for Yocto recipes
doc: minor changes to customization inline code blocks
Doc: Clarify which Qt Creator templates work out of the box
Doc: Fix missing sudo for i.MX6 embedded Linux deployment
Doc: Fixed 32bit package install command for newer ubuntu versions
doc: add quide how to use b2qt_build_scripts
Doc: Add instructions how to install newer VirtualBox
[Wifi] Fix initialization code
Doc: Explain about disabling surfaceflinger
Enable internet on eAndroid emulator
Doc: Add instructions for building Boot2Qt demos
Doc: Troubleshooting entry for BeagleBone Black HDMI issues
Don't use wifi on Emulator
Doc: Document building your own embedded linux stack
Update copyright year
Doc: Fix the 2.0 release date
Doc: ChangeLog: Remove 'black screen after exit' from bugfixes
Doc: Use a global Qt documentation template
Doc: Add changelog
Disable QConnectivity daemon on emulator
...
Change-Id: Id524cd8897915b6762210ddece159731c1ef2e67
Diffstat (limited to 'src/imports/wifi/pluginmain.cpp')
-rw-r--r-- | src/imports/wifi/pluginmain.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/imports/wifi/pluginmain.cpp b/src/imports/wifi/pluginmain.cpp index 0eeff78..3c560f9 100644 --- a/src/imports/wifi/pluginmain.cpp +++ b/src/imports/wifi/pluginmain.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc +** Copyright (C) 2014 Digia Plc ** All rights reserved. ** For any questions to Digia, please use the contact form at ** http://qt.digia.com/ @@ -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; } }; |