How to use qt sensor in my arm device?
-
hi,guys! i am new to qt. english,compile,qt api everything is hard to me . my device has a 6-axis sensor(mpu6500),and i can get data from the sensor in kernel,but i don't how the qt sensor get the data from the kernel,and what kind of data type. now i can run sensor_explorer(a qt sensor examples) on my device, but it can't detect any sensor.what should i do?
i noticed the note in /qt5sensors-5.6.1-1/src/plugins/sensors/linux/linuxsysaccelerometer.cpp
#include "linuxsysaccelerometer.h"
#include <QtCore/QDebug>
#include <QtCore/QtGlobal>
#include <QtCore/QFile>
#include <QtCore/QDebug>
#include <QtCore/QTimer>#include <QtCore/QStringList>
#include <time.h>
#include <errno.h>char const * const LinuxSysAccelerometer::id("linuxsys.accelerometer");
// This plugin reads the accelerometer from a sys interface.
// test machine (laptop):
// QT_ACCEL_FILEPATH=/sys/devices/platform/lis3lv02d/position
// QT_ACCEL_DATADIVISOR=7
// QT_ACCEL_DELIMITER=,quint64 produceTimestamp()
{
struct timespec tv;
int ok;#ifdef CLOCK_MONOTONIC_RAW
ok = clock_gettime(CLOCK_MONOTONIC_RAW, &tv);
if (ok != 0)
#endif
ok = clock_gettime(CLOCK_MONOTONIC, &tv);
Q_ASSERT(ok == 0);quint64 result = (tv.tv_sec * 1000000ULL) + (tv.tv_nsec * 0.001); // scale to microseconds return result;
}
if i define environment variables "QT_ACCEL_FILEPATH=sys/devices/mpu6500",qtsensor will read sensor data from "sys/devices/mpu6500" ,but i don't know what kind of data type shoud be read from this sys interface.Feel free to critisize me,i need your help!!!