summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalle Viironen <kalle.viironen@digia.com>2014-05-26 13:53:13 +0300
committerKalle Viironen <kalle.viironen@digia.com>2014-05-26 13:53:20 +0300
commit5cdc15a7b82b7adfd4c5cae85ffb4327593dd076 (patch)
tree342fa9523f5400f4ecbcf6fde169021fabaff500
parent9627172876cd2a387d44b5a9a6ce0a3867ebc730 (diff)
parent5c160b6fe916e5605eaa1fd8394b62527ff9f997 (diff)
Merge branch 'stable' into releaseQtEE_v3.0.0
* stable: (25 commits) Add notes about Quick Compiler failures doc: Updated versions and supported platforms doc: Updated links to Qt EE known issues and product page Doc: Warn the user that his Nexus will be wiped. doc: move adb connection change info to customization Build wifi also on eLinux Don't show Wi-Fi group box on iMX6-eAndroid Fix class names for WebEngine Doc: add note about webengine's widget apis Doc: add change log for version 3.0.0 doc: include sabre sd documentation Doc: Add setup instructions for Nexus 7 (2013) Set initial "backend ready" state. Port QtWifi to eLinux Add a note about webengine and emulator Doc: Update version Doc: Add table with all possible MACHINE values Doc: QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS replaces QT_QPA_GENERIC_PLUGINS Doc: Use precise naming for Boundary Devices i.MX6 Add PowerManager service. ... Change-Id: I2762dfe023d461b677d7ed748c33444145d35175
-rw-r--r--src/doc/config/b2qt.qdocconf4
-rw-r--r--src/doc/src/b2qt-external-pages.qdoc4
-rw-r--r--src/doc/src/b2qt.qdoc367
-rw-r--r--src/doc/src/detect-sd-card-device-name.qdocinc12
-rw-r--r--src/doppelganger/doppelganger.pro8
-rw-r--r--src/doppelganger/main.cpp2
-rw-r--r--src/doppelganger/powermanager.cpp88
-rw-r--r--src/doppelganger/powermanager.h62
-rw-r--r--src/doppelganger/schedulingpolicyservice.cpp11
-rw-r--r--src/doppelganger/schedulingpolicyservice.h5
-rw-r--r--src/imports/imports.pro3
-rw-r--r--src/imports/wifi/pluginmain.cpp25
-rw-r--r--src/imports/wifi/qwifi_elinux.cpp264
-rw-r--r--src/imports/wifi/qwifi_elinux.h34
-rw-r--r--src/imports/wifi/qwifimanager.cpp151
-rw-r--r--src/imports/wifi/qwifimanager.h30
-rw-r--r--src/imports/wifi/qwifinetworklistmodel.cpp13
-rw-r--r--src/imports/wifi/wifi.pro23
-rw-r--r--src/qconnectivity/main.cpp58
-rw-r--r--src/utils/qdroidutils.cpp3
20 files changed, 1033 insertions, 134 deletions
diff --git a/src/doc/config/b2qt.qdocconf b/src/doc/config/b2qt.qdocconf
index 3f8f92a..045c8ea 100644
--- a/src/doc/config/b2qt.qdocconf
+++ b/src/doc/config/b2qt.qdocconf
@@ -6,7 +6,7 @@ sourceencoding = UTF-8
project = QtEnterpriseEmbedded
description = Qt Enterprise Embedded Documentation
-version = 2.1.0
+version = 3.0.0
sourcedirs = ../src \
../../imports/wifi
@@ -23,7 +23,7 @@ indexes = $QT_INSTALL_DOCS/qtquick/qtquick.index \
qhp.projects = B2Qt
qhp.B2Qt.file = b2qt.qhp
-qhp.B2Qt.namespace = com.digia.b2qt.210
+qhp.B2Qt.namespace = com.digia.b2qt.300
qhp.B2Qt.virtualFolder = b2qt
qhp.B2Qt.indexTitle = Qt Enterprise Embedded Documentation
qhp.B2Qt.indexRoot =
diff --git a/src/doc/src/b2qt-external-pages.qdoc b/src/doc/src/b2qt-external-pages.qdoc
index 694f349..ea835ad 100644
--- a/src/doc/src/b2qt-external-pages.qdoc
+++ b/src/doc/src/b2qt-external-pages.qdoc
@@ -18,12 +18,12 @@
****************************************************************************/
/*!
- \externalpage http://qt.digia.com/Product/Qt-for-Embedded-Development/Qt-Enterprise-Embedded/Supported-Modules-and-Known-Issues/
+ \externalpage http://qt.digia.com/Product/Qt-Enterprise-Embedded/Supported-Modules-and-Known-Issues/
\title Known Issues
*/
/*!
- \externalpage http://qt.digia.com/Product/Qt-for-Embedded-Development/Qt-Enterprise-Embedded/
+ \externalpage http://qt.digia.com/Product/Qt-Enterprise-Embedded/
\title product page
*/
diff --git a/src/doc/src/b2qt.qdoc b/src/doc/src/b2qt.qdoc
index 7e7bad4..ab72787 100644
--- a/src/doc/src/b2qt.qdoc
+++ b/src/doc/src/b2qt.qdoc
@@ -43,8 +43,10 @@
\li \l{Supported Platforms}
\li \l{Preparing Hardware}
\list
- \li \l{Preparing Nexus 7}{Nexus 7 (2012) (embedded Android)}
- \li \l{Preparing Sabre Lite i.MX 6}{Sabre Lite i.MX 6 (embedded Android and Linux)}
+ \li \l{Preparing Nexus 7 (2013)}{Nexus 7 (2013) (embedded Android)}
+ \li \l{Preparing Nexus 7 (2012)}{Nexus 7 (2012) (embedded Android)}
+ \li \l{Preparing BD-SL-i.MX6}{BD-SL-i.MX6 (embedded Android and Linux)}
+ \li \l{Preparing SABRE SD i.MX6Quad}{SABRE SD i.MX6Quad (embedded Linux)}
\li \l{Preparing BeagleBone Black}{BeagleBone Black (embedded Android and Linux)}
\li \l{Preparing BeagleBoard-xM}{BeagleBoard-xM (embedded Linux)}
\li \l{Preparing Raspberry Pi}{Raspberry Pi Model B (embedded Linux)}
@@ -112,8 +114,8 @@
forefront.
\li \b{\B2QL} where the software stack is using the traditional embedded
- Linux kernel built with the Yocto Poky reference system (Yocto 1.5
- \e Dora release). The Embedded Linux variant is designed for great
+ Linux kernel built with the Yocto Poky reference system (Yocto 1.6
+ \e Daisy release). The Embedded Linux variant is designed for great
customization possibilities. It contains only components required in
the embedded device, resulting in smaller image sizes while keeping
valuable development tools available.
@@ -306,7 +308,7 @@
\list
\li \l{Nexus 7 (2012) (embedded Android)}
- \li \l{Sabre Lite i.MX 6 (embedded Android and Linux)}
+ \li \l{BD-SL-i.MX6 (embedded Android and Linux)}
\li \l{BeagleBone Black (embedded Android and Linux)}
\li \l{BeagleBoard-xM (embedded Linux)}
\li \l{Raspberry Pi Model B (embedded Linux)}
@@ -317,9 +319,66 @@
*/
/*!
+ \target Nexus 7 (2013) (embedded Android)
+ \page qtee-preparing-hardware-nexus-7-2013.html
+ \title Preparing Nexus 7 (2013)
+ \previouspage qtee-installation-guide.html
+ \nextpage qtee-building-and-running.html
+
+ Take the following steps to prepare a
+ \l{http://www.google.com/nexus/7/specs/}{Nexus 7 (2013)} for
+ \B2Q.
+
+ \note The installation process will wipe the device. Make sure to
+ backup any personal data. The device can later be restored to
+ factory state, see \l{Troubleshooting}.
+
+ \section1 Enabling Developer Mode
+
+ In order to install the \B2Q stack into the Nexus 7, you need to
+ enable developer mode and USB debugging:
+
+ \list 1
+ \li Power up the device.
+ \li Open the \b{Settings} app and select the \b{About tablet} item.
+ \li Press the \b{Build number} item seven times, until the message "You are now a developer!" appears.
+
+ \li Back in the \b{Settings} menu, select \b{Developer options}.
+ \li Press the \b{USB debugging} item and confirm that you allow USB debugging.
+ \endlist
+
+ You should now be able to establish USB connection to the device as follows.
+
+ \section1 Setting up USB Access
+
+ \include b2qt-post-install-setup.qdocinc setting up usb access
+
+ \section1 Deploying the \B2Q Stack
+
+ Using the \c{adb devices} command, confirm that you have a working
+ connection to the Nexus 7, and that the Nexus 7 is the only
+ connected device. Then run the following command to install the \B2Q stack:
+
+ \badcode
+ cd <INSTALL_DIR>
+ ./Boot2Qt-3.x/nexus7-2013-eAndroid/images/deploy.sh
+ \endcode
+
+ The device will reboot during the process. Do not interact with it
+ or unplug it until the process is fully completed.
+
+ \section1 Configuring a Device Kit in Qt Creator
+
+ \include b2qt-post-install-setup.qdocinc configuring device kit
+
+ You are now ready to start developing for your device. For more information,
+ see \l{Building and Running an Example}.
+*/
+
+/*!
\target Nexus 7 (2012) (embedded Android)
- \page qtee-preparing-hardware-nexus-7.html
- \title Preparing Nexus 7
+ \page qtee-preparing-hardware-nexus-7-2012.html
+ \title Preparing Nexus 7 (2012)
\previouspage qtee-installation-guide.html
\nextpage qtee-building-and-running.html
@@ -327,7 +386,11 @@
\l{http://www.google.com/nexus/7/specs/}{Nexus 7 (2012)} for
\B2Q.
- \section1 Unlocking Nexus 7 Bootloader
+ \note The installation process will wipe the device. Make sure to
+ backup any personal data. The device can later be restored to
+ factory state, see \l{Troubleshooting}.
+
+ \section1 Unlocking Nexus 7 (2012) Bootloader
You must unlock the Nexus 7 Bootloader to be able to install custom
software. You need to do this only once.
@@ -349,7 +412,7 @@
\li Wait a few seconds, and check that the text line stating the \c{LOCK STATE} now says \c{UNLOCKED}.
\endlist
- \section1 Updating a Nexus 7 with \B2Q Images
+ \section1 Updating a Nexus 7 (2012) with \B2Q Images
\note It is important that you repeat the steps in this section after you
update \SDK.
@@ -365,9 +428,9 @@
\badcode
cd <INSTALL_DIR>
- sudo ./Tools/b2qt/fastboot flash boot Boot2Qt-2.x/nexus7-eAndroid/images/boot.img
- sudo ./Tools/b2qt/fastboot flash system Boot2Qt-2.x/nexus7-eAndroid/images/system.img
- sudo ./Tools/b2qt/fastboot flash userdata Boot2Qt-2.x/nexus7-eAndroid/images/data.img
+ sudo ./Tools/b2qt/fastboot flash boot Boot2Qt-3.x/nexus7-eAndroid/images/boot.img
+ sudo ./Tools/b2qt/fastboot flash system Boot2Qt-3.x/nexus7-eAndroid/images/system.img
+ sudo ./Tools/b2qt/fastboot flash userdata Boot2Qt-3.x/nexus7-eAndroid/images/data.img
\endcode
\li Once the flashing is completed successfully, reboot the device:
@@ -389,7 +452,7 @@
{https://developers.google.com/android/nexus/drivers#grouperjdq39}
\badcode
cd <INSTALL_DIR>
- ./Boot2Qt-2.x/nexus7-eAndroid/images/download.sh
+ ./Boot2Qt-3.x/nexus7-eAndroid/images/download.sh
\endcode
\note Only the version "Android 4.2.2 (JDQ39 to JDQ39E)" works with the
@@ -402,7 +465,7 @@
Also check that the device is \e{not} in fastboot mode.
\li Run the driver extractors:
\badcode
- cd Boot2Qt-2.x/nexus7-eAndroid/images/drivers
+ cd Boot2Qt-3.x/nexus7-eAndroid/images/drivers
./extract-nvidia-grouper.sh
./extract-asus-grouper.sh
./extract-invensense-grouper.sh
@@ -416,7 +479,7 @@
\endcode
\li Deploy the drivers to your device:
\badcode
- ./Boot2Qt-2.x/nexus7-eAndroid/images/deploy.sh <serial_number>
+ ./Boot2Qt-3.x/nexus7-eAndroid/images/deploy.sh <serial_number>
\endcode
\endlist
@@ -446,8 +509,8 @@
{BeagleBoard-xM} for
\B2Q.
- \note It is important that you repeat the steps in this section after you
- update \SDK.
+ \note BeagleBoard-xM is no longer supported in \SDK 3.0. It is still,
+ however, supported and tested under the previous 2.x versions.
The image containing \B2Q stack for BeagleBoard-xM are included in \SDK,
ready to be copied to an SD card.
@@ -460,11 +523,16 @@
\section1 Installing the \B2Q Image
- To write the image to the SD card:
+ To write the image to the SD card, ensure that no partitions on the
+ SD card are mounted:
+
+ \include detect-sd-card-device-name.qdocinc unmount
+
+ Then,
\badcode
cd <INSTALL_DIR>
- sudo Boot2Qt-2.x/beagleboard-eLinux/images/deploy.sh /dev/<device_name>
+ sudo Boot2Qt-3.x/beagleboard-eLinux/images/deploy.sh /dev/<device_name>
\endcode
After the image has been deployed, power on the device and check that
@@ -483,19 +551,19 @@
*/
/*!
- \target Sabre Lite i.MX 6 (embedded Android and Linux)
+ \target BD-SL-i.MX6 (embedded Android and Linux)
\page qtee-preparing-hardware-imx6.html
- \title Preparing Sabre Lite i.MX 6
+ \title Preparing BD-SL-i.MX6
\previouspage qtee-installation-guide.html
Take the following steps to prepare a
- \l{http://boundarydevices.com/products/sabre-lite-imx6-sbc/}{Sabre
- Lite i.MX 6} for \B2Q.
+ \l{http://boundarydevices.com/products/sabre-lite-imx6-sbc/}
+ {Boundary Devices BD-SL-i.MX6} (SABRE Lite) for \B2Q.
\note It is important that you repeat the steps in this section after you
update \SDK.
- The images containing the \B2Q stack for Sabre Lite i.MX 6 are included
+ The images containing the \B2Q stack for BD-SL-i.MX6 are included
in \SDK, ready to be copied to an SD card.
\section1 Preparing an SD Card
@@ -539,19 +607,24 @@
sudo apt-get install u-boot-tools
\endcode
- Then, upgrade the SD card with \B2Q. Use one of the commands below,
- depending on whether you are developing for embedded Android or Linux:
+ Then, upgrade the SD card with \B2Q. First, ensure that no partitions on the
+ SD card are mounted:
+
+ \include detect-sd-card-device-name.qdocinc unmount
+
+ Then, use one of the commands below, depending on whether you are developing
+ for embedded Android or Linux:
\list
\li \b{\B2QA}
\badcode
cd <INSTALL_DIR>
- ./Boot2Qt-2.x/iMX6-eAndroid/images/deploy.sh /dev/<device_name>
+ ./Boot2Qt-3.x/iMX6-eAndroid/images/deploy.sh /dev/<device_name>
\endcode
\li \b{\B2QL}
\badcode
cd <INSTALL_DIR>
- sudo ./Boot2Qt-2.x/iMX6-eLinux/images/deploy.sh /dev/<device_name>
+ sudo ./Boot2Qt-3.x/iMX6-eLinux/images/deploy.sh /dev/<device_name>
\endcode
\endlist
@@ -571,6 +644,57 @@
*/
/*!
+ \target SABRE SD i.MX6Quad (embedded Linux)
+ \page qtee-preparing-hardware-imx6sabresd.html
+ \title Preparing SABRE SD i.MX6Quad
+ \previouspage qtee-installation-guide.html
+
+ Take the following steps to prepare a
+ \l{http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=RDIMX6SABREBRD}
+ {Freescale SABRE SD i.MX6Quad} for \B2Q.
+
+ \note It is important that you repeat the steps in this section after you
+ update \SDK.
+
+ The images containing the \B2Q stack for SABRE SD i.MX6Quad are included
+ in \SDK, ready to be copied to an SD card.
+
+ \section1 Preparing an SD Card
+
+ An SD card of at least 512 MB capacity is sufficient.
+
+ \include detect-sd-card-device-name.qdocinc instructions
+
+ \section1 Installing the \B2Q Image
+
+ To write the image to the SD card, ensure that no partitions on the
+ SD card are mounted:
+
+ \include detect-sd-card-device-name.qdocinc unmount
+
+ Then,
+
+ \badcode
+ cd <INSTALL_DIR>
+ sudo Boot2Qt-3.x/imx6sabresd-eLinux/images/deploy.sh /dev/<device_name>
+ \endcode
+
+ After the image has been deployed, insert the SD card, power on the device and check that
+ the \B2Q welcome screen and/or demo appear.
+
+ \section1 Setting up USB Access
+
+ \include b2qt-post-install-setup.qdocinc setting up usb access
+
+ \section1 Configuring a Device Kit in Qt Creator
+
+ \include b2qt-post-install-setup.qdocinc configuring device kit
+
+ You are now ready to start developing for your device. For more information,
+ see \l{Building and Running an Example}.
+*/
+
+/*!
\target Raspberry Pi Model B (embedded Linux)
\page qtee-preparing-hardware-rasberrypi.html
\title Preparing Raspberry Pi
@@ -599,11 +723,16 @@
\section1 Installing the \B2Q Image
- To write the image to the SD card:
+ To write the image to the SD card, ensure that no partitions on the
+ SD card are mounted:
+
+ \include detect-sd-card-device-name.qdocinc unmount
+
+ Then,
\badcode
cd <INSTALL_DIR>
- sudo Boot2Qt-2.x/raspberrypi-eLinux/images/deploy.sh /dev/<device_name>
+ sudo Boot2Qt-3.x/raspberrypi-eLinux/images/deploy.sh /dev/<device_name>
\endcode
After the image has been deployed, insert the SD card, power on the device and check that
@@ -665,19 +794,24 @@
\section1 Installing the \B2Q Image
- Then, upgrade the SD card with \B2Q. Use one of the commands below,
- depending on whether you are developing for embedded Android or Linux:
+ Then, upgrade the SD card with \B2Q. First, ensure that no partitions on the
+ SD card are mounted:
+
+ \include detect-sd-card-device-name.qdocinc unmount
+
+ Then, use one of the commands below, depending on whether you are developing
+ for embedded Android or Linux:
\list
\li \b{\B2QA}
\badcode
cd <INSTALL_DIR>
- ./Boot2Qt-2.x/beaglebone-eAndroid/images/deploy.sh /dev/<device_name>
+ ./Boot2Qt-3.x/beaglebone-eAndroid/images/deploy.sh /dev/<device_name>
\endcode
\li \b{\B2QL}
\badcode
cd <INSTALL_DIR>
- sudo ./Boot2Qt-2.x/beaglebone-eLinux/images/deploy.sh /dev/<device_name>
+ sudo ./Boot2Qt-3.x/beaglebone-eLinux/images/deploy.sh /dev/<device_name>
\endcode
\endlist
@@ -725,7 +859,12 @@
\section1 Installing the \B2Q Image
- To write the image to the SD card:
+ To write the image to the SD card, ensure that no partitions on the
+ SD card are mounted:
+
+ \include detect-sd-card-device-name.qdocinc unmount
+
+ Then,
\badcode
cd <QtBuildDir>
@@ -761,7 +900,7 @@
\li In Qt Creator, select \b File > \b {New File or Project} >
\b Applications > \b{Qt Quick Application} > \b{Choose}.
\li Choose a location for your new project.
- \li In the \b{Qt Quick Component Set} dialog, select \b{Qt Quick 2.0}.
+ \li In the \b{Qt Quick Component Set} dialog, select \b{Qt Quick 2.2}.
\li In the \b{Kit Selection} dialog, select the kits for your
devices. You can also select the emulator kit to test running the
project in the emulator.
@@ -886,7 +1025,7 @@
In the \c{appcontroller.conf} file, the input devices are
specified by the lines similar to these:
\badcode
- env=QT_QPA_GENERIC_PLUGINS=evdevtouch:/dev/input/event0
+ env=QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=/dev/input/event0
\endcode
Usually, you do not need to change this setting. USB input devices, such as
@@ -897,9 +1036,10 @@
devices, such as a keyboard and mouse, have to be connected at boot
time.
- On some devices, for example the i.MX6 Sabre Lite, the touchscreen device is
- specified explicitly in \c QT_QPA_GENERIC_PLUGINS. This is necessary because
- the automatic device discovery would fail to find the touchscreen.
+ On some devices, for example the BD-SL-i.MX6, the touchscreen device is
+ specified explicitly with \c QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS. This is
+ necessary because the automatic device discovery would fail to find the
+ touchscreen.
\section1 Booting to a Custom Application
@@ -923,7 +1063,7 @@
application in QML.
\qml
- import QtQuick 2.0
+ import QtQuick 2.2
Item {
id: root
@@ -969,6 +1109,23 @@
change \c /init.rc, or simply rename the \c
{/system/bin/surfaceflinger} executable.
\endlist
+
+ \section1 Using Network Connection for ADB
+
+ By default, \B2Q uses USB cable for communication between device and Qt Creator.
+ On \B2QL, you can change the device to use ethernet network connection for the
+ communication. To enable network connection, you need to modify file
+ \c /etc/default/adbd located on the devices, and change value of \c USE_ETHERNET
+ to \c 'yes'. This can also be done with \c adb, while the device is still
+ connected via USB.
+
+ \badcode
+ <INSTALL_DIR>/Tools/b2qt/adb shell sed -i -e 's/USE_ETHERNET=no/USE_ETHERNET=yes/' /etc/default/adbd
+ \endcode
+
+ \note You need to restart the device for this change to take effect.
+
+ \include b2qt-post-install-setup.qdocinc configuring network device
*/
/*!
@@ -1019,7 +1176,7 @@
\badcode
cd <BuildDir>
- <INSTALL_DIR>/Boot2Qt-2.x/sources/b2qt-yocto-meta/b2qt-init-build-env .
+ <INSTALL_DIR>/Boot2Qt-3.x/sources/b2qt-yocto-meta/b2qt-init-build-env .
\endcode
\section1 Building the Image and Toolchain
@@ -1034,6 +1191,29 @@
source poky/oe-init-build-env build-raspberrypi
\endcode
+ The following table lists the \c MACHINE values for our reference platforms:
+
+ \table
+ \header
+ \li Board
+ \li MACHINE value
+ \row
+ \li Raspberry Pi
+ \li raspberrypi
+ \row
+ \li BeagleBone Black
+ \li beaglebone
+ \row
+ \li Boundary Devices BD-SL-i.MX6
+ \li nitrogen6x
+ \row
+ \li Freescale SABRE SD i.MX6Quad
+ \li imx6qsabresd
+ \row
+ \li Emulator
+ \li emulator
+ \endtable
+
Yocto recipes for \B2QL have two main targets to build: The target image,
and the external toolchain that is used for building the Qt framework and
applications.
@@ -1044,7 +1224,7 @@
\endcode
The target rootfs image is located in the \c <YoctoBuildDir>/tmp/deploy/images/<target>/b2qt-embedded-image-<target>.tar.gz,
- and the new toolchain is in \c <YoctoBuildDir>/tmp/deploy/sdk/b2qt-eglibc-x86_64-meta-toolchain-b2qt-embedded-sdk-<target-architecture>-toolchain-1.5.sh
+ and the new toolchain is in \c <YoctoBuildDir>/tmp/deploy/sdk/b2qt-eglibc-x86_64-meta-toolchain-b2qt-embedded-sdk-<target-architecture>-toolchain-1.6.sh
\note The generated target image does not yet include Qt libraries,
you need to build Qt and add it into the image yourself.
@@ -1057,7 +1237,7 @@
script. Using Raspberry Pi as an example:
\badcode
- <INSTALL_DIR>/Boot2Qt-2.x/sources/b2qt-build-scripts/embedded-common/init_build_env.sh <INSTALL_DIR>/Boot2Qt-2.x/sources/b2qt-build-scripts/embedded-linux/config.raspberrypi
+ <INSTALL_DIR>/Boot2Qt-3.x/sources/b2qt-build-scripts/embedded-common/init_build_env.sh <INSTALL_DIR>/Boot2Qt-3.x/sources/b2qt-build-scripts/embedded-linux/config.raspberrypi
\endcode
\note You can use the same build directory for Qt and the Yocto image.
@@ -1066,9 +1246,9 @@
You can use following scripts to build different parts of the \B2Q stack.
\badcode
- <INSTALL_DIR>/Boot2Qt-2.x/sources/b2qt-build-scripts/embedded-linux/build_qt.sh
- <INSTALL_DIR>/Boot2Qt-2.x/sources/b2qt-build-scripts/embedded-linux/build_extras.sh
- <INSTALL_DIR>/Boot2Qt-2.x/sources/b2qt-build-scripts/embedded-linux/build_image.sh
+ <INSTALL_DIR>/Boot2Qt-3.x/sources/b2qt-build-scripts/embedded-linux/build_qt.sh
+ <INSTALL_DIR>/Boot2Qt-3.x/sources/b2qt-build-scripts/embedded-linux/build_extras.sh
+ <INSTALL_DIR>/Boot2Qt-3.x/sources/b2qt-build-scripts/embedded-linux/build_image.sh
\endcode
After \e {embedded-linux/build_image.sh} has finished, you can flash the device with
@@ -1080,29 +1260,12 @@
developing for your device. The following script does this for you.
\badcode
- <INSTALL_DIR>/Boot2Qt-2.x/sources/b2qt-build-scripts/embedded-common/setup_qtcreator.sh
+ <INSTALL_DIR>/Boot2Qt-3.x/sources/b2qt-build-scripts/embedded-common/setup_qtcreator.sh
\endcode
This will set up a new kit in Qt Creator, using the toolchain and Qt from
your build directory. The new kit is visible under \b Tools > \b Options
> \b {Build & Run} > \b Kits.
-
- \section1 Using Network Connection for ADB
-
- By default, \B2Q uses USB cable for communication between device and Qt Creator.
- On \B2QL, you can change the device to use ethernet network connection for the
- communication. To enable network connection, you need to modify file
- \c /etc/default/adbd located on the devices, and change value of \c USE_ETHERNET
- to \c 'yes'. This can also be done with \c adb, while the device is still
- connected via USB.
-
- \badcode
- <INSTALL_DIR>/Tools/b2qt/adb shell sed -i -e 's/USE_ETHERNET=no/USE_ETHERNET=yes/' /etc/default/adbd
- \endcode
-
- \note You need to restart the device for this change to take effect.
-
- \include b2qt-post-install-setup.qdocinc configuring network device
*/
/*!
@@ -1127,13 +1290,16 @@
\B2Q has been tested to work on the following reference devices:
\list
- \li \l{http://www.google.com/nexus/7/specs/}{Google/Asus Nexus 7 (2012)}
- \li \l{http://beagleboard.org/hardware-xM}{BeagleBoard-xM}
+ \li \l{http://www.google.com/nexus/7/specs/}{Google/Asus Nexus 7 (2012 and 2013 models)}
\li \l{http://beagleboard.org/products/beaglebone%20black}{BeagleBone Black}
\li \l{http://boundarydevices.com/products/sabre-lite-imx6-sbc/}{Freescale i.MX6 Sabre Lite board (Boundary Devices)}
\li \l{http://www.raspberrypi.org/faqs}{Raspberry Pi Model B}
\endlist
+ For the \SDK 3.0 release, \l{Preparing BeagleBoard-xM}{BeagleBoard-xM (embedded Linux)}
+ is no longer tested and supported. It is, however, still tested and supported
+ in the earlier 2.x releases.
+
\section1 Supported Development Environment
The development environment supported by \SDK is Ubuntu Linux 64-bit (12.04 LTS or 12.10).
@@ -1198,7 +1364,44 @@
\previouspage qtee-customization.html
\nextpage qtee-troubleshooting.html
- \section1 \B2Q 2.1.0
+ \section1 \B2Q 3.0.0
+
+ \list
+ \li Release date: May 22, 2014
+ \endlist
+
+ \section2 Changes
+ \b {New Features}:
+ \list
+ \li \B2Q stack was updated to use Qt 5.3 on embedded Android and Linux
+ \li \l {Qt Virtual Keyboard} was updated to version 1.0
+ \li \l {Qt Data Visualization} demo was added
+ \li Qt WebEngine 0.9 support (including WebEngine demo) was added for
+ embedded Android and Linux. However, the Emulator target is
+ currently not supported
+ \li Qt Quick Compiler (Technology Preview) was added to the \B2Q stack
+ \li \l{Preparing Nexus 7 (2013)}{Nexus 7 (2013)} was added as a
+ reference device for embedded Android
+ \li \l{Preparing SABRE SD i.MX6Quad}{Freescale SABRE SD i.MX6Quad} was
+ added as a reference device for embedded Linux
+ \li WiFi networking support and configuration were implemented on
+ embedded Linux
+ \endlist
+
+ \b {Improvements}:
+ \list
+ \li Emulator warnings were improved
+ \li Embedded Linux: Moved to use Yocto 1.6 (Daisy)
+ \li Debug symbols were moved to a separately installable package
+ \li Presentation of \B2Q demos in Qt Creator was improved
+ \endlist
+
+ \b {Fixed Bugs}:
+ \list
+ \li Build scripts: Incorrect path was fixed
+ \endlist
+
+\section1 \B2Q 2.1.0
\list
\li Release date: Apr. 15, 2014
@@ -1356,7 +1559,7 @@
Remember to repeat the process of updating also your device with the latest
version of \B2Q. See \l{Installing Boot to Qt on Target Devices}.
- \section2 Booting Sabre Lite i.MX 6 stops with \e {6x_bootscript not found} error
+ \section2 Booting BD-SL-i.MX6 stops with \e {6x_bootscript not found} error
Check the U-Boot version number. It should start with either \c{2012} or \c{2013}.
If it is \c{2009.xx}, an upgrade of the bootloader is required. For more
@@ -1503,7 +1706,33 @@
Embedded Linux devices can be accessed using user \c{root} and an empty password.
+ \section2 No sound on Embedded Android devices
+
+ When connecting a headphone or speakers while the device is running, the
+ audio may not be properly routed to the correct output. As a workaround,
+ connect the headphone or speakers before turning on the device.
+
+ \section2 Qt WebEngine libraries cannot be found when targeting the emulator
+
+ Qt WebEngine is not currently available for the emulators, neither eLinux
+ nor eAndroid. This is planned to be addressed in a later release.
+
+ \section2 Widget-based web view is not available
+
+ The Qt WebEngine APIs are available only for Qt Quick 2 based applications at the moment.
+ The QWidget-based equivalents, like QWebEngineView, will become supported in future releases.
+ For the time being, use the WebEngineView QML element.
+
+ \section2 Qt Quick Compiler fails on the emulators
+
+ The Qt Quick Compiler is not yet functional in the emulator environments, and projects
+ are likely fail to build or run with compilation enabled. Support for the emulators
+ will be added in a later release.
+
+ \section2 QML debugging not functional when using Qt Quick Compiler
+ QML debugging is not fully functional when the Qt Quick Compiler is enabled. Support
+ for this will be added in a later release.
*/
/*!
diff --git a/src/doc/src/detect-sd-card-device-name.qdocinc b/src/doc/src/detect-sd-card-device-name.qdocinc
index 5f9803b..b74947d 100644
--- a/src/doc/src/detect-sd-card-device-name.qdocinc
+++ b/src/doc/src/detect-sd-card-device-name.qdocinc
@@ -21,7 +21,7 @@
Plug in the SD card or reader to the development host,
and use the following command to find out its device name:
- \code
+ \badcode
lsblk -d
\endcode
@@ -34,12 +34,12 @@
Typical device names for SD cards include \c {sdb} and
\c {mmcblk0}. The full device path is \c {/dev/} followed by
the name.
+//! [instructions]
- To make sure that the SD card is not mounted, enter the following
- command, where <device_name> is the device name:
-
- \code
+//! [unmount]
+ \badcode
umount /dev/<device_name>
\endcode
-//! [instructions]
+//! [unmount]
+
*/
diff --git a/src/doppelganger/doppelganger.pro b/src/doppelganger/doppelganger.pro
index fc337df..40c7650 100644
--- a/src/doppelganger/doppelganger.pro
+++ b/src/doppelganger/doppelganger.pro
@@ -3,16 +3,18 @@ QT -= core gui
TARGET = doppelganger
LIBS += -lutils -lbinder -lcutils \
- -L$${ANDROID_PRODUCT_OUT}/obj/STATIC_LIBRARIES/libscheduling_policy_intermediates -lscheduling_policy
+ -L$${ANDROID_PRODUCT_OUT}/obj/STATIC_LIBRARIES/libscheduling_policy_intermediates -lscheduling_policy -lpowermanager
TEMPLATE = app
SOURCES += main.cpp \
permissioncontroller.cpp \
- schedulingpolicyservice.cpp
+ schedulingpolicyservice.cpp \
+ powermanager.cpp
HEADERS += \
permissioncontroller.h \
- schedulingpolicyservice.h
+ schedulingpolicyservice.h \
+ powermanager.h
load(qt_tool)
diff --git a/src/doppelganger/main.cpp b/src/doppelganger/main.cpp
index e4a06c8..6d81991 100644
--- a/src/doppelganger/main.cpp
+++ b/src/doppelganger/main.cpp
@@ -20,6 +20,7 @@
#include "permissioncontroller.h"
#include "schedulingpolicyservice.h"
+#include "powermanager.h"
using namespace android;
@@ -28,5 +29,6 @@ int main(int, char *[])
sp<ProcessState> proc(ProcessState::self());
SchedulingPolicyService::instantiate();
PermissionController::instantiate();
+ PowerManager::instantiate();
IPCThreadState::self()->joinThreadPool();
}
diff --git a/src/doppelganger/powermanager.cpp b/src/doppelganger/powermanager.cpp
new file mode 100644
index 0000000..47ab02f
--- /dev/null
+++ b/src/doppelganger/powermanager.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use the contact form at
+** http://qt.digia.com/
+**
+** This file is part of Qt Enterprise Embedded.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** the contact form at http://qt.digia.com/
+**
+****************************************************************************/
+
+#include "powermanager.h"
+
+#include <binder/IServiceManager.h>
+
+using namespace android;
+
+enum {
+ ACQUIRE_WAKE_LOCK = IBinder::FIRST_CALL_TRANSACTION,
+ ACQUIRE_WAKE_LOCK_UID = IBinder::FIRST_CALL_TRANSACTION + 1,
+ RELEASE_WAKE_LOCK = IBinder::FIRST_CALL_TRANSACTION + 2,
+ UPDATE_WAKE_LOCK_UIDS = IBinder::FIRST_CALL_TRANSACTION + 3,
+};
+
+void PowerManager::instantiate()
+{
+ defaultServiceManager()->addService(String16("power"), new PowerManager());
+}
+
+status_t PowerManager::onTransact(uint32_t code,
+ const Parcel &,
+ Parcel *,
+ uint32_t)
+{
+ switch (code) {
+ case ACQUIRE_WAKE_LOCK:
+ case ACQUIRE_WAKE_LOCK_UID:
+ case RELEASE_WAKE_LOCK:
+ case UPDATE_WAKE_LOCK_UIDS:
+ return NO_ERROR;
+ default:
+ break;
+ }
+}
+
+#if Q_ANDROID_VERSION_MAJOR > 4 || (Q_ANDROID_VERSION_MAJOR == 4 && Q_ANDROID_VERSION_MINOR >= 4)
+status_t PowerManager::acquireWakeLock(int,
+ const sp<IBinder> &,
+ const String16 &,
+ const String16 &)
+{
+ return OK;
+}
+
+status_t PowerManager::acquireWakeLockWithUid(int,
+ const sp<IBinder> &,
+ const String16 &,
+ const String16 &,
+ int)
+{
+ return OK;
+}
+
+status_t PowerManager::updateWakeLockUids(const sp<IBinder> &,
+ int,
+ const int *)
+{
+ return OK;
+}
+#else // < 4.4
+status_t PowerManager::acquireWakeLock(int, const sp<android::IBinder> &, const String16 &)
+{
+ return OK;
+}
+#endif
+
+status_t PowerManager::releaseWakeLock(const sp<IBinder> &, int)
+{
+ return OK;
+}
diff --git a/src/doppelganger/powermanager.h b/src/doppelganger/powermanager.h
new file mode 100644
index 0000000..f934b31
--- /dev/null
+++ b/src/doppelganger/powermanager.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use the contact form at
+** http://qt.digia.com/
+**
+** This file is part of Qt Enterprise Embedded.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** the contact form at http://qt.digia.com/
+**
+****************************************************************************/
+
+#ifndef POWERMANAGER_H
+#define POWERMANAGER_H
+
+#include <powermanager/IPowerManager.h>
+
+namespace android {
+
+typedef BnInterface<IPowerManager> BnPowerManagerService;
+
+} // namespace android
+
+class PowerManager : public android::BnPowerManagerService
+{
+public:
+ static void instantiate();
+ android::status_t onTransact(uint32_t code,
+ const android::Parcel &data,
+ android::Parcel *reply,
+ uint32_t flags);
+
+#if Q_ANDROID_VERSION_MAJOR > 4 || (Q_ANDROID_VERSION_MAJOR == 4 && Q_ANDROID_VERSION_MINOR >= 4)
+ virtual android::status_t acquireWakeLock(int flags,
+ const android::sp<android::IBinder>& lock,
+ const android::String16& tag,
+ const android::String16& packageName);
+ virtual android::status_t acquireWakeLockWithUid(int flags,
+ const android::sp<android::IBinder>& lock,
+ const android::String16& tag,
+ const android::String16& packageName,
+ int uid);
+ virtual android::status_t updateWakeLockUids(const android::sp<android::IBinder>& lock,
+ int len,
+ const int *uids);
+#else // < 4.4
+ virtual android::status_t acquireWakeLock(int flags,
+ const android::sp<android::IBinder>& lock,
+ const android::String16& tag);
+#endif
+
+ virtual android::status_t releaseWakeLock(const android::sp<android::IBinder>& lock, int flags);
+};
+
+#endif // POWERMANAGER_H
diff --git a/src/doppelganger/schedulingpolicyservice.cpp b/src/doppelganger/schedulingpolicyservice.cpp
index a7a3f17..365e97a 100644
--- a/src/doppelganger/schedulingpolicyservice.cpp
+++ b/src/doppelganger/schedulingpolicyservice.cpp
@@ -49,7 +49,7 @@ status_t SchedulingPolicyService::onTransact(uint32_t code, const Parcel &data,
int32_t pid = data.readInt32();
int32_t tid = data.readInt32();
int32_t prio = data.readInt32();
- int res = requestPriority(pid, tid, prio);
+ int res = requestPriority_helper(pid, tid, prio);
reply->writeNoException();
reply->writeInt32(res);
return NO_ERROR;
@@ -59,7 +59,16 @@ status_t SchedulingPolicyService::onTransact(uint32_t code, const Parcel &data,
}
}
+#if Q_ANDROID_VERSION_MAJOR == 4 && Q_ANDROID_VERSION_MINOR < 3
int SchedulingPolicyService::requestPriority(int32_t pid, int32_t tid, int32_t prio)
+#else
+int SchedulingPolicyService::requestPriority(int32_t pid, int32_t tid, int32_t prio, bool)
+#endif
+{
+ return requestPriority_helper(pid, tid, prio);
+}
+
+int SchedulingPolicyService::requestPriority_helper(int32_t pid, int32_t tid, int32_t prio)
{
if (prio < PRIORITY_MIN || prio > PRIORITY_MAX)
return PERMISSION_DENIED;
diff --git a/src/doppelganger/schedulingpolicyservice.h b/src/doppelganger/schedulingpolicyservice.h
index ef56dcd..f544561 100644
--- a/src/doppelganger/schedulingpolicyservice.h
+++ b/src/doppelganger/schedulingpolicyservice.h
@@ -30,10 +30,15 @@ public:
android::status_t onTransact(uint32_t code, const android::Parcel &data,
android::Parcel *reply, uint32_t flags);
+#if Q_ANDROID_VERSION_MAJOR == 4 && Q_ANDROID_VERSION_MINOR < 3
int requestPriority(int32_t pid, int32_t tid, int32_t prio);
+#else
+ int requestPriority(int32_t pid, int32_t tid, int32_t prio, bool);
+#endif
private:
SchedulingPolicyService();
+ int requestPriority_helper(int32_t pid, int32_t tid, int32_t prio);
};
#endif // SCHEDULINGPOLICYSERVICE_H
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
index 0a5ccf5..0b5a551 100644
--- a/src/imports/imports.pro
+++ b/src/imports/imports.pro
@@ -1,3 +1,2 @@
TEMPLATE = subdirs
-SUBDIRS = utils
-android:SUBDIRS += wifi
+SUBDIRS += utils wifi
diff --git a/src/imports/wifi/pluginmain.cpp b/src/imports/wifi/pluginmain.cpp
index fdf07e9..51a2e7c 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
@@ -64,20 +66,19 @@ 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;
+ bool hasInterface = QDir().exists(QStringLiteral("/sys/class/net/wlan0"));
+ if (!hasInterface)
+ qWarning() << "QWifiGlobal: could not find wifi interface in /sys/class/net/";
+#ifdef Q_OS_ANDROID
+ if (hasInterface && wifi_load_driver() == 0 && wifi_start_supplicant(0) == 0) {
+ return true;
} else {
qWarning() << "QWifiGlobal: wifi driver is not available";
+ return false;
}
- return supported;
+#else
+ return hasInterface;
+#endif
}
};
diff --git a/src/imports/wifi/qwifi_elinux.cpp b/src/imports/wifi/qwifi_elinux.cpp
new file mode 100644
index 0000000..551d887
--- /dev/null
+++ b/src/imports/wifi/qwifi_elinux.cpp
@@ -0,0 +1,264 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use the contact form at
+** http://qt.digia.com/
+**
+** This file is part of Qt Enterprise Embedded.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** the contact form at http://qt.digia.com/
+**
+****************************************************************************/
+#include "qwifi_elinux.h"
+
+#include <QtCore/QDebug>
+
+#include "wpa-supplicant/wpa_ctrl.h"
+
+#include <poll.h>
+#include <unistd.h>
+#include <sys/socket.h>
+
+static const char SUPP_CONFIG_FILE[] = "/etc/wpa_supplicant.conf";
+static const char IFACE_DIR[] = "/var/run/wpa_supplicant/";
+static const char WIFI[] = "wlan0";
+
+static struct wpa_ctrl *ctrl_conn;
+static struct wpa_ctrl *monitor_conn;
+// socket pair used to exit from a blocking read
+static int exit_sockets[2];
+
+static const char IFNAME[] = "IFNAME=";
+#define IFNAMELEN (sizeof(IFNAME) - 1)
+static const char WPA_EVENT_IGNORE[] = "CTRL-EVENT-IGNORE ";
+
+int wifi_connect_on_socket_path(const char *path);
+int wifi_ctrl_recv(char *reply, size_t *reply_len);
+int wifi_wait_on_socket(char *buf, size_t buflen);
+int wifi_send_command(const char *cmd, char *reply, size_t *reply_len);
+void wifi_close_sockets();
+
+int q_wifi_start_supplicant()
+{
+ // NOTE: supplicant started when bringing up the wifi interface in
+ // QWifiManager::connectToBackend() by:
+ // QProcess::execute(QStringLiteral("ifup")
+
+ /* Clear out any stale socket files that might be left over. */
+ //wpa_ctrl_cleanup();
+ /* Reset sockets used for exiting from hung state */
+ exit_sockets[0] = exit_sockets[1] = -1;
+ return 0;
+}
+
+int q_wifi_stop_supplicant()
+{
+ // NOTE: supplicant stopped when bringing down the wifi
+ // interface in QWifiManager::disconnectFromBackend() by:
+ // QProcess::execute(QStringLiteral("ifdown")
+ return 0;
+}
+
+int q_wifi_connect_to_supplicant(const char *ifname)
+{
+ Q_UNUSED(ifname);
+ static char path[4096];
+ snprintf(path, sizeof(path), "%s/%s", IFACE_DIR, WIFI);
+ return wifi_connect_on_socket_path(path);
+}
+
+int wifi_connect_on_socket_path(const char *path)
+{
+ // establishes the control and monitor socket connections on the interface
+ ctrl_conn = wpa_ctrl_open(path);
+ if (ctrl_conn == NULL) {
+ qWarning("Unable to open connection to supplicant on \"%s\": %s",
+ path, strerror(errno));
+ return -1;
+ }
+ monitor_conn = wpa_ctrl_open(path);
+ if (monitor_conn == NULL) {
+ wpa_ctrl_close(ctrl_conn);
+ ctrl_conn = NULL;
+ return -1;
+ }
+ if (wpa_ctrl_attach(monitor_conn) != 0) {
+ wpa_ctrl_close(monitor_conn);
+ wpa_ctrl_close(ctrl_conn);
+ ctrl_conn = monitor_conn = NULL;
+ return -1;
+ }
+
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, exit_sockets) == -1) {
+ wpa_ctrl_close(monitor_conn);
+ wpa_ctrl_close(ctrl_conn);
+ ctrl_conn = monitor_conn = NULL;
+ return -1;
+ }
+
+ return 0;
+}
+
+int q_wifi_wait_for_event(const char *ifname, char *buf, size_t buflen)
+{
+ Q_UNUSED(ifname);
+ return wifi_wait_on_socket(buf, buflen);
+}
+
+int wifi_wait_on_socket(char *buf, size_t buflen)
+{
+ size_t nread = buflen - 1;
+ int result;
+ char *match, *match2;
+
+ if (monitor_conn == NULL) {
+ return snprintf(buf, buflen, WPA_EVENT_TERMINATING " - connection closed");
+ }
+
+ result = wifi_ctrl_recv(buf, &nread);
+
+ /* Terminate reception on exit socket */
+ if (result == -2) {
+ return snprintf(buf, buflen, WPA_EVENT_TERMINATING " - connection closed");
+ }
+
+ if (result < 0) {
+ qWarning("wifi_ctrl_recv failed: %s\n", strerror(errno));
+ return snprintf(buf, buflen, WPA_EVENT_TERMINATING " - recv error");
+ }
+ buf[nread] = '\0';
+ /* Check for EOF on the socket */
+ if (result == 0 && nread == 0) {
+ /* Fabricate an event to pass up */
+ qWarning("Received EOF on supplicant socket\n");
+ return snprintf(buf, buflen, WPA_EVENT_TERMINATING " - signal 0 received");
+ }
+ /*
+ * Events strings are in the format
+ *
+ * IFNAME=iface <N>CTRL-EVENT-XXX
+ * or
+ * <N>CTRL-EVENT-XXX
+ *
+ * where N is the message level in numerical form (0=VERBOSE, 1=DEBUG,
+ * etc.) and XXX is the event name. The level information is not useful
+ * to us, so strip it off.
+ */
+
+ if (strncmp(buf, IFNAME, IFNAMELEN) == 0) {
+ match = strchr(buf, ' ');
+ if (match != NULL) {
+ if (match[1] == '<') {
+ match2 = strchr(match + 2, '>');
+ if (match2 != NULL) {
+ nread -= (match2 - match);
+ memmove(match + 1, match2 + 1, nread - (match - buf) + 1);
+ }
+ }
+ } else {
+ return snprintf(buf, buflen, "%s", WPA_EVENT_IGNORE);
+ }
+ } else if (buf[0] == '<') {
+ match = strchr(buf, '>');
+ if (match != NULL) {
+ nread -= (match + 1 - buf);
+ memmove(buf, match + 1, nread + 1);
+ //qWarning("supplicant generated event without interface - %s\n", buf);
+ }
+ } else {
+ /* let the event go as is! */
+ qWarning("supplicant generated event without interface and without message level - %s\n", buf);
+ }
+
+ return nread;
+}
+
+int wifi_ctrl_recv(char *reply, size_t *reply_len)
+{
+ int res = 0;
+ int ctrlfd = wpa_ctrl_get_fd(monitor_conn);
+ struct pollfd rfds[2];
+
+ memset(rfds, 0, 2 * sizeof(struct pollfd));
+ rfds[0].fd = ctrlfd;
+ rfds[0].events |= POLLIN;
+ rfds[1].fd = exit_sockets[1];
+ rfds[1].events |= POLLIN;
+ res = TEMP_FAILURE_RETRY(poll(rfds, 2, -1));
+ if (res < 0) {
+ qWarning("Error poll = %d", res);
+ return res;
+ }
+ if (rfds[0].revents & POLLIN) {
+ return wpa_ctrl_recv(monitor_conn, reply, reply_len);
+ }
+
+ /* it is not rfds[0], then it must be rfts[1] (i.e. the exit socket)
+ * or we timed out. In either case, this call has failed ..
+ */
+ return -2;
+}
+
+int wifi_send_command(const char *cmd, char *reply, size_t *reply_len)
+{
+ int ret;
+ if (ctrl_conn == NULL) {
+ qWarning("Not connected to wpa_supplicant - \"%s\" command dropped.\n", cmd);
+ return -1;
+ }
+ ret = wpa_ctrl_request(ctrl_conn, cmd, strlen(cmd), reply, reply_len, NULL);
+ if (ret == -2) {
+ qWarning("'%s' command timed out.\n", cmd);
+ /* unblocks the monitor receive socket for termination */
+ TEMP_FAILURE_RETRY(write(exit_sockets[0], "T", 1));
+ return -2;
+ } else if (ret < 0 || strncmp(reply, "FAIL", 4) == 0) {
+ return -1;
+ }
+ if (strncmp(cmd, "PING", 4) == 0) {
+ reply[*reply_len] = '\0';
+ }
+ return 0;
+}
+
+int q_wifi_command(const char *ifname, const char *command, char *reply, size_t *reply_len)
+{
+ Q_UNUSED(ifname);
+ return wifi_send_command(command, reply, reply_len);
+}
+
+void q_wifi_close_supplicant_connection(const char *ifname)
+{
+ Q_UNUSED(ifname)
+ wifi_close_sockets();
+}
+
+void wifi_close_sockets()
+{
+ if (ctrl_conn != NULL) {
+ wpa_ctrl_close(ctrl_conn);
+ ctrl_conn = NULL;
+ }
+
+ if (monitor_conn != NULL) {
+ wpa_ctrl_close(monitor_conn);
+ monitor_conn = NULL;
+ }
+
+ if (exit_sockets[0] >= 0) {
+ close(exit_sockets[0]);
+ exit_sockets[0] = -1;
+ }
+
+ if (exit_sockets[1] >= 0) {
+ close(exit_sockets[1]);
+ exit_sockets[1] = -1;
+ }
+}
diff --git a/src/imports/wifi/qwifi_elinux.h b/src/imports/wifi/qwifi_elinux.h
new file mode 100644
index 0000000..92a04f8
--- /dev/null
+++ b/src/imports/wifi/qwifi_elinux.h
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use the contact form at
+** http://qt.digia.com/
+**
+** This file is part of Qt Enterprise Embedded.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** the contact form at http://qt.digia.com/
+**
+****************************************************************************/
+#ifndef LOCAL_WIFI_H
+#define LOCAL_WIFI_H
+
+#include <string.h>
+
+// This API mirrors Android's Wi-Fi libraries interface [1] and implementation, excluding Android OS specific parts.
+// [1] http://androidxref.com/4.4.2_r2/xref/hardware/libhardware_legacy/include/hardware_legacy/wifi.h
+
+int q_wifi_command(const char *ifname, const char *command, char *reply, size_t *reply_len);
+int q_wifi_wait_for_event(const char *ifname, char *buf, size_t buflen);
+int q_wifi_connect_to_supplicant(const char *ifname);
+void q_wifi_close_supplicant_connection(const char *ifname);
+int q_wifi_start_supplicant();
+int q_wifi_stop_supplicant();
+
+#endif // LOCAL_WIFI_H
diff --git a/src/imports/wifi/qwifimanager.cpp b/src/imports/wifi/qwifimanager.cpp
index af6f5d3..65073f1 100644
--- a/src/imports/wifi/qwifimanager.cpp
+++ b/src/imports/wifi/qwifimanager.cpp
@@ -19,10 +19,13 @@
#include "qwifimanager.h"
#include <QtCore>
-
+#ifdef Q_OS_ANDROID
#include <hardware_legacy/wifi.h>
#include <cutils/sockets.h>
#include <unistd.h>
+#else
+#include <qwifi_elinux.h>
+#endif
static const char SUPPLICANT_SVC[] = "init.svc.wpa_supplicant";
static const char WIFI_INTERFACE[] = "wifi.interface";
@@ -34,6 +37,69 @@ const QEvent::Type WIFI_SCAN_RESULTS = (QEvent::Type) (QEvent::User + 2001);
const QEvent::Type WIFI_CONNECTED = (QEvent::Type) (QEvent::User + 2002);
const QEvent::Type WIFI_HANDSHAKE_FAILED = (QEvent::Type) (QEvent::User + 2003);
+#ifdef Q_OS_ANDROID
+/*
+ * Work around API differences between Android versions
+ */
+
+static int q_wifi_start_supplicant()
+{
+#if Q_ANDROID_VERSION_MAJOR == 4 && Q_ANDROID_VERSION_MINOR < 1
+ return wifi_start_supplicant();
+#else
+ return wifi_start_supplicant(0);
+#endif
+}
+
+static int q_wifi_stop_supplicant()
+{
+#if Q_ANDROID_VERSION_MAJOR == 4 && Q_ANDROID_VERSION_MINOR < 1
+ return wifi_stop_supplicant();
+#else
+ return wifi_stop_supplicant(0);
+#endif
+}
+
+static int q_wifi_connect_to_supplicant(const char *ifname)
+{
+#if Q_ANDROID_VERSION_MAJOR == 4 && (Q_ANDROID_VERSION_MINOR < 4 && Q_ANDROID_VERSION_MINOR >= 1)
+ return wifi_connect_to_supplicant(ifname);
+#else
+ Q_UNUSED(ifname);
+ return wifi_connect_to_supplicant();
+#endif
+}
+
+static void q_wifi_close_supplicant_connection(const char *ifname)
+{
+#if Q_ANDROID_VERSION_MAJOR == 4 && (Q_ANDROID_VERSION_MINOR < 4 && Q_ANDROID_VERSION_MINOR >= 1)
+ wifi_close_supplicant_connection(ifname);
+#else
+ Q_UNUSED(ifname);
+ wifi_close_supplicant_connection();
+#endif
+}
+
+static int q_wifi_wait_for_event(const char *ifname, char *buf, size_t len)
+{
+#if Q_ANDROID_VERSION_MAJOR == 4 && (Q_ANDROID_VERSION_MINOR < 4 && Q_ANDROID_VERSION_MINOR >= 1)
+ return wifi_wait_for_event(ifname, buf, len);
+#else
+ Q_UNUSED(ifname);
+ return wifi_wait_for_event(buf, len);
+#endif
+}
+
+static int q_wifi_command(const char *ifname, const char *command, char *reply, size_t *reply_len)
+{
+#if Q_ANDROID_VERSION_MAJOR == 4 && (Q_ANDROID_VERSION_MINOR < 4 && Q_ANDROID_VERSION_MINOR >= 1)
+ return wifi_command(ifname, command, reply, reply_len);
+#else
+ Q_UNUSED(ifname);
+ return wifi_command(command, reply, reply_len);
+#endif
+}
+
/*
* This function is borrowed from /system/core/libnetutils/dhcp_utils.c
*
@@ -63,6 +129,7 @@ static int wait_for_property(const char *name, const char *desired_value, int ma
}
return -1; /* failure */
}
+#endif
class QWifiManagerEvent : public QEvent
{
@@ -94,7 +161,7 @@ public:
QWifiManagerEvent *event = 0;
char buffer[2048];
while (1) {
- int size = wifi_wait_for_event(m_if.constData(), buffer, sizeof(buffer) - 1);
+ int size = q_wifi_wait_for_event(m_if.constData(), buffer, sizeof(buffer) - 1);
if (size > 0) {
buffer[size] = 0;
event = 0;
@@ -348,17 +415,25 @@ QWifiManager::QWifiManager()
, m_eventThread(0)
, m_scanTimer(0)
, m_scanning(false)
+#ifdef Q_OS_ANDROID
, m_daemonClientSocket(0)
+#endif
, m_exitingEventThread(false)
, m_startingUp(true)
, m_network(0)
{
+#ifdef Q_OS_ANDROID
char interface[PROPERTY_VALUE_MAX];
property_get(WIFI_INTERFACE, interface, NULL);
m_interface = interface;
- if (QT_WIFI_DEBUG) qDebug("QWifiManager: using wifi interface: %s", m_interface.constData());
+#else
+ m_interface = "wlan0"; // use envvar for the interface name?
+ m_dhcpRunner = new ProcessRunner(m_interface);
+ QObject::connect(m_dhcpRunner, &ProcessRunner::processFinished, this, &QWifiManager::handleDhcpFinished);
+#endif
+ qDebug("QWifiManager: using wifi interface: %s", m_interface.constData());
m_eventThread = new QWifiManagerEventThread(this, m_interface);
-
+#ifdef Q_OS_ANDROID
m_daemonClientSocket = new QLocalSocket;
int qconnFd = socket_local_client("qconnectivity", ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_STREAM);
if (qconnFd != -1) {
@@ -381,16 +456,25 @@ QWifiManager::QWifiManager()
// same here, cleans up the state
disconnectFromBackend();
}
+ } else {
+#endif
+ m_backendReady = false;
+ emit backendReadyChanged();
+#ifdef Q_OS_ANDROID
}
+#endif
}
QWifiManager::~QWifiManager()
{
exitEventThread();
delete m_eventThread;
+#ifdef Q_OS_ANDROID
delete m_daemonClientSocket;
+#endif
}
+#ifdef Q_OS_ANDROID
void QWifiManager::handleDhcpReply()
{
if (m_daemonClientSocket->canReadLine()) {
@@ -425,6 +509,14 @@ void QWifiManager::connectedToDaemon()
m_daemonClientSocket->write(m_request.constData(), m_request.length());
m_daemonClientSocket->flush();
}
+#endif
+
+void QWifiManager::handleDhcpFinished()
+{
+ // ### TODO - could be that dhcp request fails, how to determine?
+ updateNetworkState(Connected);
+ call("SAVE_CONFIG");
+}
void QWifiManager::start()
{
@@ -444,22 +536,31 @@ void QWifiManager::stop()
void QWifiManager::connectToBackend()
{
+ // ### TODO: maybe it makes sense to move this functions in non-gui thread
+#ifdef Q_OS_ANDROID
if (!(is_wifi_driver_loaded() || wifi_load_driver() == 0)) {
qWarning("QWifiManager: failed to load a driver");
return;
}
- if (wifi_start_supplicant(0) != 0) {
+#else
+ QProcess::execute(QStringLiteral("ifup"), QStringList() << m_interface.constData());
+#endif
+ if (q_wifi_start_supplicant() != 0) {
qWarning("QWifiManager: failed to start a supplicant");
return;
}
+#ifdef Q_OS_ANDROID
if (wait_for_property(SUPPLICANT_SVC, "running", 5) < 0) {
qWarning("QWifiManager: Timed out waiting for supplicant to start");
return;
}
- if (wifi_connect_to_supplicant(m_interface.constData()) == 0) {
+#endif
+ if (q_wifi_connect_to_supplicant(m_interface.constData()) == 0) {
m_backendReady = true;
emit backendReadyChanged();
+#ifdef Q_OS_ANDROID
property_set(QT_WIFI_BACKEND, "running");
+#endif
} else {
qWarning("QWifiManager: failed to connect to a supplicant");
return;
@@ -473,10 +574,15 @@ void QWifiManager::connectToBackend()
void QWifiManager::disconnectFromBackend()
{
exitEventThread();
- if (wifi_stop_supplicant(0) < 0)
+ if (q_wifi_stop_supplicant() < 0)
qWarning("QWifiManager: failed to stop supplicant");
- wifi_close_supplicant_connection(m_interface.constData());
+ q_wifi_close_supplicant_connection(m_interface.constData());
+ setScanning(false);
+#ifdef Q_OS_ANDROID
property_set(QT_WIFI_BACKEND, "stopped");
+#else
+ QProcess::execute(QStringLiteral("ifdown"), QStringList() << m_interface.constData());
+#endif
m_backendReady = false;
emit backendReadyChanged();
}
@@ -512,7 +618,7 @@ QByteArray QWifiManager::call(const char *command) const
{
char data[2048];
size_t len = sizeof(data) - 1; // -1: room to add a 0-terminator
- if (wifi_command(m_interface.constData(), command, data, &len) < 0) {
+ if (q_wifi_command(m_interface.constData(), command, data, &len) < 0) {
qWarning("QWifiManager: call failed: %s", command);
return QByteArray();
}
@@ -571,7 +677,6 @@ void QWifiManager::connect(QWifiNetwork *network, const QString &passphrase)
return;
}
updateNetworkState(Authenticating);
-
call("DISABLE_NETWORK all");
if (!m_connectedSSID.isEmpty()) {
m_connectedSSID.clear();
@@ -633,13 +738,35 @@ void QWifiManager::connect(QWifiNetwork *network, const QString &passphrase)
void QWifiManager::disconnect()
{
call("DISCONNECT");
+#ifdef Q_OS_ANDROID
QByteArray req = m_interface;
sendDhcpRequest(req.append(" disconnect"));
+#endif
m_connectedSSID.clear();
updateNetworkState(Disconnected);
emit connectedSSIDChanged(m_connectedSSID);
}
+void ProcessRunner::run()
+{
+ // kill existing udhcpc instance
+ QString filePath = QString("/var/run/udhcpc.").append(m_ifc).append(".pid");
+ QFile pidFile(filePath);
+ if (pidFile.open(QIODevice::ReadOnly)) {
+ QByteArray pid = pidFile.readAll();
+ pidFile.close();
+ QProcess::execute(QStringLiteral("kill"), QStringList() << pid.trimmed().constData());
+ } else {
+ qWarning() << "QWifiManager - Failed to read" << filePath;
+ }
+ QStringList args;
+ args << QStringLiteral("-R") << QStringLiteral("-n") << QStringLiteral("-p")
+ << filePath << QStringLiteral("-i") << m_ifc;
+ // start DHCP client
+ QProcess::execute(QStringLiteral("udhcpc"), args);
+ emit processFinished();
+}
+
void QWifiManager::handleConnected()
{
QList<QByteArray> lists = call("LIST_NETWORKS").split('\n');
@@ -670,6 +797,10 @@ void QWifiManager::handleConnected()
}
updateNetworkState(ObtainingIPAddress);
+#ifdef Q_OS_ANDROID
QByteArray req = m_interface;
sendDhcpRequest(req.append(" connect"));
+#else
+ m_dhcpRunner->start();
+#endif
}
diff --git a/src/imports/wifi/qwifimanager.h b/src/imports/wifi/qwifimanager.h
index 162190e..3af123f 100644
--- a/src/imports/wifi/qwifimanager.h
+++ b/src/imports/wifi/qwifimanager.h
@@ -20,15 +20,32 @@
#define QWIFIMANAGER_H
#include <QtCore/QObject>
+#include <QtCore/QThread>
#include <QtCore/QByteArray>
-#include <QtNetwork/QLocalSocket>
+#ifdef Q_OS_ANDROID
+#include <QtNetwork/QLocalSocket>
#include <cutils/properties.h>
+#endif
#include "qwifinetworklistmodel.h"
class QWifiManagerEventThread;
+class ProcessRunner : public QThread
+{
+ Q_OBJECT
+public:
+ ProcessRunner(const QByteArray &ifc) : m_ifc(ifc) {}
+ void run();
+
+signals:
+ void processFinished();
+
+private:
+ QByteArray m_ifc;
+};
+
class QWifiManager : public QObject
{
Q_OBJECT
@@ -74,21 +91,26 @@ signals:
protected:
bool event(QEvent *);
- void sendDhcpRequest(const QByteArray &request);
void handleConnected();
void connectToBackend();
void disconnectFromBackend();
void exitEventThread();
+
QByteArray call(const char *command) const;
bool checkedCall(const char *command) const;
void updateNetworkState(NetworkState state);
protected slots:
+#if defined(FORCE_MOC)
+ void sendDhcpRequest(const QByteArray &request);
void connectedToDaemon();
void handleDhcpReply();
+#endif
+ void handleDhcpFinished();
private:
friend class QWifiManagerEventThread;
+ friend class ProcessRunner;
QString m_connectedSSID;
QWifiNetworkListModel m_networkListModel;
@@ -100,7 +122,11 @@ private:
QByteArray m_interface;
NetworkState m_state;
+#ifdef Q_OS_ANDROID
QLocalSocket *m_daemonClientSocket;
+#else
+ ProcessRunner *m_dhcpRunner;
+#endif
QByteArray m_request;
bool m_exitingEventThread;
bool m_startingUp;
diff --git a/src/imports/wifi/qwifinetworklistmodel.cpp b/src/imports/wifi/qwifinetworklistmodel.cpp
index 4fbf25f..f95af36 100644
--- a/src/imports/wifi/qwifinetworklistmodel.cpp
+++ b/src/imports/wifi/qwifinetworklistmodel.cpp
@@ -88,14 +88,15 @@ void QWifiNetworkListModel::parseScanResults(const QByteArray &results)
QWifiNetwork *knownNetwork = networkForSSID(info.at(4), &pos);
if (!knownNetwork)
knownNetwork = outOfRangeListContains(info.at(4));
-
+ // signal strength is in dBm. Deprecated, but still widely used "wext"
+ // wifi driver reports positive values for signal strength, we workaround that.
+ int signalStrength = qAbs(info.at(2).trimmed().toInt()) * -1;
if (!knownNetwork) {
QWifiNetwork *network = new QWifiNetwork();
network->setOutOfRange(false);
network->setBssid(info.at(0));
network->setFlags(info.at(3));
- // signal strength is in dBm
- network->setSignalStrength(info.at(2).toInt());
+ network->setSignalStrength(signalStrength);
network->setSsid(info.at(4));
beginInsertRows(QModelIndex(), m_networks.size(), m_networks.size());
m_networks << network;
@@ -112,15 +113,15 @@ void QWifiNetworkListModel::parseScanResults(const QByteArray &results)
// ssids are the same, compare bssids..
if (knownNetwork->bssid() == info.at(0)) {
// same access point, simply update the signal strength
- knownNetwork->setSignalStrength(info.at(2).toInt());
+ knownNetwork->setSignalStrength(signalStrength);
knownNetwork->setOutOfRange(false);
dataChanged(createIndex(pos, 0), createIndex(pos, 0));
- } else if (knownNetwork->signalStrength() < info.at(2).toInt()) {
+ } else if (knownNetwork->signalStrength() < signalStrength) {
// replace with a stronger access point within the same network
m_networks.at(pos)->setOutOfRange(false);
m_networks.at(pos)->setBssid(info.at(0));
m_networks.at(pos)->setFlags(info.at(3));
- m_networks.at(pos)->setSignalStrength(info.at(2).toInt());
+ m_networks.at(pos)->setSignalStrength(signalStrength);
m_networks.at(pos)->setSsid(info.at(4));
dataChanged(createIndex(pos, 0), createIndex(pos, 0));
}
diff --git a/src/imports/wifi/wifi.pro b/src/imports/wifi/wifi.pro
index b920978..fcb6cdd 100644
--- a/src/imports/wifi/wifi.pro
+++ b/src/imports/wifi/wifi.pro
@@ -4,18 +4,29 @@ TARGET = qwifimodule
TARGETPATH = Qt/labs/wifi
IMPORT_VERSION = 0.1
+HEADERS += \
+ qwifimanager.h \
+ qwifinetwork.h \
+ qwifinetworklistmodel.h
+
SOURCES += \
pluginmain.cpp \
qwifimanager.cpp \
qwifinetwork.cpp \
qwifinetworklistmodel.cpp
-HEADERS += \
- qwifimanager.h \
- qwifinetwork.h \
- qwifinetworklistmodel.h
+android: {
+ LIBS += -lhardware_legacy -lcutils
+ DEFINES += FORCE_MOC
+} else {
+ DEFINES += CONFIG_CTRL_IFACE \
+ CONFIG_CTRL_IFACE_UNIX
-LIBS += -lhardware_legacy -lcutils
+ HEADERS += qwifi_elinux.h
+ SOURCES += \
+ qwifi_elinux.cpp \
+ $$[QT_SYSROOT]/usr/include/wpa-supplicant/wpa_ctrl.c \
+ $$[QT_SYSROOT]/usr/include/wpa-supplicant/os_unix.c
+}
load(qml_plugin)
-
diff --git a/src/qconnectivity/main.cpp b/src/qconnectivity/main.cpp
index 046375e..6f01021 100644
--- a/src/qconnectivity/main.cpp
+++ b/src/qconnectivity/main.cpp
@@ -41,18 +41,52 @@ static int MIN_RENEWAL_TIME_SECS = 300; // 5 min
#define ETH_INTERFACE_HW "eth0"
#define ETH_INTERFACE_EMULATOR "eth1"
+#if Q_ANDROID_VERSION_MAJOR == 4 && Q_ANDROID_VERSION_MINOR < 3
// this function is defined in android/system/core/libnetutils/dhcp_utils.c
extern "C" {
int dhcp_do_request_renew(const char *ifname,
- const char *ipaddr,
- const char *gateway,
- uint32_t *prefixLength,
- const char *dns1,
- const char *dns2,
- const char *server,
- uint32_t *lease,
- const char *vendorInfo);
+ char *ipaddr,
+ char *gateway,
+ uint32_t *prefixLength,
+ char *dns1,
+ char *dns2,
+ char *server,
+ uint32_t *lease,
+ char *vendorInfo);
}
+#endif
+
+static int q_dhcp_do_request(bool renew,
+ const char *ifname,
+ char *ipaddr,
+ char *gateway,
+ uint32_t *prefixLength,
+ char *dns1,
+ char *dns2,
+ char *server,
+ uint32_t *lease,
+ char *vendorInfo)
+{
+#if Q_ANDROID_VERSION_MAJOR == 4 && Q_ANDROID_VERSION_MINOR < 3
+ if (!renew)
+ return dhcp_do_request(ifname, ipaddr, gateway, prefixLength, dns1, dns2, server, lease, vendorInfo);
+ return dhcp_do_request_renew(ifname, ipaddr, gateway, prefixLength, dns1, dns2, server, lease, vendorInfo);
+#else
+ char *dns[3] = {dns1, dns2, 0};
+ char domain[PROPERTY_VALUE_MAX];
+ char mtu[PROPERTY_VALUE_MAX];
+#if Q_ANDROID_VERSION_MAJOR == 4 && Q_ANDROID_VERSION_MINOR < 4
+ if (!renew)
+ return dhcp_do_request(ifname, ipaddr, gateway, prefixLength, dns, server, lease, vendorInfo);
+ return dhcp_do_request_renew(ifname, ipaddr, gateway, prefixLength, dns, server, lease, vendorInfo);
+#else
+ if (!renew)
+ return dhcp_do_request(ifname, ipaddr, gateway, prefixLength, dns, server, lease, vendorInfo, domain, mtu);
+ return dhcp_do_request_renew(ifname, ipaddr, gateway, prefixLength, dns, server, lease, vendorInfo, domain, mtu);
+#endif
+#endif
+}
+
class LeaseTimer;
class QConnectivityDaemon : public QObject
@@ -254,8 +288,8 @@ bool QConnectivityDaemon::startDhcp(bool renew, const char *interface)
char vendorInfo[PROPERTY_VALUE_MAX];
if (renew) {
- result = dhcp_do_request_renew(interface, ipaddr, gateway, &prefixLength,
- dns1, dns2, server, &lease, vendorInfo);
+ result = q_dhcp_do_request(true, interface, ipaddr, gateway, &prefixLength,
+ dns1, dns2, server, &lease, vendorInfo);
} else {
// stop any existing DHCP daemon before starting new
dhcp_stop(interface);
@@ -263,8 +297,8 @@ bool QConnectivityDaemon::startDhcp(bool renew, const char *interface)
// the device init.rc. Android starts dhcpcd with argument -B which means that
// we are responsible for renewing a lease before it expires
ifc_clear_addresses(interface);
- result = dhcp_do_request(interface, ipaddr, gateway, &prefixLength,
- dns1, dns2, server, &lease, vendorInfo);
+ result = q_dhcp_do_request(false, interface, ipaddr, gateway, &prefixLength,
+ dns1, dns2, server, &lease, vendorInfo);
}
bool success = (result == 0) ? true : false;
diff --git a/src/utils/qdroidutils.cpp b/src/utils/qdroidutils.cpp
index 7ab2098..d880de9 100644
--- a/src/utils/qdroidutils.cpp
+++ b/src/utils/qdroidutils.cpp
@@ -29,6 +29,7 @@
#include <cutils/properties.h>
#include <hardware/lights.h>
#include <media/AudioSystem.h>
+#include <utils/String8.h>
#endif
/*!
@@ -225,7 +226,7 @@ bool QDroidUtils::setDisplayBrightness(quint8 value)
QString QDroidUtils::getIPAddress()
{
QStringList addresses;
- QNetworkInterface interface = QNetworkInterface::interfaceFromName("eth0");
+ QNetworkInterface interface = QNetworkInterface::interfaceFromName(QStringLiteral("eth0"));
QList<QNetworkAddressEntry> entries;
entries = interface.addressEntries();
foreach (const QNetworkAddressEntry &entry, entries) {