<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to use qt sensor in my arm device?]]></title><description><![CDATA[<p dir="auto">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?</p>
<p dir="auto">i noticed the note in /qt5sensors-5.6.1-1/src/plugins/sensors/linux/linuxsysaccelerometer.cpp<br />
#include "linuxsysaccelerometer.h"<br />
#include &lt;QtCore/QDebug&gt;<br />
#include &lt;QtCore/QtGlobal&gt;<br />
#include &lt;QtCore/QFile&gt;<br />
#include &lt;QtCore/QDebug&gt;<br />
#include &lt;QtCore/QTimer&gt;</p>
<p dir="auto">#include &lt;QtCore/QStringList&gt;</p>
<p dir="auto">#include &lt;time.h&gt;<br />
#include &lt;errno.h&gt;</p>
<p dir="auto">char const * const LinuxSysAccelerometer::id("linuxsys.accelerometer");</p>
<p dir="auto">// This plugin reads the accelerometer from a sys interface.</p>
<p dir="auto">// test machine (laptop):<br />
// QT_ACCEL_FILEPATH=/sys/devices/platform/lis3lv02d/position<br />
// QT_ACCEL_DATADIVISOR=7<br />
// QT_ACCEL_DELIMITER=,</p>
<p dir="auto">quint64 produceTimestamp()<br />
{<br />
struct timespec tv;<br />
int ok;</p>
<p dir="auto">#ifdef CLOCK_MONOTONIC_RAW<br />
ok = clock_gettime(CLOCK_MONOTONIC_RAW, &amp;tv);<br />
if (ok != 0)<br />
#endif<br />
ok = clock_gettime(CLOCK_MONOTONIC, &amp;tv);<br />
Q_ASSERT(ok == 0);</p>
<pre><code>quint64 result = (tv.tv_sec * 1000000ULL) + (tv.tv_nsec * 0.001); // scale to microseconds
return result;
</code></pre>
<p dir="auto">}</p>
<p dir="auto">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!!!</p>
]]></description><link>https://forum.qt.io/topic/77749/how-to-use-qt-sensor-in-my-arm-device</link><generator>RSS for Node</generator><lastBuildDate>Mon, 16 Mar 2026 11:08:55 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/77749.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 30 Mar 2017 06:48:32 GMT</pubDate><ttl>60</ttl></channel></rss>