1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-25 20:25:28 +03:00
aports/testing/sensorfw/0001-fix-32-bit-build.patch
2021-09-07 09:44:24 +02:00

183 lines
7.6 KiB
Diff

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 <sys/time.h>
+#include <linux/input.h>
/**
* 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