diff --git a/testing/sensorfw/0001-fix-32-bit-build.patch b/testing/sensorfw/0001-fix-32-bit-build.patch new file mode 100644 index 00000000000..0e4bf825fcd --- /dev/null +++ b/testing/sensorfw/0001-fix-32-bit-build.patch @@ -0,0 +1,183 @@ +diff --git a/adaptors/accelerometeradaptor/accelerometeradaptor.cpp b/adaptors/accelerometeradaptor/accelerometeradaptor.cpp +index 83da2f4..70dac6b 100644 +--- a/adaptors/accelerometeradaptor/accelerometeradaptor.cpp ++++ b/adaptors/accelerometeradaptor/accelerometeradaptor.cpp +@@ -102,7 +102,7 @@ void AccelerometerAdaptor::commitOutput(struct input_event *ev) + { + AccelerationData* 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_; +diff --git a/adaptors/alsadaptor-evdev/alsevdevadaptor.cpp b/adaptors/alsadaptor-evdev/alsevdevadaptor.cpp +index b64549b..3d0e246 100644 +--- a/adaptors/alsadaptor-evdev/alsevdevadaptor.cpp ++++ b/adaptors/alsadaptor-evdev/alsevdevadaptor.cpp +@@ -79,7 +79,7 @@ void ALSAdaptorEvdev::commitOutput(struct input_event *ev) + TimedUnsigned* lux = alsBuffer_->nextSlot(); + lux->value_ = alsValue_; + +- lux->timestamp_ = Utils::getTimeStamp(&(ev->time)); ++ lux->timestamp_ = Utils::getTimeStamp(ev); + + alsBuffer_->commit(); + alsBuffer_->wakeUpReaders(); +diff --git a/adaptors/gyroscopeadaptor-evdev/gyroevdevadaptor.cpp b/adaptors/gyroscopeadaptor-evdev/gyroevdevadaptor.cpp +index 6783281..6b82890 100644 +--- a/adaptors/gyroscopeadaptor-evdev/gyroevdevadaptor.cpp ++++ b/adaptors/gyroscopeadaptor-evdev/gyroevdevadaptor.cpp +@@ -88,7 +88,7 @@ void GyroAdaptorEvdev::commitOutput(struct input_event *ev) + gyroData->y_ = gyroValue_.y_; + gyroData->z_ = gyroValue_.z_; + +- gyroData->timestamp_ = Utils::getTimeStamp(&(ev->time)); ++ gyroData->timestamp_ = Utils::getTimeStamp(ev); + + gyroscopeBuffer_->commit(); + gyroscopeBuffer_->wakeUpReaders(); +diff --git a/adaptors/humidityadaptor/humidityadaptor.cpp b/adaptors/humidityadaptor/humidityadaptor.cpp +index be348d3..2fcc68b 100644 +--- a/adaptors/humidityadaptor/humidityadaptor.cpp ++++ b/adaptors/humidityadaptor/humidityadaptor.cpp +@@ -76,7 +76,7 @@ void HumidityAdaptor::commitOutput(struct input_event *ev) + TimedUnsigned* rh = humidityBuffer_->nextSlot(); + rh->value_ = humidityValue_; + +- rh->timestamp_ = Utils::getTimeStamp(&(ev->time)); ++ rh->timestamp_ = Utils::getTimeStamp(ev); + + humidityBuffer_->commit(); + humidityBuffer_->wakeUpReaders(); +diff --git a/adaptors/lidsensoradaptor-evdev/lidsensoradaptor-evdev.cpp b/adaptors/lidsensoradaptor-evdev/lidsensoradaptor-evdev.cpp +index aa02fa8..e737897 100644 +--- a/adaptors/lidsensoradaptor-evdev/lidsensoradaptor-evdev.cpp ++++ b/adaptors/lidsensoradaptor-evdev/lidsensoradaptor-evdev.cpp +@@ -125,7 +125,7 @@ void LidSensorAdaptorEvdev::commitOutput(struct input_event *ev) + + LidData *lidData = lidBuffer_->nextSlot(); + +- lidData->timestamp_ = Utils::getTimeStamp(&(ev->time)); ++ lidData->timestamp_ = Utils::getTimeStamp(ev); + lidData->value_ = currentValue_; + lidData->type_ = currentType_; + sensordLogD() << "Lid state change detected: " +diff --git a/adaptors/magnetometeradaptor-evdev/magnetometerevdevadaptor.cpp b/adaptors/magnetometeradaptor-evdev/magnetometerevdevadaptor.cpp +index 20d2e41..f4eb498 100644 +--- a/adaptors/magnetometeradaptor-evdev/magnetometerevdevadaptor.cpp ++++ b/adaptors/magnetometeradaptor-evdev/magnetometerevdevadaptor.cpp +@@ -87,7 +87,7 @@ void MagAdaptorEvdev::commitOutput(struct input_event *ev) + magData->y_ = magValue_.y_; + magData->z_ = magValue_.z_; + +- magData->timestamp_ = Utils::getTimeStamp(&(ev->time)); ++ magData->timestamp_ = Utils::getTimeStamp(ev); + + magnetometerBuffer_->commit(); + magnetometerBuffer_->wakeUpReaders(); +diff --git a/adaptors/pressureadaptor/pressureadaptor.cpp b/adaptors/pressureadaptor/pressureadaptor.cpp +index 0684714..861a0fb 100644 +--- a/adaptors/pressureadaptor/pressureadaptor.cpp ++++ b/adaptors/pressureadaptor/pressureadaptor.cpp +@@ -76,7 +76,7 @@ void PressureAdaptor::commitOutput(struct input_event *ev) + TimedUnsigned* lux = pressureBuffer_->nextSlot(); + lux->value_ = pressureValue_; + +- lux->timestamp_ = Utils::getTimeStamp(&(ev->time)); ++ lux->timestamp_ = Utils::getTimeStamp(ev); + + pressureBuffer_->commit(); + pressureBuffer_->wakeUpReaders(); +diff --git a/adaptors/proximityadaptor-evdev/proximityadaptor-evdev.cpp b/adaptors/proximityadaptor-evdev/proximityadaptor-evdev.cpp +index 4c01f87..86d32eb 100644 +--- a/adaptors/proximityadaptor-evdev/proximityadaptor-evdev.cpp ++++ b/adaptors/proximityadaptor-evdev/proximityadaptor-evdev.cpp +@@ -84,7 +84,7 @@ void ProximityAdaptorEvdev::commitOutput(struct input_event *ev) + + ProximityData *proximityData = proximityBuffer_->nextSlot(); + +- proximityData->timestamp_ = Utils::getTimeStamp(&(ev->time)); ++ proximityData->timestamp_ = Utils::getTimeStamp(ev); + proximityData->withinProximity_ = currentState_; + + oldState = currentState_; +diff --git a/adaptors/tapadaptor/tapadaptor.cpp b/adaptors/tapadaptor/tapadaptor.cpp +index 65d7b99..9f853e4 100644 +--- a/adaptors/tapadaptor/tapadaptor.cpp ++++ b/adaptors/tapadaptor/tapadaptor.cpp +@@ -69,7 +69,7 @@ void TapAdaptor::interpretEvent(int src, struct input_event *ev) + } + TapData tapValue; + tapValue.direction_ = dir; +- tapValue.timestamp_ = Utils::getTimeStamp(&(ev->time)); ++ tapValue.timestamp_ = Utils::getTimeStamp(ev); + tapValue.type_ = TapData::SingleTap; + + commitOutput(tapValue); +diff --git a/adaptors/temperatureadaptor/temperatureadaptor.cpp b/adaptors/temperatureadaptor/temperatureadaptor.cpp +index 08eea51..39287ad 100644 +--- a/adaptors/temperatureadaptor/temperatureadaptor.cpp ++++ b/adaptors/temperatureadaptor/temperatureadaptor.cpp +@@ -76,7 +76,7 @@ void TemperatureAdaptor::commitOutput(struct input_event *ev) + TimedUnsigned* temp = temperatureBuffer_->nextSlot(); + temp->value_ = temperatureValue_; + +- temp->timestamp_ = Utils::getTimeStamp(&(ev->time)); ++ temp->timestamp_ = Utils::getTimeStamp(ev); + + temperatureBuffer_->commit(); + temperatureBuffer_->wakeUpReaders(); +diff --git a/adaptors/touchadaptor/touchadaptor.cpp b/adaptors/touchadaptor/touchadaptor.cpp +index 6c15147..df589c8 100644 +--- a/adaptors/touchadaptor/touchadaptor.cpp ++++ b/adaptors/touchadaptor/touchadaptor.cpp +@@ -156,7 +156,7 @@ void TouchAdaptor::commitOutput(int src, struct input_event *ev) + { + TouchData* d = outputBuffer_->nextSlot(); + +- d->timestamp_ = Utils::getTimeStamp(&(ev->time)); ++ d->timestamp_ = Utils::getTimeStamp(ev); + d->x_ = touchValues_[src].x; + d->y_ = touchValues_[src].y; + d->z_ = touchValues_[src].z; +diff --git a/datatypes/utils.cpp b/datatypes/utils.cpp +index 0bd9d5c..678ea97 100644 +--- a/datatypes/utils.cpp ++++ b/datatypes/utils.cpp +@@ -71,10 +71,10 @@ quint64 Utils::getTimeStamp() + return data; + } + +-quint64 Utils::getTimeStamp(const struct timeval *tp) ++quint64 Utils::getTimeStamp(const struct input_event *ie) + { +- quint64 data = tp->tv_sec; ++ quint64 data = ie->input_event_sec; + data = data * 1000000; +- data = tp->tv_usec + data; ++ data = ie->input_event_usec + data; + return data; + } +diff --git a/datatypes/utils.h b/datatypes/utils.h +index 120259c..d126bef 100644 +--- a/datatypes/utils.h ++++ b/datatypes/utils.h +@@ -27,7 +27,7 @@ + + #ifndef UTILS_H + #define UTILS_H +-#include ++#include + + /** + * Collection of static utility functions. +@@ -47,7 +47,7 @@ public: + * + * @return timestamp. + */ +- static quint64 getTimeStamp(const struct timeval*); ++ static quint64 getTimeStamp(const struct input_event*); + }; + + #endif // UTILS_H diff --git a/testing/sensorfw/APKBUILD b/testing/sensorfw/APKBUILD new file mode 100644 index 00000000000..9e1d9ca2d8d --- /dev/null +++ b/testing/sensorfw/APKBUILD @@ -0,0 +1,52 @@ +# Contributor: Bart Ribbers +# Maintainer: Bart Ribbers +pkgname=sensorfw +pkgver=0.12.4 +pkgrel=0 +pkgdesc="Sensorfw" +url="https://github.com/sailfishos/sensorfw" +arch="all" +license="LGPL-2.1-only" +depends="iio-sensor-proxy" +makedepends=" + doxygen + elogind-dev + eudev-dev + qt5-qtbase-dev + " +subpackages="$pkgname-dev $pkgname-doc $pkgname-openrc" +source="https://github.com/sailfishos/sensorfw/archive/$pkgver/sensorfw-$pkgver.tar.gz + 0001-fix-32-bit-build.patch + primaryuse.conf + sensorfw.initd + sensorfw.confd + " +options="!check" # Broken, fails to find symbols + +build() { + qmake-qt5 \ + PREFIX=/usr + make + + sed "s=@LIB@=lib=g" sensord-qt5.pc.in > sensord-qt5.pc +} + +check() { + make check +} + +package() { + make INSTALL_ROOT="$pkgdir" install + + install -Dm644 -t "$pkgdir"/etc/sensorfw "$srcdir"/primaryuse.conf + install -Dm755 "$srcdir"/sensorfw.initd "$pkgdir"/etc/init.d/sensorfw + install -Dm644 "$srcdir"/sensorfw.confd "$pkgdir"/etc/conf.d/sensorfw +} + +sha512sums=" +690b07898ed88a206f477fd6e06af029db546106403f02b0c8f191913713fec16f4e0183b2f447402ca04f6b1b08c2fadecdc2d24c449d9488ffb60ef26a09f4 sensorfw-0.12.4.tar.gz +44f332f137afdf4016e5e942c0c52cdccfeddb5ae74bcb16cef38c922bf4782eccb9349793ce7379cc5e7a939119c12368daf8afe4ed31b5da14c6fbf4c8a387 0001-fix-32-bit-build.patch +8e362f48fc5db58dc37d035f80f5ab0b09a20c82e6859e9662affdc192e2aa0bc7a259a9b0c63db330b3873d8b1f22af3f9193a0b7d79068354d1a788391376c primaryuse.conf +b78611957d1f25938978fdf34cf78318ff1764e0c3aa49fa79eb2e3c6f6eba1d2ac4f4f2dab84e4311a1b7dbbfd7e235b4919eb7a591a9720338eb81cfae04dc sensorfw.initd +b841282b96110ec59a7aa539db0737327b09549d55c78dc4b2c3b28b4a6ad1facf015b3175cb6d3a38f13e47aa6314ef3dc1514a4e60dd653a97409ec54ba706 sensorfw.confd +" diff --git a/testing/sensorfw/primaryuse.conf b/testing/sensorfw/primaryuse.conf new file mode 100644 index 00000000000..1dca2cb279d --- /dev/null +++ b/testing/sensorfw/primaryuse.conf @@ -0,0 +1,7 @@ +[plugins] +accelerometeradaptor = iiosensorsadaptor +orientationadaptor = iiosensorsadaptor +alsadaptor = iiosensorsadaptor +magnetometeradaptor = iiosensorsadaptor +gyroscopeadaptor = iiosensorsadaptor +proximityadaptor = iiosensorsadaptor diff --git a/testing/sensorfw/sensorfw.confd b/testing/sensorfw/sensorfw.confd new file mode 100644 index 00000000000..9bd312c0c00 --- /dev/null +++ b/testing/sensorfw/sensorfw.confd @@ -0,0 +1 @@ +supervisor=supervise-daemon diff --git a/testing/sensorfw/sensorfw.initd b/testing/sensorfw/sensorfw.initd new file mode 100644 index 00000000000..8feb179ad3a --- /dev/null +++ b/testing/sensorfw/sensorfw.initd @@ -0,0 +1,10 @@ +#!/sbin/openrc-run + +name="SensorFW" +description="Sensor Framework Qt5" + +command=/usr/sbin/sensorfwd + +depends() { + need udev +}