[-]
[+]
|
Changed |
_service:tar_git:sensorfw.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:sensorfw-qt5-binder.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -6,7 +6,7 @@
<service name="tar_git">
<param name="url">https://github.com/sailfishos/sensorfw.git</param>
<param name="branch">master</param>
- <param name="revision"/>
+ <param name="revision">b3224ffd16cf82f3f41d661d728b0afb45ce8af2</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-binder-0.12.7.tar.bz2/adaptors/adaptors.pro
^
|
@@ -1,18 +1,21 @@
TEMPLATE = subdirs
include( ../common-config.pri )
+
+HYBRIS_SUBDIRS = hybrisaccelerometer \
+ hybrisalsadaptor \
+ hybrisgyroscopeadaptor \
+ hybrismagnetometeradaptor \
+ hybrispressureadaptor \
+ hybrisproximityadaptor \
+ hybrisorientationadaptor \
+ hybrisrotationadaptor \
+ hybrisgeorotationadaptor \
+ hybrisstepcounteradaptor
+
# split like this as Sailfish only installs hybris plugins
contains(CONFIG,hybris) {
- SUBDIRS = hybrisaccelerometer
- SUBDIRS += hybrisalsadaptor
- SUBDIRS += hybrisgyroscopeadaptor
- SUBDIRS += hybrismagnetometeradaptor
- SUBDIRS += hybrispressureadaptor
- SUBDIRS += hybrisproximityadaptor
- SUBDIRS += hybrisorientationadaptor
- SUBDIRS += hybrisrotationadaptor
- SUBDIRS += hybrisgeorotationadaptor
- SUBDIRS += hybrisstepcounteradaptor
+ SUBDIRS += $$HYBRIS_SUBDIRS
} else {
@@ -39,6 +42,10 @@
SUBDIRS += pressureadaptor
SUBDIRS += temperatureadaptor
+config_hybris {
+ SUBDIRS += $$HYBRIS_SUBDIRS
+}
+
contains(CONFIG,legacy) {
SUBDIRS += mrstaccelerometer
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-binder-0.12.7.tar.bz2/adaptors/pegatronaccelerometeradaptor/pegatronaccelerometeradaptor.cpp
^
|
@@ -74,7 +74,7 @@
{
OrientationData* d = accelerometerBuffer_->nextSlot();
- d->timestamp_ = Utils::getTimeStamp(&(ev->time));
+ d->timestamp_ = Utils::getTimeStamp(ev);
d->x_ = orientationValue_.x_;
d->y_ = orientationValue_.y_;
d->z_ = orientationValue_.z_;
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-binder-0.12.7.tar.bz2/common-config.pri
^
|
@@ -44,3 +44,7 @@
}
}
+config_hybris {
+ CONFIG += link_pkgconfig
+ PKGCONFIG += android-headers libhardware
+}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-binder-0.12.7.tar.bz2/core/hybris.pro
^
|
@@ -13,14 +13,15 @@
DEPENDPATH += $$SENSORFW_INCLUDEPATHS
INCLUDEPATH += $$SENSORFW_INCLUDEPATHS
-QMAKE_LIBDIR_FLAGS += -lsensordatatypes-qt5
-
SOURCES += hybrisadaptor.cpp
HEADERS += hybrisadaptor.h
-LIBS += -L$$[QT_INSTALL_LIBS] -L../datatypes
+LIBS += -L$$[QT_INSTALL_LIBS] -L../datatypes -lsensordatatypes-qt5 -L. -lsensorfw-qt5
+
+CONFIG += link_pkgconfig
!contains(CONFIG,binder) {
- LIBS += -lhybris-common -lhardware
+ LIBS += -lhybris-common
+ PKGCONFIG += android-headers libhardware
}
include(../common-install.pri)
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-binder-0.12.7.tar.bz2/core/hybrisadaptor.cpp
^
|
@@ -148,6 +148,12 @@
* HybrisManager
* ========================================================================= */
+/* hybrisManager object is created on demand - which ought to happen
+ * well after QCoreApplication object has already been instantiated.
+ * Cleanup actions are executed on QCoreApplication::aboutToQuit signal.
+ * Destructor gets called after exit from main() and should be as
+ * close to nop as possible.
+ */
Q_GLOBAL_STATIC(HybrisManager, hybrisManager)
HybrisManager::HybrisManager(QObject *parent)
@@ -173,6 +179,11 @@
, m_indexOfType()
, m_indexOfHandle()
{
+ /* Arrange it so that sensors get stopped on exit from mainloop
+ */
+ connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit,
+ this, &HybrisManager::cleanup);
+
#ifdef USE_BINDER
startConnect();
#else
@@ -391,23 +402,56 @@
HybrisManager::~HybrisManager()
{
- cleanup();
-
-#ifdef USE_BINDER
- if (m_serviceManager) {
- gbinder_servicemanager_unref(m_serviceManager);
- m_serviceManager = NULL;
- }
-#endif
+ /* This is exectuted after exiting main() function.
+ * No actions that need core application, binder ipc,
+ * android hal libraries, etc should be made.
+ */
}
void HybrisManager::cleanup()
{
+ /* Stop any sensors that are active
+ */
+
sensordLogD() << "stop all sensors";
foreach (HybrisAdaptor *adaptor, m_registeredAdaptors.values()) {
adaptor->stopSensor();
}
+ /* Stop reacting to async events
+ */
+
+#ifdef USE_BINDER
+ gbinder_remote_object_remove_handler(m_remote, m_deathId);
+ m_deathId = 0;
+
+ if (m_pollTransactId) {
+ gbinder_client_cancel(m_client, m_pollTransactId);
+ m_pollTransactId = 0;
+
+ // The above code just marks down pending POLL transaction as
+ // to be cancelled later on when handler thread gets woken up.
+ //
+ // If we are exiting right after cleanup(), that is never going
+ // to happen and gbinder_ipc_exit() cleanup code blocks sensorfwd
+ // exit indefinitely.
+ //
+ // As a workaround: make a dummy POLL transaction, for which a
+ // reply is sent immediately, which then wakes up the handler
+ // thread, the cancellation gets processed and exit is unblocked.
+
+ GBinderLocalRequest *req = gbinder_client_new_request2(m_client, POLL);
+ int32_t status = 0;
+ gbinder_local_request_append_int32(req, 0);
+ GBinderRemoteReply *reply = gbinder_client_transact_sync_reply(m_client, POLL, req, &status);
+ gbinder_remote_reply_unref(reply);
+ gbinder_local_request_unref(req);
+ }
+
+ gbinder_local_object_unref(m_sensorCallback);
+ m_sensorCallback = NULL;
+#endif
+
if (m_eventReaderTid) {
sensordLogD() << "Canceling event reader thread";
int err = pthread_cancel(m_eventReaderTid);
@@ -436,40 +480,22 @@
}
}
-#ifdef USE_BINDER
- if (m_pollTransactId) {
- gbinder_client_cancel(m_client, m_pollTransactId);
- m_pollTransactId = 0;
- }
-
- if (m_sensorCallback) {
- gbinder_local_object_unref(m_sensorCallback);
- m_sensorCallback = NULL;
- }
+ /* Release remaining dynamic resources
+ */
- if (m_wakeLockQueue) {
- gbinder_fmq_unref(m_wakeLockQueue);
- m_wakeLockQueue = NULL;
- }
+#ifdef USE_BINDER
+ gbinder_fmq_unref(m_wakeLockQueue);
+ m_wakeLockQueue = NULL;
- if (m_eventQueue) {
- gbinder_fmq_unref(m_eventQueue);
- m_eventQueue = NULL;
- }
+ gbinder_fmq_unref(m_eventQueue);
+ m_eventQueue = NULL;
- if (m_client) {
- gbinder_client_unref(m_client);
- m_client = NULL;
- }
+ gbinder_client_unref(m_client);
+ m_client = NULL;
- if (m_remote) {
- if (m_deathId) {
- gbinder_remote_object_remove_handler(m_remote, m_deathId);
- m_deathId = 0;
- }
- gbinder_remote_object_unref(m_remote);
- m_remote = NULL;
- }
+ gbinder_servicemanager_unref(m_serviceManager);
+ m_serviceManager = NULL;
+ m_remote = NULL; // auto-release
for (int i = 0 ; i < m_sensorCount ; i++) {
g_free((void*)m_sensorArray[i].name.data.str);
@@ -648,7 +674,6 @@
if (m_remote) {
sensordLogD() << "Initialize sensor service";
- gbinder_remote_object_ref(m_remote);
m_deathId = gbinder_remote_object_add_death_handler(m_remote, binderDied, this);
m_client = gbinder_client_new2(m_remote, sensors_2_client_ifaces, G_N_ELEMENTS(sensors_2_client_ifaces));
if (!m_client) {
@@ -681,6 +706,7 @@
if (status != GBINDER_STATUS_OK) {
sensordLogW() << "Initialize failed with status" << status << ". Trying to reconnect.";
+ gbinder_remote_reply_unref(reply);
} else {
int error;
GBinderReader reader;
@@ -704,7 +730,6 @@
sensordLogD() << "Could not find remote object for sensor service. Trying to reconnect";
} else {
m_sensorInterfaceEnum = SENSOR_INTERFACE_1_0;
- gbinder_remote_object_ref(m_remote);
sensordLogD() << "Connected to sensor 1.0 service";
m_deathId = gbinder_remote_object_add_death_handler(m_remote, binderDied,
this);
@@ -1179,7 +1204,7 @@
// Process received events
int blockSuspend = 0;
bool errorInInput = false;
- manager->processEvents(buffer, numberOfEvents, blockSuspend, errorInInput);
+ manager->processEvents(buffer, eventsToRead, blockSuspend, errorInInput);
// Suspend proof sensor reporting that could occur in display off
if (blockSuspend) {
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-binder-0.12.7.tar.bz2/debian/changelog
^
|
@@ -1,3 +1,12 @@
+sensorfw-qt5 (0.12.7) unstable; urgency=medium
+
+ * [hybrisadaptor] Force cancellation of pending POLL transaction. JB#60298
+ * [hybrisadaptor] Read and process capped number of events. JB#60298
+ * [hybrisadaptor] Shuffle cleanup order. JB#60298
+ * [sendorfwd] Skip deadlocking libgbinder cleanup. Fixes JB#60298
+
+ -- Simo Piiroinen <simo.piiroinen@jolla.com> Mon, 20 Mar 2023 08:47:28 +0200
+
sensorfw-qt5 (0.12.6) unstable; urgency=medium
* [sensorfw] Add support for sensor binder API 2
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-binder-0.12.7.tar.bz2/sensord-qt5.pc.in
^
|
@@ -4,7 +4,7 @@
Name: Sensorfw-qt5
Description: Sensord for Qt 5
-Version: 0.12.6
+Version: 0.12.7
Requires:
Libs: -L${libdir} -lsensorclient-qt5 -lsensordatatypes-qt5
Cflags: -I${includedir} -I${includedir}/datatypes
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-binder-0.12.7.tar.bz2/sensord/main.cpp
^
|
@@ -287,7 +287,26 @@
sensordLogD() << "Exiting...";
SensorFrameworkConfig::close();
- return ret;
+
+ /* Backends that use binder ipc can end up deadlocked at
+ *
+ * void gbinder_ipc_exit(void)
+ * __attribute__((visibility("hidden")))
+ * __attribute__((destructor));
+ *
+ * due to a transaction of yet unknown origin that is never going
+ * to get finalized. Which them makes stopping of sensorfwd systemd
+ * service go via TERM-wait-timeout-KILL cycle.
+ *
+ * As a workaround to this we can skip all after-exit cleanup code
+ * by terminating via _exit() rather than exit() or return from
+ * main().
+ *
+ * And as sensorfwd itself does not and is not supposed to know
+ * whether backend uses binder ipc or not, we need to do this by
+ * default.
+ */
+ _exit(ret);
}
void printUsage()
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-binder-0.12.7.tar.bz2/tests/testutils/sensorfakeopen/sensorfakeopen.pro
^
|
@@ -4,6 +4,7 @@
DEPENDPATH += .
INCLUDEPATH += .
QT -= gui
+LIBS += -ldl
# Input
HEADERS += sensorfakeopen.h
|