From 4c6c06470f4998506d59de0a6488f40d50ca4154 Mon Sep 17 00:00:00 2001 From: aavit Date: Thu, 20 Mar 2014 11:25:31 +0100 Subject: Compilation fixes for Android 4.4 Change-Id: I2017665372e190f9d12841820714457967ff3a3a Reviewed-by: Gatis Paeglis --- src/doppelganger/schedulingpolicyservice.cpp | 11 ++++- src/doppelganger/schedulingpolicyservice.h | 5 ++ src/imports/wifi/qwifimanager.cpp | 74 +++++++++++++++++++++++++--- src/qconnectivity/main.cpp | 60 +++++++++++++++++----- src/utils/qdroidutils.cpp | 3 +- 5 files changed, 132 insertions(+), 21 deletions(-) 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/wifi/qwifimanager.cpp b/src/imports/wifi/qwifimanager.cpp index 7d6683b..160b9a7 100644 --- a/src/imports/wifi/qwifimanager.cpp +++ b/src/imports/wifi/qwifimanager.cpp @@ -33,6 +33,68 @@ static bool QT_WIFI_DEBUG = !qgetenv("QT_WIFI_DEBUG").isEmpty(); const QEvent::Type WIFI_SCAN_RESULTS = (QEvent::Type) (QEvent::User + 2001); const QEvent::Type WIFI_CONNECTED = (QEvent::Type) (QEvent::User + 2002); +/* + * 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 * @@ -92,7 +154,7 @@ public: if (QT_WIFI_DEBUG) qDebug("EventReceiver thread is running"); 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; @@ -225,7 +287,7 @@ void QWifiManager::connectToBackend() qWarning("QWifiManager: failed to load a driver"); return; } - if (wifi_start_supplicant(0) != 0) { + if (q_wifi_start_supplicant() != 0) { qWarning("QWifiManager: failed to start a supplicant"); return; } @@ -233,7 +295,7 @@ void QWifiManager::connectToBackend() qWarning("QWifiManager: Timed out waiting for supplicant to start"); return; } - if (wifi_connect_to_supplicant(m_interface.constData()) == 0) { + if (q_wifi_connect_to_supplicant(m_interface.constData()) == 0) { m_backendReady = true; emit backendReadyChanged(); property_set(QT_WIFI_BACKEND, "running"); @@ -253,9 +315,9 @@ void QWifiManager::disconnectFromBackend() call("SCAN"); m_eventThread->wait(); - 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()); property_set(QT_WIFI_BACKEND, "stopped"); m_backendReady = false; emit backendReadyChanged(); @@ -283,7 +345,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(); } diff --git a/src/qconnectivity/main.cpp b/src/qconnectivity/main.cpp index 046375e..2b167f4 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); +int dhcp_do_request_renew(char *ifname, + 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 #include #include +#include #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 entries; entries = interface.addressEntries(); foreach (const QNetworkAddressEntry &entry, entries) { -- cgit v1.2.3 From ac91a7d0fb40a8caaff80a8f477428265c8f0a78 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Mon, 14 Apr 2014 15:39:21 +0200 Subject: Doc: Relocate unmount instructions This change relocates the step to unmount the partitions from 'Preparing an SD Card' to be the first step in deploying the Boot to Qt image. Change-Id: If256848aaf4b24108b62902f3c7d3d1c6bee3d72 Reviewed-by: Rainer Keller Reviewed-by: Laszlo Agocs --- src/doc/src/b2qt.qdoc | 39 +++++++++++++++++++++----- src/doc/src/detect-sd-card-device-name.qdocinc | 12 ++++---- 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/src/doc/src/b2qt.qdoc b/src/doc/src/b2qt.qdoc index 7e7bad4..c232965 100644 --- a/src/doc/src/b2qt.qdoc +++ b/src/doc/src/b2qt.qdoc @@ -460,7 +460,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 @@ -539,8 +544,13 @@ 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} @@ -599,7 +609,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 @@ -665,8 +680,13 @@ \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} @@ -725,7 +745,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 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 is the device name: - - \code +//! [unmount] + \badcode umount /dev/ \endcode -//! [instructions] +//! [unmount] + */ -- cgit v1.2.3 From cef8834b27a7588886c0439d145004ae9ad33a13 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 14 Apr 2014 16:20:13 +0200 Subject: Add note about headphones on eAndroid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3b68c5ee39b8ca18b7d27f191de278530d138466 Reviewed-by: Topi Reiniö --- src/doc/src/b2qt.qdoc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/doc/src/b2qt.qdoc b/src/doc/src/b2qt.qdoc index c232965..394eb44 100644 --- a/src/doc/src/b2qt.qdoc +++ b/src/doc/src/b2qt.qdoc @@ -1528,6 +1528,11 @@ 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. */ -- cgit v1.2.3 From cb32ae9a71769f638a5354f23f214e4688a0e449 Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Wed, 23 Apr 2014 17:39:52 +0200 Subject: Fix compile error in qconnectivity Change-Id: Ib690e253ddc1c036dfa1d0ea8268200850f14b18 Reviewed-by: Eirik Aavitsland --- src/qconnectivity/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qconnectivity/main.cpp b/src/qconnectivity/main.cpp index 2b167f4..6f01021 100644 --- a/src/qconnectivity/main.cpp +++ b/src/qconnectivity/main.cpp @@ -44,7 +44,7 @@ static int MIN_RENEWAL_TIME_SECS = 300; // 5 min #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(char *ifname, +int dhcp_do_request_renew(const char *ifname, char *ipaddr, char *gateway, uint32_t *prefixLength, -- cgit v1.2.3 From 5b14eac6bfb70867c6b97f3dcec3841b856061ee Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Wed, 7 May 2014 11:36:04 +0300 Subject: doc: update version to 3.0.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I9e9cb1c74c5be2d213a8a8b7b77a66272cf6e0ec Reviewed-by: Pasi Petäjäjärvi --- src/doc/config/b2qt.qdocconf | 4 ++-- 1 file changed, 2 insertions(+), 2 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 = -- cgit v1.2.3 From 50602d270ba701d524462f21256a23761146ca65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Thu, 8 May 2014 11:06:32 +0200 Subject: Add PowerManager service. On Android 4.4 we need to respond to wake-lock requests to prevent StageFrigh from committing suicide. Change-Id: Ie2c261c0c1b962a63ba8516fefaac71a0ec3a54e Reviewed-by: Eirik Aavitsland --- src/doppelganger/doppelganger.pro | 8 ++-- src/doppelganger/main.cpp | 2 + src/doppelganger/powermanager.cpp | 88 +++++++++++++++++++++++++++++++++++++++ src/doppelganger/powermanager.h | 62 +++++++++++++++++++++++++++ 4 files changed, 157 insertions(+), 3 deletions(-) create mode 100644 src/doppelganger/powermanager.cpp create mode 100644 src/doppelganger/powermanager.h 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 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 + +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 &, + const String16 &, + const String16 &) +{ + return OK; +} + +status_t PowerManager::acquireWakeLockWithUid(int, + const sp &, + const String16 &, + const String16 &, + int) +{ + return OK; +} + +status_t PowerManager::updateWakeLockUids(const sp &, + int, + const int *) +{ + return OK; +} +#else // < 4.4 +status_t PowerManager::acquireWakeLock(int, const sp &, const String16 &) +{ + return OK; +} +#endif + +status_t PowerManager::releaseWakeLock(const sp &, 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 + +namespace android { + +typedef BnInterface 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& lock, + const android::String16& tag, + const android::String16& packageName); + virtual android::status_t acquireWakeLockWithUid(int flags, + const android::sp& lock, + const android::String16& tag, + const android::String16& packageName, + int uid); + virtual android::status_t updateWakeLockUids(const android::sp& lock, + int len, + const int *uids); +#else // < 4.4 + virtual android::status_t acquireWakeLock(int flags, + const android::sp& lock, + const android::String16& tag); +#endif + + virtual android::status_t releaseWakeLock(const android::sp& lock, int flags); +}; + +#endif // POWERMANAGER_H -- cgit v1.2.3 From e2eb3c6769b9e10e626d50d24460c40ef9faaeef Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Fri, 9 May 2014 13:05:25 +0200 Subject: Doc: Use precise naming for Boundary Devices i.MX6 Change-Id: Ic1a9dfaa2dc302b7e2b8b54a00515dfc050edca0 Reviewed-by: Samuli Piippo Reviewed-by: Kalle Viironen --- src/doc/src/b2qt.qdoc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/doc/src/b2qt.qdoc b/src/doc/src/b2qt.qdoc index 394eb44..2973d91 100644 --- a/src/doc/src/b2qt.qdoc +++ b/src/doc/src/b2qt.qdoc @@ -44,7 +44,7 @@ \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 BD-SL-i.MX6}{BD-SL-i.MX6 (embedded Android and 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)} @@ -306,7 +306,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)} @@ -488,19 +488,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 @@ -922,7 +922,7 @@ 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 + On some devices, for example the BD-SL-i.MX6, 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. @@ -1381,7 +1381,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 -- cgit v1.2.3 From ac8170f843f40968c96bd7b21dc4857274e3eef6 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Fri, 9 May 2014 14:22:49 +0200 Subject: Doc: QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS replaces QT_QPA_GENERIC_PLUGINS Change-Id: I38bccdf395f5ccc280fba37f8b6abbaea64391d7 Reviewed-by: Eirik Aavitsland Reviewed-by: Samuli Piippo --- src/doc/src/b2qt.qdoc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/doc/src/b2qt.qdoc b/src/doc/src/b2qt.qdoc index 2973d91..a254d0e 100644 --- a/src/doc/src/b2qt.qdoc +++ b/src/doc/src/b2qt.qdoc @@ -911,7 +911,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 @@ -923,8 +923,9 @@ time. On some devices, for example the BD-SL-i.MX6, 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. + 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 -- cgit v1.2.3 From 37768773b6d384c5c4468c48b41290416fafa596 Mon Sep 17 00:00:00 2001 From: Rainer Keller Date: Thu, 8 May 2014 15:07:59 +0200 Subject: Doc: Add table with all possible MACHINE values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I8e5609065e41b0690ab29cedbcbba7903c7b3df3 Reviewed-by: Samuli Piippo Reviewed-by: Topi Reiniö --- src/doc/src/b2qt.qdoc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/doc/src/b2qt.qdoc b/src/doc/src/b2qt.qdoc index a254d0e..4988392 100644 --- a/src/doc/src/b2qt.qdoc +++ b/src/doc/src/b2qt.qdoc @@ -1060,6 +1060,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. -- cgit v1.2.3 From 383deca7433d3cad4719028a6fa4d5bbc4a2295f Mon Sep 17 00:00:00 2001 From: Rainer Keller Date: Wed, 7 May 2014 15:31:03 +0200 Subject: Doc: Update version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I5160cccc267d81b41810080f0b912f8d2dd13d7c Reviewed-by: Topi Reiniö Reviewed-by: Kalle Viironen --- src/doc/src/b2qt.qdoc | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/doc/src/b2qt.qdoc b/src/doc/src/b2qt.qdoc index 4988392..b2e2170 100644 --- a/src/doc/src/b2qt.qdoc +++ b/src/doc/src/b2qt.qdoc @@ -365,9 +365,9 @@ \badcode cd - 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 +389,7 @@ {https://developers.google.com/android/nexus/drivers#grouperjdq39} \badcode cd - ./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 +402,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 +416,7 @@ \endcode \li Deploy the drivers to your device: \badcode - ./Boot2Qt-2.x/nexus7-eAndroid/images/deploy.sh + ./Boot2Qt-3.x/nexus7-eAndroid/images/deploy.sh \endcode \endlist @@ -469,7 +469,7 @@ \badcode cd - sudo Boot2Qt-2.x/beagleboard-eLinux/images/deploy.sh /dev/ + sudo Boot2Qt-3.x/beagleboard-eLinux/images/deploy.sh /dev/ \endcode After the image has been deployed, power on the device and check that @@ -556,12 +556,12 @@ \li \b{\B2QA} \badcode cd - ./Boot2Qt-2.x/iMX6-eAndroid/images/deploy.sh /dev/ + ./Boot2Qt-3.x/iMX6-eAndroid/images/deploy.sh /dev/ \endcode \li \b{\B2QL} \badcode cd - sudo ./Boot2Qt-2.x/iMX6-eLinux/images/deploy.sh /dev/ + sudo ./Boot2Qt-3.x/iMX6-eLinux/images/deploy.sh /dev/ \endcode \endlist @@ -618,7 +618,7 @@ \badcode cd - sudo Boot2Qt-2.x/raspberrypi-eLinux/images/deploy.sh /dev/ + sudo Boot2Qt-3.x/raspberrypi-eLinux/images/deploy.sh /dev/ \endcode After the image has been deployed, insert the SD card, power on the device and check that @@ -692,12 +692,12 @@ \li \b{\B2QA} \badcode cd - ./Boot2Qt-2.x/beaglebone-eAndroid/images/deploy.sh /dev/ + ./Boot2Qt-3.x/beaglebone-eAndroid/images/deploy.sh /dev/ \endcode \li \b{\B2QL} \badcode cd - sudo ./Boot2Qt-2.x/beaglebone-eLinux/images/deploy.sh /dev/ + sudo ./Boot2Qt-3.x/beaglebone-eLinux/images/deploy.sh /dev/ \endcode \endlist @@ -1045,7 +1045,7 @@ \badcode cd - /Boot2Qt-2.x/sources/b2qt-yocto-meta/b2qt-init-build-env . + /Boot2Qt-3.x/sources/b2qt-yocto-meta/b2qt-init-build-env . \endcode \section1 Building the Image and Toolchain @@ -1106,7 +1106,7 @@ script. Using Raspberry Pi as an example: \badcode - /Boot2Qt-2.x/sources/b2qt-build-scripts/embedded-common/init_build_env.sh /Boot2Qt-2.x/sources/b2qt-build-scripts/embedded-linux/config.raspberrypi + /Boot2Qt-3.x/sources/b2qt-build-scripts/embedded-common/init_build_env.sh /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. @@ -1115,9 +1115,9 @@ You can use following scripts to build different parts of the \B2Q stack. \badcode - /Boot2Qt-2.x/sources/b2qt-build-scripts/embedded-linux/build_qt.sh - /Boot2Qt-2.x/sources/b2qt-build-scripts/embedded-linux/build_extras.sh - /Boot2Qt-2.x/sources/b2qt-build-scripts/embedded-linux/build_image.sh + /Boot2Qt-3.x/sources/b2qt-build-scripts/embedded-linux/build_qt.sh + /Boot2Qt-3.x/sources/b2qt-build-scripts/embedded-linux/build_extras.sh + /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 @@ -1129,7 +1129,7 @@ developing for your device. The following script does this for you. \badcode - /Boot2Qt-2.x/sources/b2qt-build-scripts/embedded-common/setup_qtcreator.sh + /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 -- cgit v1.2.3 From 3022f83d1f7726bddbec3ca469baa3a6ecdde8ae Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 15 May 2014 11:49:47 +0200 Subject: Add a note about webengine and emulator Change-Id: Id436455971a6278a57f2cf0c59bae0d74763d5ad Reviewed-by: Andras Becsi Reviewed-by: Kalle Viironen --- src/doc/src/b2qt.qdoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/doc/src/b2qt.qdoc b/src/doc/src/b2qt.qdoc index b2e2170..7c5863f 100644 --- a/src/doc/src/b2qt.qdoc +++ b/src/doc/src/b2qt.qdoc @@ -1558,6 +1558,10 @@ 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. */ /*! -- cgit v1.2.3 From 31f6f73a691ff49fc3aeba062f8561e6c981baff Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Fri, 28 Mar 2014 13:32:05 +0100 Subject: 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 --- src/imports/wifi/pluginmain.cpp | 24 +-- src/imports/wifi/qwifi_elinux.cpp | 264 +++++++++++++++++++++++++++++ src/imports/wifi/qwifi_elinux.h | 34 ++++ src/imports/wifi/qwifimanager.cpp | 75 +++++++- src/imports/wifi/qwifimanager.h | 30 +++- src/imports/wifi/qwifinetworklistmodel.cpp | 13 +- src/imports/wifi/wifi.pro | 23 ++- 7 files changed, 433 insertions(+), 30 deletions(-) create mode 100644 src/imports/wifi/qwifi_elinux.cpp create mode 100644 src/imports/wifi/qwifi_elinux.h 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 +#include #include #include #include +#ifdef Q_OS_ANDROID #include - +#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; } }; 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 + +#include "wpa-supplicant/wpa_ctrl.h" + +#include +#include +#include + +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 CTRL-EVENT-XXX + * or + * 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 + +// 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 7615f70..6e5e245 100644 --- a/src/imports/wifi/qwifimanager.cpp +++ b/src/imports/wifi/qwifimanager.cpp @@ -19,10 +19,13 @@ #include "qwifimanager.h" #include - +#ifdef Q_OS_ANDROID #include #include #include +#else +#include +#endif static const char SUPPLICANT_SVC[] = "init.svc.wpa_supplicant"; static const char WIFI_INTERFACE[] = "wifi.interface"; @@ -34,6 +37,7 @@ 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 */ @@ -125,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 { @@ -410,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) { @@ -444,15 +457,22 @@ QWifiManager::QWifiManager() disconnectFromBackend(); } } +#else + m_backendReady = false; + emit backendReadyChanged(); +#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()) { @@ -487,6 +507,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() { @@ -506,22 +534,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; } +#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; } +#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; @@ -538,7 +575,12 @@ void QWifiManager::disconnectFromBackend() if (q_wifi_stop_supplicant() < 0) qWarning("QWifiManager: failed to stop supplicant"); 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(); } @@ -633,7 +675,6 @@ void QWifiManager::connect(QWifiNetwork *network, const QString &passphrase) return; } updateNetworkState(Authenticating); - call("DISABLE_NETWORK all"); if (!m_connectedSSID.isEmpty()) { m_connectedSSID.clear(); @@ -695,13 +736,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 lists = call("LIST_NETWORKS").split('\n'); @@ -732,6 +795,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 +#include #include -#include +#ifdef Q_OS_ANDROID +#include #include +#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) - -- cgit v1.2.3 From f0a5a1bcd4224fb98f88559fd211644f2f67b392 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Fri, 16 May 2014 09:22:03 +0200 Subject: Set initial "backend ready" state. Change-Id: Id1d7141cbbee181235093627cf18180354a78a6b Reviewed-by: Kalle Viironen --- src/imports/wifi/qwifimanager.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/imports/wifi/qwifimanager.cpp b/src/imports/wifi/qwifimanager.cpp index 6e5e245..65073f1 100644 --- a/src/imports/wifi/qwifimanager.cpp +++ b/src/imports/wifi/qwifimanager.cpp @@ -456,10 +456,12 @@ QWifiManager::QWifiManager() // same here, cleans up the state disconnectFromBackend(); } + } else { +#endif + m_backendReady = false; + emit backendReadyChanged(); +#ifdef Q_OS_ANDROID } -#else - m_backendReady = false; - emit backendReadyChanged(); #endif } -- cgit v1.2.3 From 81db2dd1ee852678e8e596ef5ee58bc9ed456b19 Mon Sep 17 00:00:00 2001 From: aavit Date: Fri, 16 May 2014 14:40:04 +0200 Subject: Doc: Add setup instructions for Nexus 7 (2013) Change-Id: I3d6dbb2376d86f66d195b9bd9a313ac2aaa62cf8 Reviewed-by: Jerome Pasion --- src/doc/src/b2qt.qdoc | 66 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 60 insertions(+), 6 deletions(-) diff --git a/src/doc/src/b2qt.qdoc b/src/doc/src/b2qt.qdoc index 7c5863f..0ef20e3 100644 --- a/src/doc/src/b2qt.qdoc +++ b/src/doc/src/b2qt.qdoc @@ -43,7 +43,8 @@ \li \l{Supported Platforms} \li \l{Preparing Hardware} \list - \li \l{Preparing Nexus 7}{Nexus 7 (2012) (embedded Android)} + \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 BeagleBone Black}{BeagleBone Black (embedded Android and Linux)} \li \l{Preparing BeagleBoard-xM}{BeagleBoard-xM (embedded Linux)} @@ -316,10 +317,63 @@ and continue straight to \l {Building and Running an Example}. */ +/*! + \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. + + \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 + ./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 +381,7 @@ \l{http://www.google.com/nexus/7/specs/}{Nexus 7 (2012)} for \B2Q. - \section1 Unlocking Nexus 7 Bootloader + \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 +403,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. @@ -1176,7 +1230,7 @@ \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://www.google.com/nexus/7/specs/}{Google/Asus Nexus 7 (2012 and 2013 models)} \li \l{http://beagleboard.org/hardware-xM}{BeagleBoard-xM} \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)} -- cgit v1.2.3 From a48c8f02245f76542ab52550f67b60c6cc166451 Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Fri, 16 May 2014 16:40:26 +0300 Subject: doc: include sabre sd documentation Change-Id: Iabd01f452d5c93c47387d439eba4a8fc63f79e1d Reviewed-by: Jerome Pasion Reviewed-by: Kalle Viironen Reviewed-by: Eirik Aavitsland --- src/doc/src/b2qt.qdoc | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/doc/src/b2qt.qdoc b/src/doc/src/b2qt.qdoc index 0ef20e3..3f7d231 100644 --- a/src/doc/src/b2qt.qdoc +++ b/src/doc/src/b2qt.qdoc @@ -46,6 +46,7 @@ \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)} @@ -634,6 +635,57 @@ see \l{Building and Running an Example}. */ +/*! + \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 + sudo Boot2Qt-3.x/imx6sabresd-eLinux/images/deploy.sh /dev/ + \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 -- cgit v1.2.3 From d1fb7218787caa7393607c7aa8fed95bcfe34e37 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Mon, 19 May 2014 11:06:43 +0200 Subject: Doc: add change log for version 3.0.0 Change-Id: Id4d9a924200102c50083743bb7c63f76f60a32e4 Reviewed-by: Kalle Viironen --- src/doc/src/b2qt.qdoc | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/doc/src/b2qt.qdoc b/src/doc/src/b2qt.qdoc index 3f7d231..28c45c6 100644 --- a/src/doc/src/b2qt.qdoc +++ b/src/doc/src/b2qt.qdoc @@ -1353,7 +1353,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 -- cgit v1.2.3 From fc6af7440dfacfa97640b4d179b1306082eaf51d Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 19 May 2014 13:55:02 +0200 Subject: Doc: add note about webengine's widget apis Change-Id: Idfd4692f125f64da4d49d1cb5528607979db03df Reviewed-by: Kalle Viironen Reviewed-by: Andras Becsi --- src/doc/src/b2qt.qdoc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/doc/src/b2qt.qdoc b/src/doc/src/b2qt.qdoc index 28c45c6..2bf3897 100644 --- a/src/doc/src/b2qt.qdoc +++ b/src/doc/src/b2qt.qdoc @@ -1705,6 +1705,12 @@ 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 QWebView, will become supported in future releases. + For the time being, use the WebView QML element. */ /*! -- cgit v1.2.3 From a23036aec3188197c3c8d469cd785c9a812f6616 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 19 May 2014 14:08:47 +0200 Subject: Fix class names for WebEngine Change-Id: I96f27eb348f6aa02e26c567d81349905aed2cec0 Reviewed-by: Jocelyn Turcotte --- src/doc/src/b2qt.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/src/b2qt.qdoc b/src/doc/src/b2qt.qdoc index 2bf3897..7423178 100644 --- a/src/doc/src/b2qt.qdoc +++ b/src/doc/src/b2qt.qdoc @@ -1709,8 +1709,8 @@ \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 QWebView, will become supported in future releases. - For the time being, use the WebView QML element. + The QWidget-based equivalents, like QWebEngineView, will become supported in future releases. + For the time being, use the WebEngineView QML element. */ /*! -- cgit v1.2.3 From 26c94a0c7fb55d9b52b33d29477763df425fed35 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Mon, 19 May 2014 14:27:53 +0200 Subject: Don't show Wi-Fi group box on iMX6-eAndroid This device currently does not support wifi. Change-Id: I8048d7109908c4c2de553dda119cb14be73ef6a7 Reviewed-by: Eirik Aavitsland --- src/imports/wifi/pluginmain.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/imports/wifi/pluginmain.cpp b/src/imports/wifi/pluginmain.cpp index 6dc6cc9..51a2e7c 100644 --- a/src/imports/wifi/pluginmain.cpp +++ b/src/imports/wifi/pluginmain.cpp @@ -66,18 +66,19 @@ public: Q_INVOKABLE bool wifiSupported() const { - bool supported = false; + 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 (wifi_load_driver() == 0 && wifi_start_supplicant(0) == 0) - supported = true; - else + if (hasInterface && wifi_load_driver() == 0 && wifi_start_supplicant(0) == 0) { + return true; + } else { qWarning() << "QWifiGlobal: wifi driver is not available"; + return false; + } #else - supported = QDir().exists(QStringLiteral("/sys/class/net/wlan0")); - if (!supported) - qWarning() << "QWifiGlobal: could not find wifi interface in /sys/class/net/"; + return hasInterface; #endif - return supported; } }; -- cgit v1.2.3 From 0884d79a7c89318e257bc59a4c6a83cd021e8b1b Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Mon, 19 May 2014 17:56:30 +0200 Subject: Build wifi also on eLinux It turns out that wifi was never build on eLinux. Change-Id: I27b3f01761b9aaa6f70d0ff4220344551a39ad56 Reviewed-by: Samuli Piippo Reviewed-by: Laszlo Agocs --- src/imports/imports.pro | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 -- cgit v1.2.3 From 8136f448fefbf78dbfee2a53e44e8840823173cc Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Wed, 21 May 2014 09:38:19 +0300 Subject: doc: move adb connection change info to customization This should be under customization and not under build your own embedded linux. Change-Id: Idcc5723b43cdff4d74f75f562f4265bf7abd4555 Reviewed-by: Kalle Viironen Reviewed-by: Eirik Aavitsland --- src/doc/src/b2qt.qdoc | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/doc/src/b2qt.qdoc b/src/doc/src/b2qt.qdoc index 7423178..b06929e 100644 --- a/src/doc/src/b2qt.qdoc +++ b/src/doc/src/b2qt.qdoc @@ -1101,6 +1101,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 + /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 */ /*! @@ -1241,23 +1258,6 @@ 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 - /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 */ /*! -- cgit v1.2.3 From 65ba0ea65a573f1049eb574e3272da93bb47f010 Mon Sep 17 00:00:00 2001 From: aavit Date: Wed, 21 May 2014 10:25:34 +0200 Subject: Doc: Warn the user that his Nexus will be wiped. Change-Id: I51b1435cfd42ddc598a9f82de6fe76e4e1f8d6c1 Reviewed-by: Jerome Pasion --- src/doc/src/b2qt.qdoc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/doc/src/b2qt.qdoc b/src/doc/src/b2qt.qdoc index b06929e..067ffc1 100644 --- a/src/doc/src/b2qt.qdoc +++ b/src/doc/src/b2qt.qdoc @@ -329,6 +329,10 @@ \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 @@ -382,6 +386,10 @@ \l{http://www.google.com/nexus/7/specs/}{Nexus 7 (2012)} 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 Unlocking Nexus 7 (2012) Bootloader You must unlock the Nexus 7 Bootloader to be able to install custom -- cgit v1.2.3 From 366d1832c715789b6734847b2eb079b9a2f40af1 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Wed, 21 May 2014 12:32:25 +0200 Subject: doc: Updated links to Qt EE known issues and product page -fixes broken links -pages moved Task-number: QTEE-571 Change-Id: Icb3ba61d374edf1bcc44e46fd8e296bdf1736f20 Reviewed-by: Kalle Viironen --- src/doc/src/b2qt-external-pages.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 */ -- cgit v1.2.3 From bee1c07094a77779b6e8ec54071901d5ce6ed703 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Wed, 21 May 2014 12:16:09 +0200 Subject: doc: Updated versions and supported platforms -updated support info for Beagleboard-XM (only supported in 2.x) -updated Yocto version to 1.6 "Daisy" -updated toolchain version to toolchain-1.6.sh Task-number: QTEE-571 Change-Id: I771effbeb258262eff7141c7c1bdd11b40d0d2dd Reviewed-by: Eirik Aavitsland Reviewed-by: Kalle Viironen --- src/doc/src/b2qt.qdoc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/doc/src/b2qt.qdoc b/src/doc/src/b2qt.qdoc index 067ffc1..2f32716 100644 --- a/src/doc/src/b2qt.qdoc +++ b/src/doc/src/b2qt.qdoc @@ -114,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. @@ -509,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. @@ -900,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. @@ -1063,7 +1063,7 @@ application in QML. \qml - import QtQuick 2.0 + import QtQuick 2.2 Item { id: root @@ -1224,7 +1224,7 @@ \endcode The target rootfs image is located in the \c /tmp/deploy/images//b2qt-embedded-image-.tar.gz, - and the new toolchain is in \c /tmp/deploy/sdk/b2qt-eglibc-x86_64-meta-toolchain-b2qt-embedded-sdk--toolchain-1.5.sh + and the new toolchain is in \c /tmp/deploy/sdk/b2qt-eglibc-x86_64-meta-toolchain-b2qt-embedded-sdk--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. @@ -1291,12 +1291,15 @@ \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 and 2013 models)} - \li \l{http://beagleboard.org/hardware-xM}{BeagleBoard-xM} \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). -- cgit v1.2.3 From 5c160b6fe916e5605eaa1fd8394b62527ff9f997 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 21 May 2014 13:59:51 +0200 Subject: Add notes about Quick Compiler failures Change-Id: I04ff434e652ed22615b7f9829585fd69ea638f5a Reviewed-by: Kalle Viironen --- src/doc/src/b2qt.qdoc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/doc/src/b2qt.qdoc b/src/doc/src/b2qt.qdoc index 2f32716..ab72787 100644 --- a/src/doc/src/b2qt.qdoc +++ b/src/doc/src/b2qt.qdoc @@ -1722,6 +1722,17 @@ 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. */ /*! -- cgit v1.2.3