[-]
[+]
|
Changed |
_service:tar_git:sensorfw.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:sensorfw-qt5-hybris.spec
^
|
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/accelerometeradaptor/accelerometeradaptor.cpp
^
|
@@ -44,8 +44,8 @@
accelerometerBuffer_ = new DeviceAdaptorRingBuffer<OrientationData>(1);
setAdaptedSensor("accelerometer", "Internal accelerometer coordinates", accelerometerBuffer_);
setDescription("Input device accelerometer adaptor");
- powerStatePath_ = Config::configuration()->value("accelerometer/powerstate_path").toByteArray();
- accelMultiplier = Config::configuration()->value("accelerometer/multiplier", QVariant(1)).toReal();
+ powerStatePath_ = SensorFrameworkConfig::configuration()->value("accelerometer/powerstate_path").toByteArray();
+ accelMultiplier = SensorFrameworkConfig::configuration()->value("accelerometer/multiplier", QVariant(1)).toReal();
}
AccelerometerAdaptor::~AccelerometerAdaptor()
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/alsadaptor-ascii/alsadaptor-ascii.cpp
^
|
@@ -52,7 +52,7 @@
setDescription("Ambient light");
// Get range from a file, if the path is found in configuration
- QString rangeFilePath_ = Config::configuration()->value("als/range_file_path",QVariant("")).toString();
+ QString rangeFilePath_ = SensorFrameworkConfig::configuration()->value("als/range_file_path",QVariant("")).toString();
if (rangeFilePath_ != "") {
QFile sysFile(rangeFilePath_);
@@ -66,8 +66,8 @@
sensordLogT() << "Ambient light range: " << range;
}
}
- powerStatePath = Config::configuration()->value("als/powerstate_path").toByteArray();
- powerMode = Config::configuration()->value("als/mode").toByteArray();
+ powerStatePath = SensorFrameworkConfig::configuration()->value("als/powerstate_path").toByteArray();
+ powerMode = SensorFrameworkConfig::configuration()->value("als/mode").toByteArray();
}
ALSAdaptorAscii::~ALSAdaptorAscii()
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/alsadaptor-evdev/alsevdevadaptor.cpp
^
|
@@ -43,7 +43,7 @@
alsBuffer_ = new DeviceAdaptorRingBuffer<TimedUnsigned>(1);
setAdaptedSensor("als", "Internal ambient light sensor lux values", alsBuffer_);
setDescription("Input device als adaptor");
- powerStatePath_ = Config::configuration()->value("als/powerstate_path").toByteArray();
+ powerStatePath_ = SensorFrameworkConfig::configuration()->value("als/powerstate_path").toByteArray();
introduceAvailableDataRange(DataRange(0, 4095, 1));
setDefaultInterval(10);
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/alsadaptor/alsadaptor.cpp
^
|
@@ -62,8 +62,8 @@
alsBuffer_ = new DeviceAdaptorRingBuffer<TimedUnsigned>(1);
setAdaptedSensor("als", "Internal ambient light sensor lux values", alsBuffer_);
setDescription("Ambient light");
- deviceType_ = (DeviceType)Config::configuration()->value<int>("als/driver_type", DeviceUnknown);
- powerStatePath_ = Config::configuration()->value("als/powerstate_path").toByteArray();
+ deviceType_ = (DeviceType)SensorFrameworkConfig::configuration()->value<int>("als/driver_type", DeviceUnknown);
+ powerStatePath_ = SensorFrameworkConfig::configuration()->value("als/powerstate_path").toByteArray();
#ifdef SENSORFW_MCE_WATCHER
dbusIfc = new QDBusInterface(MCE_SERVICE, MCE_REQUEST_PATH, MCE_REQUEST_IF,
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/gyroscopeadaptor-evdev/gyroevdevadaptor.cpp
^
|
@@ -43,7 +43,7 @@
gyroscopeBuffer_ = new DeviceAdaptorRingBuffer<TimedXyzData>(1);
setAdaptedSensor("gyroscope", "Internal gyroscope values", gyroscopeBuffer_);
setDescription("Input device gyroscope adaptor");
- powerStatePath_ = Config::configuration()->value("gyroscope/powerstate_path").toByteArray();
+ powerStatePath_ = SensorFrameworkConfig::configuration()->value("gyroscope/powerstate_path").toByteArray();
// introduceAvailableDataRange(DataRange(0, 4095, 1));
setDefaultInterval(10);
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/gyroscopeadaptor/gyroscopeadaptor.cpp
^
|
@@ -41,7 +41,7 @@
gyroscopeBuffer_ = new DeviceAdaptorRingBuffer<TimedXyzData>(1);
setAdaptedSensor("gyroscope", "l3g4200dh", gyroscopeBuffer_);
setDescription("Sysfs Gyroscope adaptor (l3g4200dh)");
- dataRatePath_ = Config::configuration()->value("gyroscope/path_datarate").toByteArray();
+ dataRatePath_ = SensorFrameworkConfig::configuration()->value("gyroscope/path_datarate").toByteArray();
}
GyroscopeAdaptor::~GyroscopeAdaptor()
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/humidityadaptor/humidityadaptor.cpp
^
|
@@ -40,7 +40,7 @@
humidityBuffer_ = new DeviceAdaptorRingBuffer<TimedUnsigned>(1);
setAdaptedSensor("humidity", "Relative Humidity values", humidityBuffer_);
setDescription("Input device humidity adaptor");
- powerStatePath_ = Config::configuration()->value("humidity/powerstate_path").toByteArray();
+ powerStatePath_ = SensorFrameworkConfig::configuration()->value("humidity/powerstate_path").toByteArray();
introduceAvailableDataRange(DataRange(0, 4095, 1));
setDefaultInterval(10);
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/hybrisaccelerometer/hybrisaccelerometeradaptor.cpp
^
|
@@ -33,7 +33,7 @@
setAdaptedSensor("accelerometer", "Internal accelerometer coordinates", buffer);
setDescription("Hybris accelerometer");
- powerStatePath = Config::configuration()->value("accelerometer/powerstate_path").toByteArray();
+ powerStatePath = SensorFrameworkConfig::configuration()->value("accelerometer/powerstate_path").toByteArray();
// setDefaultInterval(50);
}
@@ -44,20 +44,19 @@
bool HybrisAccelerometerAdaptor::startSensor()
{
- if(!powerStatePath.isEmpty())
- writeToFile(powerStatePath, "1");
if (!(HybrisAdaptor::startSensor()))
return false;
-
+ if (isRunning() && !powerStatePath.isEmpty())
+ writeToFile(powerStatePath, "1");
sensordLogD() << "Hybris AccelAdaptor start\n";
return true;
}
void HybrisAccelerometerAdaptor::stopSensor()
{
- if(!powerStatePath.isEmpty())
- writeToFile(powerStatePath, "0");
HybrisAdaptor::stopSensor();
+ if (!isRunning() && !powerStatePath.isEmpty())
+ writeToFile(powerStatePath, "0");
sensordLogD() << "Hybris AccelAdaptor stop\n";
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/hybrisalsadaptor/hybrisalsadaptor.cpp
^
|
@@ -37,7 +37,7 @@
buffer = new DeviceAdaptorRingBuffer<TimedUnsigned>(1);
setAdaptedSensor("als", "Internal ambient light sensor lux values", buffer);
setDescription("Hybris als");
- powerStatePath = Config::configuration()->value("als/powerstate_path").toByteArray();
+ powerStatePath = SensorFrameworkConfig::configuration()->value("als/powerstate_path").toByteArray();
if (!powerStatePath.isEmpty() && !QFile::exists(powerStatePath))
{
sensordLogW() << "Path does not exists: " << powerStatePath;
@@ -52,11 +52,10 @@
bool HybrisAlsAdaptor::startSensor()
{
- if(!powerStatePath.isEmpty())
- writeToFile(powerStatePath, "1");
if (!(HybrisAdaptor::startSensor()))
return false;
-
+ if (isRunning() && !powerStatePath.isEmpty())
+ writeToFile(powerStatePath, "1");
sensordLogD() << "Hybris HybrisAlsAdaptor start\n";
return true;
}
@@ -120,9 +119,9 @@
void HybrisAlsAdaptor::stopSensor()
{
- if(!powerStatePath.isEmpty())
- writeToFile(powerStatePath, "0");
HybrisAdaptor::stopSensor();
+ if (!isRunning() && !powerStatePath.isEmpty())
+ writeToFile(powerStatePath, "0");
sensordLogD() << "Hybris HybrisAlsAdaptor stop\n";
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/hybrisgyroscopeadaptor/hybrisgyroscopeadaptor.cpp
^
|
@@ -35,7 +35,7 @@
setAdaptedSensor("gyroscopeadaptor", "Internal gyroscope coordinates", buffer);
setDescription("Hybris gyroscope");
- powerStatePath = Config::configuration()->value("gyroscope/powerstate_path").toByteArray();
+ powerStatePath = SensorFrameworkConfig::configuration()->value("gyroscope/powerstate_path").toByteArray();
if (!powerStatePath.isEmpty() && !QFile::exists(powerStatePath))
{
sensordLogW() << "Path does not exists: " << powerStatePath;
@@ -51,20 +51,19 @@
bool HybrisGyroscopeAdaptor::startSensor()
{
- if(!powerStatePath.isEmpty())
- writeToFile(powerStatePath, "1");
if (!(HybrisAdaptor::startSensor()))
return false;
-
+ if (isRunning() && !powerStatePath.isEmpty())
+ writeToFile(powerStatePath, "1");
sensordLogD() << "HybrisGyroscopeAdaptor start\n";
return true;
}
void HybrisGyroscopeAdaptor::stopSensor()
{
- if(!powerStatePath.isEmpty())
- writeToFile(powerStatePath, "0");
HybrisAdaptor::stopSensor();
+ if (!isRunning() &&!powerStatePath.isEmpty())
+ writeToFile(powerStatePath, "0");
sensordLogD() << "HybrisGyroscopeAdaptor stop\n";
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/hybrismagnetometeradaptor/hybrismagnetometeradaptor.cpp
^
|
@@ -31,7 +31,7 @@
setAdaptedSensor("magnetometer", "Internal magnetometer coordinates", buffer);
setDescription("Hybris magnetometer");
- powerStatePath = Config::configuration()->value("magnetometer/powerstate_path").toByteArray();
+ powerStatePath = SensorFrameworkConfig::configuration()->value("magnetometer/powerstate_path").toByteArray();
if (!powerStatePath.isEmpty() && !QFile::exists(powerStatePath))
{
sensordLogW() << "Path does not exists: " << powerStatePath;
@@ -48,20 +48,19 @@
bool HybrisMagnetometerAdaptor::startSensor()
{
- if(!powerStatePath.isEmpty())
- writeToFile(powerStatePath, "1");
if (!(HybrisAdaptor::startSensor()))
return false;
-
+ if (isRunning() &&!powerStatePath.isEmpty())
+ writeToFile(powerStatePath, "1");
sensordLogD() << "HybrisMagnetometerAdaptor start\n";
return true;
}
void HybrisMagnetometerAdaptor::stopSensor()
{
- if(!powerStatePath.isEmpty())
- writeToFile(powerStatePath, "0");
HybrisAdaptor::stopSensor();
+ if (!isRunning() && !powerStatePath.isEmpty())
+ writeToFile(powerStatePath, "0");
sensordLogD() << "HybrisMagnetometerAdaptor stop\n";
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/hybrisorientationadaptor/hybrisorientationadaptor.cpp
^
|
@@ -48,7 +48,7 @@
setAdaptedSensor("hybrisorientation", "Internal orientation coordinates", buffer);
setDescription("Hybris orientation");
- powerStatePath = Config::configuration()->value("orientation/powerstate_path").toByteArray();
+ powerStatePath = SensorFrameworkConfig::configuration()->value("orientation/powerstate_path").toByteArray();
if (!powerStatePath.isEmpty() && !QFile::exists(powerStatePath))
{
sensordLogW() << "Path does not exists: " << powerStatePath;
@@ -64,20 +64,19 @@
bool HybrisOrientationAdaptor::startSensor()
{
- if(!powerStatePath.isEmpty())
- writeToFile(powerStatePath, "1");
if (!(HybrisAdaptor::startSensor()))
return false;
-
+ if (isRunning() && !powerStatePath.isEmpty())
+ writeToFile(powerStatePath, "1");
sensordLogD() << "Hybris OrientationAdaptor start\n";
return true;
}
void HybrisOrientationAdaptor::stopSensor()
{
- if(!powerStatePath.isEmpty())
- writeToFile(powerStatePath, "0");
HybrisAdaptor::stopSensor();
+ if (!isRunning() && !powerStatePath.isEmpty())
+ writeToFile(powerStatePath, "0");
sensordLogD() << "Hybris OrientationAdaptor stop\n";
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/hybrispressureadaptor/hybrispressureadaptor.cpp
^
|
@@ -35,7 +35,7 @@
buffer = new DeviceAdaptorRingBuffer<TimedUnsigned>(1);
setAdaptedSensor("pressure", "Internal ambient pressure sensor values", buffer);
setDescription("Hybris pressure");
- powerStatePath = Config::configuration()->value("pressure/powerstate_path").toByteArray();
+ powerStatePath = SensorFrameworkConfig::configuration()->value("pressure/powerstate_path").toByteArray();
if (!powerStatePath.isEmpty() && !QFile::exists(powerStatePath))
{
sensordLogW() << "Path does not exists: " << powerStatePath;
@@ -50,20 +50,19 @@
bool HybrisPressureAdaptor::startSensor()
{
- if(!powerStatePath.isEmpty())
- writeToFile(powerStatePath, "1");
if (!(HybrisAdaptor::startSensor()))
return false;
-
+ if (isRunning() && !powerStatePath.isEmpty())
+ writeToFile(powerStatePath, "1");
sensordLogD() << "Hybris HybrisPressureAdaptor start\n";
return true;
}
void HybrisPressureAdaptor::stopSensor()
{
- if(!powerStatePath.isEmpty())
- writeToFile(powerStatePath, "0");
HybrisAdaptor::stopSensor();
+ if (!isRunning() && !powerStatePath.isEmpty())
+ writeToFile(powerStatePath, "0");
sensordLogD() << "Hybris HybrisPressureAdaptor stop\n";
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/hybrisproximityadaptor/hybrisproximityadaptor.cpp
^
|
@@ -39,7 +39,7 @@
setAdaptedSensor("proximity", "Internal proximity coordinates", buffer);
setDescription("Hybris proximity");
- powerStatePath = Config::configuration()->value("proximity/powerstate_path").toByteArray();
+ powerStatePath = SensorFrameworkConfig::configuration()->value("proximity/powerstate_path").toByteArray();
if (!powerStatePath.isEmpty() && !QFile::exists(powerStatePath))
{
sensordLogW() << "Path does not exists: " << powerStatePath;
@@ -57,10 +57,10 @@
bool HybrisProximityAdaptor::startSensor()
{
- if(!powerStatePath.isEmpty())
- writeToFile(powerStatePath, "1");
if (!(HybrisAdaptor::startSensor()))
return false;
+ if (isRunning() && !powerStatePath.isEmpty())
+ writeToFile(powerStatePath, "1");
sensordLogD() << "HybrisProximityAdaptor start\n";
return true;
}
@@ -127,9 +127,9 @@
void HybrisProximityAdaptor::stopSensor()
{
- if(!powerStatePath.isEmpty())
- writeToFile(powerStatePath, "0");
HybrisAdaptor::stopSensor();
+ if (!isRunning() && !powerStatePath.isEmpty())
+ writeToFile(powerStatePath, "0");
sensordLogD() << "HybrisProximityAdaptor stop\n";
}
@@ -138,7 +138,7 @@
ProximityData *d = buffer->nextSlot();
d->timestamp_ = quint64(data.timestamp * .001);
bool near = false;
- if (data.distance < maxRange) {
+ if (data.distance < maxRange()) {
near = true;
}
d->withinProximity_ = near;
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/hybrisstepcounteradaptor/hybrisstepcounteradaptor.cpp
^
|
@@ -41,7 +41,7 @@
buffer = new DeviceAdaptorRingBuffer<TimedUnsigned>(1);
setAdaptedSensor("stepcounter", "Internal step counter steps since reboot", buffer);
setDescription("Hybris step counter");
- powerStatePath = Config::configuration()->value("stepcounter/powerstate_path").toByteArray();
+ powerStatePath = SensorFrameworkConfig::configuration()->value("stepcounter/powerstate_path").toByteArray();
if (!powerStatePath.isEmpty() && !QFile::exists(powerStatePath))
{
sensordLogW() << "Path does not exists: " << powerStatePath;
@@ -56,11 +56,10 @@
bool HybrisStepCounterAdaptor::startSensor()
{
- if(!powerStatePath.isEmpty())
- writeToFile(powerStatePath, "1");
if (!(HybrisAdaptor::startSensor()))
return false;
-
+ if (isRunning() && !powerStatePath.isEmpty())
+ writeToFile(powerStatePath, "1");
sensordLogD() << "Hybris HybrisStepCounterAdaptor start\n";
return true;
}
@@ -72,9 +71,9 @@
void HybrisStepCounterAdaptor::stopSensor()
{
- if(!powerStatePath.isEmpty())
- writeToFile(powerStatePath, "0");
HybrisAdaptor::stopSensor();
+ if (!isRunning() && !powerStatePath.isEmpty())
+ writeToFile(powerStatePath, "0");
sensordLogD() << "Hybris HybrisStepCounterAdaptor stop\n";
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/iioadaptor/iioadaptor.cpp
^
|
@@ -81,7 +81,7 @@
if (deviceId.startsWith("accel")) {
const QString name = "accelerometer";
- const QString inputMatch = Config::configuration()->value<QString>(name + "/input_match");
+ const QString inputMatch = SensorFrameworkConfig::configuration()->value<QString>(name + "/input_match");
qDebug() << "input_match" << inputMatch;
devNodeNumber = findSensor(inputMatch);
@@ -96,7 +96,7 @@
}
else if (deviceId.startsWith("gyro")) {
const QString name = "gyroscope";
- const QString inputMatch = Config::configuration()->value<QString>(name + "/input_match");
+ const QString inputMatch = SensorFrameworkConfig::configuration()->value<QString>(name + "/input_match");
qDebug() << "input_match" << inputMatch;
devNodeNumber = findSensor(inputMatch);
@@ -110,7 +110,7 @@
}
else if (deviceId.startsWith("mag")) {
const QString name = "magnetometer";
- const QString inputMatch = Config::configuration()->value<QString>(name + "/input_match");
+ const QString inputMatch = SensorFrameworkConfig::configuration()->value<QString>(name + "/input_match");
qDebug() << "input_match" << inputMatch;
devNodeNumber = findSensor(inputMatch);
@@ -125,7 +125,7 @@
}
else if (deviceId.startsWith("als")) {
const QString name = "als";
- const QString inputMatch = Config::configuration()->value<QString>(name + "/input_match");
+ const QString inputMatch = SensorFrameworkConfig::configuration()->value<QString>(name + "/input_match");
devNodeNumber = findSensor(inputMatch);
if (devNodeNumber!= -1) {
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/lidsensoradaptor-evdev/lidsensoradaptor-evdev.cpp
^
|
@@ -47,7 +47,7 @@
{
lidBuffer_ = new DeviceAdaptorRingBuffer<LidData>(1);
setAdaptedSensor("lidsensor", "Lid state", lidBuffer_);
- powerStatePath_ = Config::configuration()->value("lidsensor/powerstate_path").toByteArray();
+ powerStatePath_ = SensorFrameworkConfig::configuration()->value("lidsensor/powerstate_path").toByteArray();
}
@@ -76,7 +76,7 @@
void LidSensorAdaptorEvdev::init()
{
qDebug() << Q_FUNC_INFO << name();
- QStringList strList = Config::configuration()->value<QStringList>(name() + "/input_match");
+ QStringList strList = SensorFrameworkConfig::configuration()->value<QStringList>(name() + "/input_match");
qDebug() << strList;
foreach (const QString str, strList) {
if (!getInputDevices(str)) {
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/magnetometeradaptor-evdev/magnetometerevdevadaptor.cpp
^
|
@@ -42,7 +42,7 @@
magnetometerBuffer_ = new DeviceAdaptorRingBuffer<CalibratedMagneticFieldData>(1);
setAdaptedSensor("magnetometer", "Internal magnetometer coordinates", magnetometerBuffer_);
setDescription("Input device magnetometer adaptor");
- powerStatePath_ = Config::configuration()->value("magnetometer/powerstate_path").toByteArray();
+ powerStatePath_ = SensorFrameworkConfig::configuration()->value("magnetometer/powerstate_path").toByteArray();
// introduceAvailableDataRange(DataRange(0, 4095, 1));
setDefaultInterval(10);
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/magnetometeradaptor-ncdk/magnetometeradaptor-ncdk.cpp
^
|
@@ -34,9 +34,9 @@
SysfsAdaptor(id, SysfsAdaptor::IntervalMode),
powerState_(false)
{
- intervalCompensation_ = Config::configuration()->value<int>("magnetometer/interval_compensation", 0);
- powerStateFilePath_ = Config::configuration()->value<QByteArray>("magnetometer/path_power_state", "");
- sensAdjFilePath_ = Config::configuration()->value<QByteArray>("magnetometer/path_sens_adjust", "");
+ intervalCompensation_ = SensorFrameworkConfig::configuration()->value<int>("magnetometer/interval_compensation", 0);
+ powerStateFilePath_ = SensorFrameworkConfig::configuration()->value<QByteArray>("magnetometer/path_power_state", "");
+ sensAdjFilePath_ = SensorFrameworkConfig::configuration()->value<QByteArray>("magnetometer/path_sens_adjust", "");
magnetometerBuffer_ = new DeviceAdaptorRingBuffer<CalibratedMagneticFieldData>(128);
setAdaptedSensor("magnetometer", "Internal magnetometer coordinates", magnetometerBuffer_);
setDescription("Magnetometer adaptor (ak8975) for NCDK");
@@ -44,7 +44,7 @@
//get sensitivity adjustment
getSensitivityAdjustment(x_adj, y_adj, z_adj);
- overflowLimit_ = Config::configuration()->value<int>("magnetometer/overflow_limit", 8000);
+ overflowLimit_ = SensorFrameworkConfig::configuration()->value<int>("magnetometer/overflow_limit", 8000);
}
MagnetometerAdaptorNCDK::~MagnetometerAdaptorNCDK()
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/magnetometeradaptor/magnetometeradaptor.cpp
^
|
@@ -46,10 +46,10 @@
MagnetometerAdaptor::MagnetometerAdaptor(const QString& id) :
SysfsAdaptor(id, SysfsAdaptor::IntervalMode, false)
{
- intervalCompensation_ = Config::configuration()->value<int>("magnetometer/interval_compensation", 0);
+ intervalCompensation_ = SensorFrameworkConfig::configuration()->value<int>("magnetometer/interval_compensation", 0);
magnetometerBuffer_ = new DeviceAdaptorRingBuffer<CalibratedMagneticFieldData>(1);
setAdaptedSensor("magnetometer", "Internal magnetometer coordinates", magnetometerBuffer_);
- overflowLimit_ = Config::configuration()->value<int>("magnetometer/overflow_limit", 8000);
+ overflowLimit_ = SensorFrameworkConfig::configuration()->value<int>("magnetometer/overflow_limit", 8000);
setDescription("Input device Magnetometer adaptor (ak897x)");
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/mpu6050accelerometer/mpu6050accelerometeradaptor.cpp
^
|
@@ -40,21 +40,21 @@
{
struct stat st;
- QString xAxisPath = Config::configuration()->value("accelerometer/x_axis_path").toString ();
+ QString xAxisPath = SensorFrameworkConfig::configuration()->value("accelerometer/x_axis_path").toString ();
if ( lstat (xAxisPath.toLatin1().constData(), &st) < 0 ) {
sensordLogW () << "x_axis_path: " << xAxisPath << " not found";
return;
}
addPath(xAxisPath, X_AXIS);
- QString yAxisPath = Config::configuration()->value("accelerometer/y_axis_path").toString ();
+ QString yAxisPath = SensorFrameworkConfig::configuration()->value("accelerometer/y_axis_path").toString ();
if ( lstat (yAxisPath.toLatin1().constData(), &st) < 0 ) {
sensordLogW () << "y_axis_path: " << yAxisPath << " not found";
return;
}
addPath(yAxisPath, Y_AXIS);
- QString zAxisPath = Config::configuration()->value("accelerometer/z_axis_path").toString ();
+ QString zAxisPath = SensorFrameworkConfig::configuration()->value("accelerometer/z_axis_path").toString ();
if ( lstat (zAxisPath.toLatin1().constData(), &st) < 0 ) {
sensordLogW () << "z_axis_path: " << zAxisPath << " not found";
return;
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/oaktrailaccelerometer/oaktrailaccelerometeradaptor.cpp
^
|
@@ -13,7 +13,7 @@
{
struct stat st;
- devPath = Config::configuration ()->value ("oaktrail_acc_sys_path").toString ();
+ devPath = SensorFrameworkConfig::configuration ()->value ("oaktrail_acc_sys_path").toString ();
if ( lstat (devPath.toLatin1().constData(), &st) < 0 ) {
sensordLogW () << devPath << "no found";
return;
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/oemtabletaccelerometer/oemtabletaccelerometeradaptor.cpp
^
|
@@ -13,7 +13,7 @@
{
struct stat st;
- devPath = Config::configuration ()->value ("oem_tablet_acc_sys_path").toString ();
+ devPath = SensorFrameworkConfig::configuration ()->value ("oem_tablet_acc_sys_path").toString ();
if ( lstat (devPath.toLatin1().constData(), &st) < 0 ) {
sensordLogW () << devPath << "no found";
return;
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/oemtabletalsadaptor-ascii/oemtabletalsadaptor-ascii.cpp
^
|
@@ -16,7 +16,7 @@
const unsigned int DEFAULT_RANGE = 65535;
int range = DEFAULT_RANGE;
- QFile sysFile(Config::configuration()->value("als-ascii_range_sysfs_path").toString());
+ QFile sysFile(SensorFrameworkConfig::configuration()->value("als-ascii_range_sysfs_path").toString());
if (!(sysFile.open(QIODevice::ReadOnly))) {
sensordLogW() << "Unable to config ALS range from sysfs, using default value: " << DEFAULT_RANGE;
@@ -28,7 +28,7 @@
sensordLogT() << "Ambient light range: " << range;
// Locate the actual handle
- QString devPath = Config::configuration()->value("als-ascii_sysfs_path").toString();
+ QString devPath = SensorFrameworkConfig::configuration()->value("als-ascii_sysfs_path").toString();
if (devPath.isEmpty())
{
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/pressureadaptor/pressureadaptor.cpp
^
|
@@ -40,7 +40,7 @@
pressureBuffer_ = new DeviceAdaptorRingBuffer<TimedUnsigned>(1);
setAdaptedSensor("pressure", "Pressure values", pressureBuffer_);
setDescription("Input device pressure adaptor");
- powerStatePath_ = Config::configuration()->value("pressure/powerstate_path").toByteArray();
+ powerStatePath_ = SensorFrameworkConfig::configuration()->value("pressure/powerstate_path").toByteArray();
introduceAvailableDataRange(DataRange(0, 4095, 1));
setDefaultInterval(10);
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/proximityadaptor-evdev/proximityadaptor-evdev.cpp
^
|
@@ -46,7 +46,7 @@
{
proximityBuffer_ = new DeviceAdaptorRingBuffer<ProximityData>(1);
setAdaptedSensor("proximity", "Proximity state", proximityBuffer_);
- powerStatePath_ = Config::configuration()->value("proximity/powerstate_path").toByteArray();
+ powerStatePath_ = SensorFrameworkConfig::configuration()->value("proximity/powerstate_path").toByteArray();
}
ProximityAdaptorEvdev::~ProximityAdaptorEvdev()
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/proximityadaptor/proximityadaptor.cpp
^
|
@@ -53,9 +53,9 @@
ProximityAdaptor::ProximityAdaptor(const QString& id) :
SysfsAdaptor(id, SysfsAdaptor::SelectMode, false)
{
- deviceType_ = (DeviceType)Config::configuration()->value<int>("proximity/driver_type", 0);
- threshold_ = Config::configuration()->value<int>("proximity/threshold", 35);
- powerStatePath_ = Config::configuration()->value("proximity/powerstate_path").toByteArray();
+ deviceType_ = (DeviceType)SensorFrameworkConfig::configuration()->value<int>("proximity/driver_type", 0);
+ threshold_ = SensorFrameworkConfig::configuration()->value<int>("proximity/threshold", 35);
+ powerStatePath_ = SensorFrameworkConfig::configuration()->value("proximity/powerstate_path").toByteArray();
proximityBuffer_ = new DeviceAdaptorRingBuffer<ProximityData>(1);
setAdaptedSensor("proximity", "Proximity state", proximityBuffer_);
setDescription("Proximity sensor readings (Dipro sensor)");
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/steaccelerometeradaptor/steaccelerometeradaptor.cpp
^
|
@@ -26,8 +26,8 @@
1: +/- 4g (2 mg/LSB)
2: +/- 8g (4 mg/LSB)
*/
- QByteArray rangePath = Config::configuration()->value("accelerometer/range_path").toByteArray();
- range = Config::configuration()->value("accelerometer/range_mode").toByteArray();
+ QByteArray rangePath = SensorFrameworkConfig::configuration()->value("accelerometer/range_path").toByteArray();
+ range = SensorFrameworkConfig::configuration()->value("accelerometer/range_mode").toByteArray();
if(!rangePath.isEmpty()) {
writeToFile(rangePath, range);
}
@@ -44,8 +44,8 @@
7: 400 Hz
*/
- powerStatePath = Config::configuration()->value("accelerometer/mode_path").toByteArray();
- frequency = Config::configuration()->value("accelerometer/frequency_mode").toInt();
+ powerStatePath = SensorFrameworkConfig::configuration()->value("accelerometer/mode_path").toByteArray();
+ frequency = SensorFrameworkConfig::configuration()->value("accelerometer/frequency_mode").toInt();
setDescription("ste accelerometer");
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/adaptors/temperatureadaptor/temperatureadaptor.cpp
^
|
@@ -40,7 +40,7 @@
temperatureBuffer_ = new DeviceAdaptorRingBuffer<TimedUnsigned>(1);
setAdaptedSensor("temperature", "Temperature values", temperatureBuffer_);
setDescription("Input device temperature adaptor");
- powerStatePath_ = Config::configuration()->value("temperature/powerstate_path").toByteArray();
+ powerStatePath_ = SensorFrameworkConfig::configuration()->value("temperature/powerstate_path").toByteArray();
introduceAvailableDataRange(DataRange(0, 4095, 1));
setDefaultInterval(10);
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/chains/accelerometerchain/accelerometerchain.cpp
^
|
@@ -52,7 +52,7 @@
accelerometerReader_ = new BufferReader<AccelerationData>(1);
// Get the transformation matrix from config file
- QString aconvString = Config::configuration()->value<QString>("accelerometer/transformation_matrix", "");
+ QString aconvString = SensorFrameworkConfig::configuration()->value<QString>("accelerometer/transformation_matrix", "");
if (aconvString.size() > 0)
{
if (!setMatrixFromString(aconvString))
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/chains/compasschain/compasschain.cpp
^
|
@@ -178,6 +178,9 @@
addStandbyOverrideSource(accelerometerChain);
setIntervalSource(accelerometerChain);
+ } else {
+ addStandbyOverrideSource(orientAdaptor);
+ setIntervalSource(orientAdaptor);
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/chains/compasschain/compasschainplugin.cpp
^
|
@@ -37,7 +37,7 @@
}
QStringList CompassChainPlugin::Dependencies() {
- QByteArray orientationConfiguration = Config::configuration()->value("plugins/orientationadaptor").toByteArray();
+ QByteArray orientationConfiguration = SensorFrameworkConfig::configuration()->value("plugins/orientationadaptor").toByteArray();
if (orientationConfiguration.isEmpty()) {
return QString("accelerometerchain:magcalibrationchain:declinationfilter:downsamplefilter:avgaccfilter").split(":", QString::SkipEmptyParts);
} else {
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/chains/magcalibrationchain/calibrationfilter.cpp
^
|
@@ -47,7 +47,7 @@
minMaxList.insert(1,qMakePair(0,0));
minMaxList.insert(2,qMakePair(0,0));
- manualCalibration = Config::configuration()->value<bool>("magnetometer/needs_calibration", false);
+ manualCalibration = SensorFrameworkConfig::configuration()->value<bool>("magnetometer/needs_calibration", false);
qDebug() << Q_FUNC_INFO << manualCalibration;
#ifdef CALIBRATE_DATA
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/chains/magcalibrationchain/magcalibrationchain.cpp
^
|
@@ -54,16 +54,16 @@
if (magAdaptor)
setValid(magAdaptor->isValid());
-// Config::configuration()->value<int>("magnetometer/interval_compensation", 16);
+// SensorFrameworkConfig::configuration()->value<int>("magnetometer/interval_compensation", 16);
// Get the transformation matrix from config file
- QString aconvString = Config::configuration()->value<QString>("magnetometer/transformation_matrix", "");
+ QString aconvString = SensorFrameworkConfig::configuration()->value<QString>("magnetometer/transformation_matrix", "");
if (aconvString.size() > 0) {
if (!setMatrixFromString(aconvString)) {
sensordLogW() << "Failed to parse 'transformation_matrix' configuration key. Coordinate alignment may be invalid";
}
}
- needsCalibration = Config::configuration()->value<bool>("magnetometer/needs_calibration", true);
+ needsCalibration = SensorFrameworkConfig::configuration()->value<bool>("magnetometer/needs_calibration", true);
calibratedMagnetometerData = new RingBuffer<CalibratedMagneticFieldData>(1);
nameOutputBuffer("calibratedmagnetometerdata", calibratedMagnetometerData);
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/config/10-sensord-default.conf
^
|
(renamed from config/90-sensord-default.conf)
|
[-]
[+]
|
Added |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/config/20-sensors-default.conf
^
|
@@ -0,0 +1,48 @@
+[available]
+; Availability of some sensors can be defined in hw-settings configuration
+; files. By enabling ssu-sysinfo usage, sensorfwd configuration can be
+; written so that it just refers to hw-settings config. If ssu-sysinfo
+; is not used, these will default to "True".
+;
+; In case of virtual sensors can be implemented on top of multiple real
+; sensors, multiple '|' separated features can be given and the sensor
+; is enabled if at least one of those is set in hw-settings.
+
+accelerometersensor=Feature_AccelerationSensor
+alssensor=Feature_LightSensor
+compasssensor=Feature_CompassSensor
+gyroscopesensor=Feature_GyroSensor
+orientationsensor=Feature_GyroSensor|Feature_AccelerationSensor
+proximitysensor=Feature_ProximitySensor
+
+; In theory having Feature_CoverSensor == have lidsensor. However
+; in practice only mce is expected to track lidsensor and atm it
+; does it via suspend proofed evdev inputs rather than sensorfwd.
+; So, even if the lidsensor adaptors provided by sensorfwd would
+; work, they might interfere with the only user of the sensor.
+; lidsensor=Feature_CoverSensor
+lidsensor=False
+
+; Some sensors that are in theory supported by sensorfwd do not have
+; a suitable hybris adaptors, and thus it makes no sense to list them
+; as being available regardless of the hw / android hal status.
+tapsensor=False
+temperaturesensor=False
+
+; Sensors that have not been available in any officially supported
+; devices -> hide by default.
+humiditysensor=False
+stepcountersensor=False
+
+; To minimize chances of regression, sensors that have been available at
+; least in one officially supported device -> do not hide by default.
+; (sensor loading should fail, so false positive should cause only
+; cosmetic issues on 1st use after bootup)
+
+magnetometersensor=True
+pressuresensor=True
+rotationsensor=True
+
+; To avoid revisiting config files for all old ports in the future, the
+; defaults for added sensors should be set "False" by default here, and
+; to "True" in device specific override config as appropriate.
|
[-]
[+]
|
Added |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/config/60-sensors-DEVICE.conf
^
|
@@ -0,0 +1,29 @@
+[available]
+
+; Sensors that are enabled by default.
+; -> Disable as appropriate
+
+;magnetometersensor=False
+;pressuresensor=False
+;rotationsensor=False
+
+; Sensors that are disabled by default.
+; -> Enable as appropriate
+
+;humiditysensor=True
+;stepcountersensor=True
+;tapsensor=True
+;temperaturesensor=True
+
+; Sensors that should/can be enabled/disabled based on
+; hw settings config - or are enabled if sensorfwd is
+; built without ssu-sysinfo support.
+; -> Override as appropriate.
+
+;accelerometersensor=False
+;alssensor=False
+;compasssensor=False
+;gyroscopesensor=False
+;lidsensor=False
+;orientationsensor=False
+;proximitysensor=False
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/core/config.cpp
^
|
@@ -33,116 +33,90 @@
#include <QDir>
#include <QList>
-static Config *static_configuration = 0;
+static SensorFrameworkConfig *static_configuration = 0;
-Config::Config() {
+SensorFrameworkConfig::SensorFrameworkConfig() {
}
-Config::~Config() {
- clearConfig();
+SensorFrameworkConfig::~SensorFrameworkConfig() {
}
-void Config::clearConfig() {
- foreach(QSettings* setting, settings)
- delete setting;
- settings.clear();
+void SensorFrameworkConfig::clearConfig() {
+ m_settings.clear();
}
-bool Config::loadConfig(const QString &defConfigPath, const QString &configDPath) {
- Config *config = NULL;
+bool SensorFrameworkConfig::loadConfig(const QString &defConfigPath, const QString &configDPath) {
+ /* Not having config files is ok, failing to load one that exists is not */
bool ret = true;
-
- /* Check/create new static config */
- if (static_configuration) {
- config = static_configuration;
- } else {
- config = new Config();
+ if (!static_configuration) {
+ static_configuration = new SensorFrameworkConfig();
}
-
- if (!config->loadConfigFile(defConfigPath))
- ret = false;
-
- /* Scan config.d dir */
- QStringList fileList;
- if(!configDPath.isEmpty())
- {
+ /* Process config.d dir in alnum order */
+ if (!configDPath.isEmpty()) {
QDir dir(configDPath, "*.conf", QDir::Name, QDir::Files);
- fileList = dir.entryList();
- foreach(const QString& file, fileList)
- {
- if (!config->loadConfigFile(dir.absoluteFilePath(file)))
+ foreach(const QString &file, dir.entryList()) {
+ if (!static_configuration->loadConfigFile(dir.absoluteFilePath(file))) {
ret = false;
+ }
}
}
-
- static_configuration = config;
-
+ /* Primary config file overrides config.d */
+ if (!defConfigPath.isEmpty() && QFile::exists(defConfigPath) ) {
+ if (!static_configuration->loadConfigFile(defConfigPath))
+ ret = false;
+ }
return ret;
}
-bool Config::loadConfigFile(const QString &configFileName) {
- if(!QFile::exists(configFileName))
- {
+bool SensorFrameworkConfig::loadConfigFile(const QString &configFileName) {
+ /* Success means the file was loaded and processed without hiccups */
+ bool loaded = false;
+ if (!QFile::exists(configFileName)) {
sensordLogW() << "File does not exists \"" << configFileName << "\"";
- return false;
- }
- QSettings* setting = new QSettings(configFileName, QSettings::IniFormat);
- if(setting->status() == QSettings::NoError) {
- settings.append(setting);
- sensordLogD() << "Config file \"" << configFileName << "\" successfully loaded";
- return true;
- }
- else if(setting->status() == QSettings::AccessError)
- sensordLogW() << "Unable to open \"" << configFileName << "\" configuration file";
- else if(setting->status() == QSettings::FormatError)
- sensordLogW() << "Configuration file \"" << configFileName << "\" is in wrong format";
- else
- sensordLogW() << "Configuration file \"" << configFileName << "\" parsing failed to unknown error: " << setting->status();
- delete setting;
- return false;
-}
-
-QVariant Config::value(const QString &key) const {
- /* Iterate through configs so that keys in the first files
- * have preference over the last.
- */
- foreach(QSettings* setting, settings) {
- if(setting->contains(key))
- {
- QVariant var = setting->value(key, QVariant());
- if(var.isValid())
- sensordLogD() << "Value for key '" << key << "': " << var.toString();
- return var;
+ } else {
+ QSettings merge(configFileName, QSettings::IniFormat);
+ QSettings::Status status(merge.status());
+ if (status == QSettings::FormatError ) {
+ sensordLogW() << "Configuration file \"" << configFileName << "\" is in wrong format";
+ } else if (status != QSettings::NoError) {
+ sensordLogW() << "Unable to open \"" << configFileName << "\" configuration file";
+ } else {
+ foreach (const QString &key, merge.allKeys()) {
+ m_settings.setValue(key, merge.value(key));
+ }
+ loaded = true;
}
}
- return QVariant();
+ return loaded;
}
-QStringList Config::groups() const
-{
- QStringList groups;
- foreach(QSettings* setting, settings) {
- foreach(const QString& group, setting->childGroups()) {
- if(!groups.contains(group))
- groups << group;
- }
+QVariant SensorFrameworkConfig::value(const QString &key) const {
+ QVariant var = m_settings.value(key, QVariant());
+ if(var.isValid()) {
+ sensordLogT() << "Value for key" << key << ":" << var.toString();
}
+ return var;
+}
+
+QStringList SensorFrameworkConfig::groups() const
+{
+ QStringList groups = m_settings.childGroups();
return groups;
}
-Config *Config::configuration() {
+SensorFrameworkConfig *SensorFrameworkConfig::configuration() {
if (!static_configuration) {
sensordLogW() << "Configuration has not been loaded";
}
return static_configuration;
}
-void Config::close() {
+void SensorFrameworkConfig::close() {
delete static_configuration;
static_configuration = 0;
}
-bool Config::exists(const QString &key) const
+bool SensorFrameworkConfig::exists(const QString &key) const
{
return value(key).isValid();
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/core/config.h
^
|
@@ -35,16 +35,16 @@
/**
* Sensord configuration parser. Configuration is read and parsed with
- * the QSettings class. Config is a singleton instance to which configuration
+ * the QSettings class. SensorFrameworkConfig is a singleton instance to which configuration
* is loaded once during startup.
*/
-class Config
+class SensorFrameworkConfig
{
public:
/**
* Destructor.
*/
- ~Config();
+ ~SensorFrameworkConfig();
/**
* Find value for given key. Default QVariant is returned if key does
@@ -86,7 +86,7 @@
*
* @return configuration instance.
*/
- static Config *configuration();
+ static SensorFrameworkConfig *configuration();
/**
* Load configuration from given paths and append them to singleton
@@ -106,14 +106,14 @@
/**
* Constructor.
*/
- Config();
+ SensorFrameworkConfig();
/**
* Copy constructor.
*
* @param c source object.
*/
- Config(const Config &c);
+ SensorFrameworkConfig(const SensorFrameworkConfig &c);
/**
* Assignment operator.
@@ -121,7 +121,7 @@
* @param c source object.
* @return current object.
*/
- Config& operator=(const Config &c);
+ SensorFrameworkConfig& operator=(const SensorFrameworkConfig &c);
/**
* Load configuration file from given path.
@@ -136,11 +136,11 @@
*/
void clearConfig();
- QList<QSettings*> settings; /**< parsed QSettings */
+ QSettings m_settings; /**< parsed QSettings */
};
template<typename T>
-T Config::value(const QString &key, const T &def) const
+T SensorFrameworkConfig::value(const QString &key, const T &def) const
{
QVariant val(value(key));
if(!val.isValid())
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/core/core.pro
^
|
@@ -80,6 +80,11 @@
DEFINES += SENSORFW_MCE_WATCHER
}
+contains(CONFIG,ssusysinfo) {
+ PKGCONFIG += ssu-sysinfo
+ QMAKE_CXXFLAGS += -DUSE_SSUSYSINFO
+}
+
lunaservice {
SOURCES += lsclient.cpp
HEADERS += lsclient.h
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/core/hybrisadaptor.cpp
^
|
@@ -31,519 +31,814 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
+#include <time.h>
+#include <signal.h>
+/* Older devices probably have old android hal and thus do
+ * not define sensor all sensor types that have been added
+ * later on -> In order to both use symbolic names and
+ * compile for all devices we need to fill in holes that
+ * android hal for some particular device might have.
+ */
+#ifndef SENSOR_TYPE_META_DATA
+#define SENSOR_TYPE_META_DATA (0)
+#endif
#ifndef SENSOR_TYPE_ACCELEROMETER
-#define SENSOR_TYPE_ACCELEROMETER (1)
+#define SENSOR_TYPE_ACCELEROMETER (1)
+#endif
+#ifndef SENSOR_TYPE_GEOMAGNETIC_FIELD
+#define SENSOR_TYPE_GEOMAGNETIC_FIELD (2) // alias for SENSOR_TYPE_MAGNETIC_FIELD
#endif
#ifndef SENSOR_TYPE_MAGNETIC_FIELD
-#define SENSOR_TYPE_MAGNETIC_FIELD (2)
+#define SENSOR_TYPE_MAGNETIC_FIELD (2) // alias for SENSOR_TYPE_GEOMAGNETIC_FIELD
#endif
#ifndef SENSOR_TYPE_ORIENTATION
-#define SENSOR_TYPE_ORIENTATION (3)
+#define SENSOR_TYPE_ORIENTATION (3)
#endif
#ifndef SENSOR_TYPE_GYROSCOPE
-#define SENSOR_TYPE_GYROSCOPE (4)
+#define SENSOR_TYPE_GYROSCOPE (4)
#endif
#ifndef SENSOR_TYPE_LIGHT
-#define SENSOR_TYPE_LIGHT (5)
+#define SENSOR_TYPE_LIGHT (5)
#endif
#ifndef SENSOR_TYPE_PRESSURE
-#define SENSOR_TYPE_PRESSURE (6)
+#define SENSOR_TYPE_PRESSURE (6)
#endif
#ifndef SENSOR_TYPE_TEMPERATURE
-#define SENSOR_TYPE_TEMPERATURE (7)
+#define SENSOR_TYPE_TEMPERATURE (7)
#endif
#ifndef SENSOR_TYPE_PROXIMITY
-#define SENSOR_TYPE_PROXIMITY (8)
+#define SENSOR_TYPE_PROXIMITY (8)
#endif
#ifndef SENSOR_TYPE_GRAVITY
-#define SENSOR_TYPE_GRAVITY (9)
+#define SENSOR_TYPE_GRAVITY (9)
#endif
#ifndef SENSOR_TYPE_LINEAR_ACCELERATION
-#define SENSOR_TYPE_LINEAR_ACCELERATION (10)
+#define SENSOR_TYPE_LINEAR_ACCELERATION (10)
#endif
#ifndef SENSOR_TYPE_ROTATION_VECTOR
-#define SENSOR_TYPE_ROTATION_VECTOR (11)
+#define SENSOR_TYPE_ROTATION_VECTOR (11)
#endif
#ifndef SENSOR_TYPE_RELATIVE_HUMIDITY
-#define SENSOR_TYPE_RELATIVE_HUMIDITY (12)
+#define SENSOR_TYPE_RELATIVE_HUMIDITY (12)
#endif
#ifndef SENSOR_TYPE_AMBIENT_TEMPERATURE
-#define SENSOR_TYPE_AMBIENT_TEMPERATURE (13)
+#define SENSOR_TYPE_AMBIENT_TEMPERATURE (13)
+#endif
+#ifndef SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED
+#define SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED (14)
+#endif
+#ifndef SENSOR_TYPE_GAME_ROTATION_VECTOR
+#define SENSOR_TYPE_GAME_ROTATION_VECTOR (15)
+#endif
+#ifndef SENSOR_TYPE_GYROSCOPE_UNCALIBRATED
+#define SENSOR_TYPE_GYROSCOPE_UNCALIBRATED (16)
+#endif
+#ifndef SENSOR_TYPE_SIGNIFICANT_MOTION
+#define SENSOR_TYPE_SIGNIFICANT_MOTION (17)
+#endif
+#ifndef SENSOR_TYPE_STEP_DETECTOR
+#define SENSOR_TYPE_STEP_DETECTOR (18)
#endif
-//#define SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED (14)
-//#define SENSOR_TYPE_GAME_ROTATION_VECTOR (15)
-//#define SENSOR_TYPE_GYROSCOPE_UNCALIBRATED (16)
-//#define SENSOR_TYPE_SIGNIFICANT_MOTION (17)
-//#define SENSOR_TYPE_STEP_DETECTOR (18)
#ifndef SENSOR_TYPE_STEP_COUNTER
-#define SENSOR_TYPE_STEP_COUNTER (19)
+#define SENSOR_TYPE_STEP_COUNTER (19)
#endif
-//#define SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR (20)
-
-Q_GLOBAL_STATIC(HybrisManager, hybrisManager)
+#ifndef SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR
+#define SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR (20)
+#endif
+#ifndef SENSOR_TYPE_HEART_RATE
+#define SENSOR_TYPE_HEART_RATE (21)
+#endif
+#ifndef SENSOR_TYPE_TILT_DETECTOR
+#define SENSOR_TYPE_TILT_DETECTOR (22)
+#endif
+#ifndef SENSOR_TYPE_WAKE_GESTURE
+#define SENSOR_TYPE_WAKE_GESTURE (23)
+#endif
+#ifndef SENSOR_TYPE_GLANCE_GESTURE
+#define SENSOR_TYPE_GLANCE_GESTURE (24)
+#endif
+#ifndef SENSOR_TYPE_PICK_UP_GESTURE
+#define SENSOR_TYPE_PICK_UP_GESTURE (25)
+#endif
+#ifndef SENSOR_TYPE_WRIST_TILT_GESTURE
+#define SENSOR_TYPE_WRIST_TILT_GESTURE (26)
+#endif
+
+/* ========================================================================= *
+ * UTILITIES
+ * ========================================================================= */
+
+static char const *
+sensorTypeName(int type)
+{
+ switch (type) {
+ case SENSOR_TYPE_META_DATA: return "META_DATA";
+ case SENSOR_TYPE_ACCELEROMETER: return "ACCELEROMETER";
+ case SENSOR_TYPE_GEOMAGNETIC_FIELD: return "GEOMAGNETIC_FIELD";
+ case SENSOR_TYPE_ORIENTATION: return "ORIENTATION";
+ case SENSOR_TYPE_GYROSCOPE: return "GYROSCOPE";
+ case SENSOR_TYPE_LIGHT: return "LIGHT";
+ case SENSOR_TYPE_PRESSURE: return "PRESSURE";
+ case SENSOR_TYPE_TEMPERATURE: return "TEMPERATURE";
+ case SENSOR_TYPE_PROXIMITY: return "PROXIMITY";
+ case SENSOR_TYPE_GRAVITY: return "GRAVITY";
+ case SENSOR_TYPE_LINEAR_ACCELERATION: return "LINEAR_ACCELERATION";
+ case SENSOR_TYPE_ROTATION_VECTOR: return "ROTATION_VECTOR";
+ case SENSOR_TYPE_RELATIVE_HUMIDITY: return "RELATIVE_HUMIDITY";
+ case SENSOR_TYPE_AMBIENT_TEMPERATURE: return "AMBIENT_TEMPERATURE";
+ case SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED: return "MAGNETIC_FIELD_UNCALIBRATED";
+ case SENSOR_TYPE_GAME_ROTATION_VECTOR: return "GAME_ROTATION_VECTOR";
+ case SENSOR_TYPE_GYROSCOPE_UNCALIBRATED: return "GYROSCOPE_UNCALIBRATED";
+ case SENSOR_TYPE_SIGNIFICANT_MOTION: return "SIGNIFICANT_MOTION";
+ case SENSOR_TYPE_STEP_DETECTOR: return "STEP_DETECTOR";
+ case SENSOR_TYPE_STEP_COUNTER: return "STEP_COUNTER";
+ case SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR: return "GEOMAGNETIC_ROTATION_VECTOR";
+ case SENSOR_TYPE_HEART_RATE: return "HEART_RATE";
+ case SENSOR_TYPE_TILT_DETECTOR: return "TILT_DETECTOR";
+ case SENSOR_TYPE_WAKE_GESTURE: return "WAKE_GESTURE";
+ case SENSOR_TYPE_GLANCE_GESTURE: return "GLANCE_GESTURE";
+ case SENSOR_TYPE_PICK_UP_GESTURE: return "PICK_UP_GESTURE";
+ case SENSOR_TYPE_WRIST_TILT_GESTURE: return "WRIST_TILT_GESTURE";
+ }
+
+ static char buf[32];
+ snprintf(buf, sizeof buf, "type%d", type);
+ return buf;
+}
-HybrisManager::HybrisManager(QObject *parent)
- : QObject(parent)
- , device(NULL)
- , sensorList(NULL)
- , module(NULL)
- , sensorsCount(0)
- , sensorMap()
- , registeredAdaptors()
- , adaptorReader(parent)
+static void ObtainTemporaryWakeLock()
{
- init();
+ static bool triedToOpen = false;
+ static int wakeLockFd = -1;
+
+ if (!triedToOpen) {
+ triedToOpen = true;
+ wakeLockFd = ::open("/sys/power/wake_lock", O_RDWR);
+ if (wakeLockFd == -1) {
+ sensordLogW() << "wake locks not available:" << ::strerror(errno);
+ }
+ }
+
+ if (wakeLockFd != -1) {
+ sensordLogD() << "wake lock to guard sensor data io";
+ static const char m[] = "sensorfwd_pass_data 1000000000\n";
+ if (::write(wakeLockFd, m, sizeof m - 1) == -1) {
+ sensordLogW() << "wake locking failed:" << ::strerror(errno);
+ ::close(wakeLockFd), wakeLockFd = -1;
+ }
+ }
}
-HybrisManager::~HybrisManager()
+/* ========================================================================= *
+ * HybrisSensorState
+ * ========================================================================= */
+
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/core/hybrisadaptor.h
^
|
@@ -26,73 +26,78 @@
#include <QTimer>
#include <QFile>
+#include <pthread.h>
+
#include "deviceadaptor.h"
#include <hardware/sensors.h>
#define SENSORFW_MCE_WATCHER
class HybrisAdaptor;
-class HybrisAdaptorReader : public QThread
+struct HybrisSensorState
{
- Q_OBJECT
- Q_DISABLE_COPY(HybrisAdaptorReader)
-
-public:
+ HybrisSensorState();
+ ~HybrisSensorState();
- HybrisAdaptorReader(QObject *parent);
- ~HybrisAdaptorReader();
-
- void run();
- void stopReader();
- void startReader();
-
-private:
- bool running_;
+ int m_minDelay;
+ int m_maxDelay;
+ int m_delay;
+ int m_active;
+ sensors_event_t m_fallbackEvent;
};
-
class HybrisManager : public QObject
{
Q_OBJECT
public:
- explicit HybrisManager(QObject *parent = 0);
static HybrisManager *instance();
- virtual ~HybrisManager();
-
- int handleForType(int sensorType);
- int maxRange(int sensorType);
- int minDelay(int sensorType);
- int resolution(int sensorType);
-
- bool setDelay(int handle, int interval);
- void startReader(HybrisAdaptor *adaptor);
- void stopReader(HybrisAdaptor *adaptor);
-
- bool resumeReader(HybrisAdaptor *adaptor);
- void standbyReader(HybrisAdaptor *adaptor);
-
- bool openSensors();
- bool closeSensors();
- void registerAdaptor(HybrisAdaptor * adaptor);
-
- void processSample(const sensors_event_t& data);
+ explicit HybrisManager(QObject *parent = 0);
+ virtual ~HybrisManager();
-protected:
- // methods
- void init();
- void closeAllSensors();
+ /* - - - - - - - - - - - - - - - - - - - *
+ * android sensor hal functions
+ * - - - - - - - - - - - - - - - - - - - */
+
+ sensors_event_t *halEventForHandle(int handle) const;
+ int halIndexForHandle(int handle) const;
+ int halIndexForType (int sensorType) const;
+ int halHandleForType (int sensorType) const;
+ float halGetMaxRange (int handle) const;
+ float halGetResolution (int handle) const;
+ int halGetMinDelay (int handle) const;
+ int halGetMaxDelay (int handle) const;
+ int halGetDelay (int handle) const;
+ bool halSetDelay (int handle, int delay_ms);
+ bool halGetActive (int handle) const;
+ bool halSetActive (int handle, bool active);
+
+ /* - - - - - - - - - - - - - - - - - - - *
+ * HybrisManager <--> sensorfwd
+ * - - - - - - - - - - - - - - - - - - - */
+
+ void startReader (HybrisAdaptor *adaptor);
+ void stopReader (HybrisAdaptor *adaptor);
+ void registerAdaptor (HybrisAdaptor * adaptor);
+ void processSample (const sensors_event_t& data);
+private:
// fields
- struct sensors_poll_device_t* device;
- struct sensor_t const* sensorList;
- struct sensors_module_t* module;
- int sensorsCount;
- QMap <int, int> sensorMap; //type, index
- QMap <int, HybrisAdaptor *> registeredAdaptors; //type, obj
- HybrisAdaptorReader adaptorReader;
+ bool m_initialized;
+ QMap <int, HybrisAdaptor *> m_registeredAdaptors; // type -> obj
+ struct sensors_module_t *m_halModule;
+ struct sensors_poll_device_t *m_halDevice;
+ int m_halSensorCount;
+ const struct sensor_t *m_halSensorArray; // [m_halSensorCount]
+ HybrisSensorState *m_halSensorState; // [m_halSensorCount]
+ QMap <int, int> m_halIndexOfType; // type -> index
+ QMap <int, int> m_halIndexOfHandle; // handle -> index
+ pthread_t m_halEventReaderTid;
friend class HybrisAdaptorReader;
+
+private:
+ static void *halEventReaderThread(void *aptr);
};
class HybrisAdaptor : public DeviceAdaptor
@@ -102,47 +107,44 @@
virtual ~HybrisAdaptor();
virtual void init();
- bool addSensorType(int type);
+
virtual bool startAdaptor();
- bool isRunning() const;
+ bool isRunning() const;
virtual void stopAdaptor();
+ void evaluateSensor();
virtual bool startSensor();
virtual void stopSensor();
virtual bool standby();
-
virtual bool resume();
- qreal maxRange;
- qint32 minDelay;
- qreal resolution;
+ virtual void sendInitialData();
friend class HybrisManager;
- int sensorHandle;
- int sensorType;
- int cachedInterval;
-
- virtual void sendInitialData() {}
protected:
virtual void processSample(const sensors_event_t& data) = 0;
+ qreal minRange() const;
+ qreal maxRange() const;
+ qreal resolution() const;
+
+ unsigned int minInterval() const;
+ unsigned int maxInterval() const;
+
virtual unsigned int interval() const;
virtual bool setInterval(const unsigned int value, const int sessionId);
virtual unsigned int evaluateIntervalRequests(int& sessionId) const;
static bool writeToFile(const QByteArray& path, const QByteArray& content);
private:
- void stopReaderThread();
- bool startReaderThread();
-
- QList<int> sensorIds;
- unsigned int interval_;
- bool inStandbyMode_;
- bool running_;
- bool shouldBeRunning_;
+ bool m_inStandbyMode;
+ volatile bool m_isRunning;
+ bool m_shouldBeRunning;
+ int m_sensorHandle;
+ int m_sensorType;
};
#endif // HybrisAdaptor_H
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/core/inputdevadaptor.cpp
^
|
@@ -59,14 +59,14 @@
int InputDevAdaptor::getInputDevices(const QString& typeName)
{
qDebug() << Q_FUNC_INFO << typeName;
- QString deviceSysPathString = Config::configuration()->value("global/device_sys_path").toString();
- QString devicePollFilePath = Config::configuration()->value("global/device_poll_file_path").toString();
+ QString deviceSysPathString = SensorFrameworkConfig::configuration()->value("global/device_sys_path").toString();
+ QString devicePollFilePath = SensorFrameworkConfig::configuration()->value("global/device_poll_file_path").toString();
int deviceNumber = 0;
deviceString_ = typeName;
// Check if this device name is defined in configuration
- QString deviceName = Config::configuration()->value<QString>(typeName + "/device", "");
+ QString deviceName = SensorFrameworkConfig::configuration()->value<QString>(typeName + "/device", "");
// Do not perform strict checks for the input device
if (deviceName.size() && checkInputDevice(deviceName, typeName, false)) {
@@ -90,8 +90,8 @@
}
QString pollConfigKey = QString(typeName + "/poll_file");
- if (Config::configuration()->exists(pollConfigKey)) {
- usedDevicePollFilePath_ = Config::configuration()->value<QString>(pollConfigKey, "");
+ if (SensorFrameworkConfig::configuration()->exists(pollConfigKey)) {
+ usedDevicePollFilePath_ = SensorFrameworkConfig::configuration()->value<QString>(pollConfigKey, "");
} else {
usedDevicePollFilePath_ = devicePollFilePath.arg(deviceNumber);
}
@@ -191,7 +191,7 @@
void InputDevAdaptor::init()
{
qDebug() << Q_FUNC_INFO << name();
- if (!getInputDevices(Config::configuration()->value<QString>(name() + "/input_match", name()))) {
+ if (!getInputDevices(SensorFrameworkConfig::configuration()->value<QString>(name() + "/input_match", name()))) {
sensordLogW() << "Input device not found.";
SysfsAdaptor::init();
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/core/loader.cpp
^
|
@@ -31,13 +31,19 @@
#include <QPluginLoader>
#include <QStringList>
#include <QList>
+#include <QDir>
#include <QCoreApplication>
#include "logging.h"
#include "config.h"
+#ifdef USE_SSUSYSINFO
+# include <ssusysinfo/ssusysinfo.h>
+#endif
+
Loader::Loader()
{
+ scanAvailablePlugins();
}
Loader& Loader::instance()
@@ -47,105 +53,189 @@
return the_loader;
}
-bool Loader::loadPluginFile(const QString& name, QString *errorString, QStringList& newPluginNames, QList<PluginBase*>& newPlugins) const
-{
- sensordLogT() << "Loading plugin:" << name;
+#define PLUGIN_PREFIX_ENV "SENSORFW_LIBRARY_PATH"
+#define PLUGIN_DIRECTORY "/usr/lib/sensord-qt5"
+#define PLUGIN_PREFIX "lib"
+#define PLUGIN_SUFFIX "-qt5.so"
+#define SENSOR_SUFFIX "sensor"
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
- QString pluginPath = QString::fromLatin1("/usr/lib/sensord/lib%1.so").arg(name);
-#else
- QString pluginPath;
- QByteArray env = qgetenv("SENSORFW_LIBRARY_PATH");
- if (env.isEmpty())
- pluginPath = QString::fromLatin1("/usr/lib/sensord-qt5/lib%1-qt5.so").arg(name);
- else
- pluginPath = QString::fromLatin1(env+"/usr/lib/sensord-qt5/lib%1-qt5.so").arg(name);
+static QString getPluginDirectory()
+{
+ QByteArray env = qgetenv(PLUGIN_PREFIX_ENV);
+ return QString::fromUtf8(env + PLUGIN_DIRECTORY);
+}
-#endif
+static QString getPluginPath(const QString &name)
+{
+ return QString("%1/" PLUGIN_PREFIX "%2" PLUGIN_SUFFIX).arg(getPluginDirectory()).arg(name);
+}
- QPluginLoader qpl(pluginPath);
+bool Loader::loadPluginFile(const QString &name, QString &errorString, QStringList &stack)
+{
+ const QString resolvedName(resolveRealPluginName(name));
+ QPluginLoader qpl(getPluginPath(resolvedName));
qpl.setLoadHints(QLibrary::ExportExternalSymbolsHint);
- if (!qpl.load()) {
- *errorString = qpl.errorString();
- sensordLogC() << "plugin loading error: " << *errorString;
- return false;
- }
-
- QObject* object = qpl.instance();
- if (!object) {
- *errorString = "not able to instanciate";
- sensordLogC() << "plugin loading error: " << *errorString;
- return false;
- }
-
- PluginBase* plugin = qobject_cast<PluginBase*>(object);
- if (!plugin) {
- *errorString = "not a Plugin type";
- sensordLogC() << "plugin loading error: " << *errorString;
- return false;
- }
-
- // Add plugins to the front of the list so they are initialized in reverse order. This will guarantee that dependencies are initialized first for each plugin.
- newPluginNames.prepend(name);
- newPlugins.prepend(plugin);
-
- // Get dependencies
- QStringList requiredPlugins(plugin->Dependencies());
- sensordLogT() << name << " requires: " << requiredPlugins;
-
- bool loaded = true;
- for (int i = 0; i < requiredPlugins.size() && loaded; ++i) {
- if (!(loadedPluginNames_.contains(requiredPlugins.at(i)) ||
- newPluginNames.contains(requiredPlugins.at(i))))
- {
- sensordLogT() << requiredPlugins.at(i) << " is not yet loaded, trying to load.";
- QString resolvedName = resolveRealPluginName(requiredPlugins.at(i));
- sensordLogT() << requiredPlugins.at(i) << " resolved as " << resolvedName << ". Loading";
- loaded = loadPluginFile(resolvedName, errorString, newPluginNames, newPlugins);
+ QObject *object = 0;
+ PluginBase *plugin = 0;
+ sensordLogD() << "Loader loading plugin:" << resolvedName << "as:" << name << "from:" << qpl.fileName();
+ bool loaded = false;
+ bool cyclic = stack.contains(resolvedName);
+ stack.prepend(resolvedName);
+ if (cyclic) {
+ errorString = "cyclic plugin dependency";
+ sensordLogC() << "Plugin has cyclic dependency:" << resolvedName;
+ } else if (loadedPluginNames_.contains(resolvedName)) {
+ sensordLogD() << "Plugin is already loaded:" << resolvedName;
+ loaded = true;
+ } else if (!pluginAvailable(resolvedName)) {
+ errorString = "plugin not available";
+ sensordLogW() << "Plugin not available:" << resolvedName;
+ } else if (!qpl.load()) {
+ errorString = qpl.errorString();
+ sensordLogC() << "Plugin loading error:" << resolvedName << "-" << errorString;
+ } else if (!(object = qpl.instance())) {
+ errorString = "not able to instanciate";
+ sensordLogC() << "Plugin loading error: " << resolvedName << "-" << errorString;
+ } else if (!(plugin = qobject_cast<PluginBase*>(object))) {
+ errorString = "not a Plugin type";
+ sensordLogC() << "Plugin loading error: " << resolvedName << "-" << errorString;
+ } else {
+ loaded = true;
+ QStringList dependencies(plugin->Dependencies());
+ sensordLogD() << resolvedName << "requires:" << dependencies;
+ foreach (const QString &dependency, dependencies) {
+ if (!(loaded = loadPluginFile(dependency, errorString, stack))) {
+ break;
+ }
+ }
+ if (loaded) {
+ plugin->Register(*this);
+ loadedPluginNames_.append(resolvedName);
+ plugin->Init(*this);
}
}
+ stack.removeOne(resolvedName);
+ if (!loaded) {
+ invalidatePlugin(resolvedName);
+ }
return loaded;
}
-bool Loader::loadPlugin(const QString& name, QString* errorString)
+bool Loader::loadPlugin(const QString& name, QString *errorString)
{
QString error;
- bool loaded = false;
- QStringList newPluginNames;
- QList<PluginBase*> newPlugins;
-
- if (loadedPluginNames_.contains(name)) {
- sensordLogD() << "Plugin already loaded.";
- return true;
+ QStringList stack;
+ bool loaded = loadPluginFile(name, error, stack);
+ if (!loaded && errorString) {
+ *errorString = error;
}
+ return loaded;
+}
- if (loadPluginFile(name, &error, newPluginNames, newPlugins)) {
+#ifdef USE_SSUSYSINFO
+static ssusysinfo_t *ssusysinfo = 0;
+#endif
- // Register newly loaded plugins
- foreach (PluginBase* base, newPlugins) {
- base->Register(*this);
+static bool evaluateAvailabilityValue(const QString &name, const QString &val)
+{
+ bool available = true;
+ if (val.startsWith("Feature_")) {
+#ifdef USE_SSUSYSINFO
+ const QStringList features(val.split("|"));
+ bool allow = false;
+ bool deny = false;
+ foreach(const QString &feature, features) {
+ hw_feature_t id = ssusysinfo_hw_feature_from_name(feature.toUtf8().constData());
+ if (id == Feature_Invalid ) {
+ sensordLogW() << "unknown hw feature:" << feature;
+ continue;
+ }
+ if( ssusysinfo_has_hw_feature(ssusysinfo, id) ) {
+ allow = true;
+ break;
+ }
+ deny = true;
}
- loadedPluginNames_.append(newPluginNames);
- loaded = true;
+ if( deny && !allow ) {
+ sensordLogD() << "plugin disabled in hw-config: " << name << "value" << val;
+ available = false;
+ }
+#else
+ // When compiled without ssu-support, these are enabled by design
+ sensordLogD() << "sensor plugin enabled implicitly: " << name << "value" << val;
+#endif
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/core/loader.h
^
|
@@ -50,8 +50,31 @@
* @param name plugin name.
* @param errorMessage object to write error message if plugin loading
* fails. If NULL then error message is not written.
+ * @return true on success, false on failure
*/
- bool loadPlugin(const QString& name, QString* errorMessage = 0);
+ bool loadPlugin(const QString &name, QString *errorMessage = 0);
+
+ /**
+ * Test if a plugin is available for loading
+ *
+ * @param name plugin name
+ * @return true if plugin is available, false if not
+ */
+ bool pluginAvailable(const QString &name) const;
+
+ /**
+ * Get a list of plugins available for loading
+ *
+ * @return Array of plugin names
+ */
+ QStringList availablePlugins() const;
+
+ /**
+ * Get a list of sensor plugins available for loading
+ *
+ * @return Array of plugin names
+ */
+ QStringList availableSensorPlugins() const;
private:
Loader();
@@ -63,10 +86,11 @@
*
* @param name plugin to load.
* @param errorString object to write error message if plugin loading fails.
- * @param newPluginNames List of new loaded plugin names.
- * @param newPlugin List of new loaded plugin objects.
+ * @param stack Pending plugin load stack for detecting circular dependencies.
*/
- bool loadPluginFile(const QString& name, QString *errorString, QStringList& newPluginNames, QList<PluginBase*>& newPlugins) const;
+ bool loadPluginFile(const QString &name, QString &errorString, QStringList &stack);
+
+ void invalidatePlugin(const QString &name);
/**
* Resolve plugin name.
@@ -74,9 +98,13 @@
* @param pluginName plugin name.
* @return resolved plugin name.
*/
- QString resolveRealPluginName(const QString& pluginName) const;
+ QString resolveRealPluginName(const QString &pluginName) const;
QStringList loadedPluginNames_; /**< list of loaded plugins */
+
+ QStringList availablePluginNames_; /**< list of loaded plugins */
+
+ void scanAvailablePlugins();
};
#endif
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/core/logging.h
^
|
@@ -29,10 +29,9 @@
#include <QDebug>
-#define sensordLogT() (qDebug())
-#define sensordLogD() (qDebug())
-#define sensordLogW() (qWarning())
-#define sensordLogC() (qCritical())
-#define sensordLog() (qDebug())
+#define sensordLogT(ARGS_...) (qDebug(ARGS_))
+#define sensordLogD(ARGS_...) (qInfo(ARGS_))
+#define sensordLogW(ARGS_...) (qWarning(ARGS_))
+#define sensordLogC(ARGS_...) (qCritical(ARGS_))
#endif //LOGGING_H
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/core/nodebase.cpp
^
|
@@ -80,14 +80,14 @@
{
if (!m_dataRangeList.contains(range))
{
- sensordLogD() << "Introduced new data range: " << range.min << "-" << range.max << ", " << range.resolution;
+ sensordLogD() << "Introduced new data range for '" << id_ << "':" << range.min << "-" << range.max << "," << range.resolution;
m_dataRangeList.append(range);
}
}
void NodeBase::introduceAvailableDataRanges(const QString& typeName)
{
- QVariant ranges = Config::configuration()->value(typeName + "/dataranges");
+ QVariant ranges = SensorFrameworkConfig::configuration()->value(typeName + "/dataranges");
if(ranges.isValid())
{
DataRangeList list(parseDataRangeList(ranges.toString(), 1));
@@ -273,14 +273,14 @@
{
if (!m_intervalList.contains(interval))
{
- sensordLogD() << "Introduced new interval: " << interval.min << "-" << interval.max;
+ sensordLogD() << "Introduced new interval for '" << id_ << "':" << interval.min << "-" << interval.max;
m_intervalList.append(interval);
}
}
void NodeBase::introduceAvailableIntervals(const QString& typeName)
{
- QVariant ranges = Config::configuration()->value(typeName + "/intervals");
+ QVariant ranges = SensorFrameworkConfig::configuration()->value(typeName + "/intervals");
if(ranges.isValid())
{
DataRangeList list(parseDataRangeList(ranges.toString(), 0));
@@ -375,7 +375,7 @@
bool NodeBase::setStandbyOverrideRequest(const int sessionId, const bool override)
{
- sensordLogD() << sessionId << " requested standbyoverride for '" << id() << "' :" << override;
+ sensordLogD() << sessionId << "requested standbyoverride for '" << id() << "' :" << override;
// Only store true requests, id is enough, no need for value
if (override == false)
{
@@ -459,7 +459,7 @@
{
if (!isValidIntervalRequest(value))
{
- sensordLogW() << "Attempting to define invalid default data rate: " << value;
+ sensordLogW() << "Attempting to define invalid default data rate:" << value;
return false;
}
m_defaultInterval = value;
@@ -711,36 +711,41 @@
{
Q_UNUSED(range);
Q_UNUSED(sessionId);
+ sensordLogD() << __func__ << "not implemented in some node using it.";
return false;
}
bool NodeBase::setStandbyOverride(bool override)
{
Q_UNUSED(override);
+ sensordLogD() << __func__ << "not implemented in some node using it.";
return false;
}
unsigned int NodeBase::interval() const
{
+ sensordLogD() << __func__ << "not implemented in some node using it.";
return 0;
}
bool NodeBase::setInterval(unsigned int value, int sessionId)
{
- sensordLogW() << "setInterval() not implemented in some node using it.";
Q_UNUSED(value);
Q_UNUSED(sessionId);
+ sensordLogD() << __func__ << "not implemented in some node using it.";
return false;
}
bool NodeBase::setBufferSize(unsigned int value)
{
Q_UNUSED(value);
+ sensordLogD() << __func__ << "not implemented in some node using it.";
return false;
}
bool NodeBase::setBufferInterval(unsigned int value)
{
Q_UNUSED(value);
+ sensordLogD() << __func__ << "not implemented in some node using it.";
return false;
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/core/sensormanager.cpp
^
|
@@ -310,7 +310,7 @@
void SensorManager::removeSensor(const QString& id)
{
- sensordLogD() << "Removing sensor: " << id;
+ sensordLogD() << "SensorManager removing sensor:" << id;
QMap<QString, SensorInstanceEntry>::iterator entryIt = sensorInstanceMap_.find(id);
bus().unregisterObject(OBJECT_PATH + "/" + id);
@@ -321,7 +321,7 @@
bool SensorManager::loadPlugin(const QString& name)
{
- sensordLogD() << "Loading plugin: " << name;
+ sensordLogD() << "SensorManager loading plugin:" << name;
QString errorMessage;
bool result;
@@ -333,9 +333,27 @@
return result;
}
+QStringList SensorManager::availablePlugins() const
+{
+ Loader& l = Loader::instance();
+ return l.availablePlugins();
+}
+
+bool SensorManager::pluginAvailable(const QString &name) const
+{
+ Loader& l = Loader::instance();
+ return l.pluginAvailable(name);
+}
+
+QStringList SensorManager::availableSensorPlugins() const
+{
+ Loader& l = Loader::instance();
+ return l.availableSensorPlugins();
+}
+
int SensorManager::requestSensor(const QString& id)
{
- sensordLogD() << "Requesting sensor: " << id;
+ sensordLogD() << "Requesting sensor:" << id;
clearError();
@@ -440,7 +458,7 @@
{
chain = chainFactoryMap_[type](id);
Q_ASSERT(chain);
- sensordLogD() << "Instantiated chain '" << id << "'. Valid = " << chain->isValid();
+ sensordLogD() << "Instantiated chain '" << id << "'. Valid =" << chain->isValid();
entryIt.value().cnt_++;
entryIt.value().chain_ = chain;
@@ -499,7 +517,7 @@
DeviceAdaptor* SensorManager::requestDeviceAdaptor(const QString& id)
{
- sensordLogD() << "Requesting adaptor: " << id;
+ sensordLogD() << "Requesting adaptor:" << id;
clearError();
if( id.contains(';') ) // no parameter passing in release
@@ -517,7 +535,7 @@
Q_ASSERT( entryIt.value().adaptor_ );
da = entryIt.value().adaptor_;
entryIt.value().cnt_++;
- sensordLogD() << "Found adaptor '" << id << "'. Ref count: " << entryIt.value().cnt_;
+ sensordLogD() << "Found adaptor '" << id << "'. Ref count:" << entryIt.value().cnt_;
}
else
{
@@ -538,7 +556,7 @@
{
entryIt.value().adaptor_ = da;
entryIt.value().cnt_++;
- sensordLogD() << "Instantiated adaptor '" << id << "'. Valid = " << da->isValid();
+ sensordLogD() << "Instantiated adaptor '" << id << "'. Valid =" << da->isValid();
}
else
{
@@ -563,7 +581,7 @@
void SensorManager::releaseDeviceAdaptor(const QString& id)
{
- sensordLogD() << "Releasing adaptor: " << id;
+ sensordLogD() << "Releasing adaptor:" << id;
clearError();
if( id.contains(';') ) // no parameter passing in release
@@ -594,7 +612,7 @@
}
else
{
- sensordLogD() << "Adaptor '" << id << "' has ref count: " << entryIt.value().cnt_;
+ sensordLogD() << "Adaptor '" << id << "' has ref count:" << entryIt.value().cnt_;
}
}
else
@@ -610,7 +628,7 @@
FilterBase* SensorManager::instantiateFilter(const QString& id)
{
- sensordLogD() << "Instantiating filter: " << id;
+ sensordLogD() << "Instantiating filter:" << id;
QMap<QString, FilterFactoryMethod>::iterator it = filterFactoryMap_.find(id);
if(it == filterFactoryMap_.end())
@@ -673,7 +691,7 @@
void SensorManager::displayStateChanged(bool displayState)
{
- sensordLogD() << "Signal detected, display state changed to: " << displayState;
+ sensordLogD() << "Signal detected, display state changed to:" << displayState;
if (displayState) {
/// Emit signal to make background calibration resume from sleep
emit displayOn();
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/core/sensormanager.h
^
|
@@ -277,6 +277,27 @@
bool loadPlugin(const QString& name);
/**
+ * Test if a plugin is available
+ *
+ * @return true if plugin exists, false otherwise
+ */
+ bool pluginAvailable(const QString &name) const;
+
+ /**
+ * List all available plugins.
+ *
+ * @return array of plugin names
+ */
+ QStringList availablePlugins() const;
+
+ /**
+ * List available sensor plugins.
+ *
+ * @return array of plugin names
+ */
+ QStringList availableSensorPlugins() const;
+
+ /**
* Request sensor.
*
* @param id Sensor ID.
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/core/sensormanager_a.cpp
^
|
@@ -54,16 +54,31 @@
return sensorManager()->loadPlugin(name);
}
+QStringList SensorManagerAdaptor::availablePlugins() const
+{
+ return sensorManager()->availablePlugins();
+}
+
+bool SensorManagerAdaptor::pluginAvailable(const QString &name) const
+{
+ return sensorManager()->pluginAvailable(name);
+}
+
+QStringList SensorManagerAdaptor::availableSensorPlugins() const
+{
+ return sensorManager()->availableSensorPlugins();
+}
+
int SensorManagerAdaptor::requestSensor(const QString &id, qint64 pid)
{
int session = sensorManager()->requestSensor(id);
- sensordLog() << "Sensor '" << id << "' requested. Created session: " << session << ". Client PID: " << pid;
+ sensordLogD() << "Sensor '" << id << "' requested. Created session: " << session << ". Client PID: " << pid;
return session;
}
bool SensorManagerAdaptor::releaseSensor(const QString &id, int sessionId, qint64 pid)
{
- sensordLog() << "Sensor '" << id << "' release requested for session " << sessionId << ". Client PID: " << pid;
+ sensordLogD() << "Sensor '" << id << "' release requested for session " << sessionId << ". Client PID: " << pid;
return sensorManager()->releaseSensor(id, sessionId);
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/core/sensormanager_a.h
^
|
@@ -88,6 +88,27 @@
bool loadPlugin(const QString& name);
/**
+ * Test if a plugin is available
+ *
+ * @return true if plugin exists, false otherwise
+ */
+ bool pluginAvailable(const QString& name) const;
+
+ /**
+ * List all available plugins.
+ *
+ * @return array of plugin names
+ */
+ QStringList availablePlugins() const;
+
+ /**
+ * List available sensor plugins.
+ *
+ * @return array of plugin names
+ */
+ QStringList availableSensorPlugins() const;
+
+ /**
* Request new sensor session to be created.
*
* @param id Sensor ID.
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/core/sysfsadaptor.cpp
^
|
@@ -478,7 +478,7 @@
void SysfsAdaptor::init()
{
- QString path = Config::configuration()->value(name() + "/path").toString();
+ QString path = SensorFrameworkConfig::configuration()->value(name() + "/path").toString();
if(!path.isEmpty())
{
addPath(path);
@@ -487,10 +487,10 @@
{
sensordLogW() << "No sysfs path defined for: " << name();
}
- mode_ = (PollMode)Config::configuration()->value<int>(name() + "/mode", mode_);
- doSeek_ = Config::configuration()->value<bool>(name() + "/seek", doSeek_);
+ mode_ = (PollMode)SensorFrameworkConfig::configuration()->value<int>(name() + "/mode", mode_);
+ doSeek_ = SensorFrameworkConfig::configuration()->value<bool>(name() + "/seek", doSeek_);
introduceAvailableDataRanges(name());
introduceAvailableIntervals(name());
- setDefaultInterval(Config::configuration()->value<int>(name() + "/default_interval", 0));
+ setDefaultInterval(SensorFrameworkConfig::configuration()->value<int>(name() + "/default_interval", 0));
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/debian/changelog
^
|
@@ -94,13 +94,13 @@
* Proximity sensor dataflow now uses datatype ProximityData.
* ProximitySensorChannelInterface provides signal and accessor for getting proximity reading with reflectance value.
* c-api removed from doxygen targets.
- * Config-class now better handles errors.
+ * SensorFrameworkConfig-class now better handles errors.
* AccelerometerAdaptor used for some reason OrientationData. Should have
been AccelerometerData. Only cosmetic change.
* Implemented new downsampling logic (Fixes: NB#234563):
- AccelerometerAdaptor, MagnetometerAdaptor and RotationSensorChannel interval rangelist has been limited to certain sizes.
- AccelerometerSensorChannel, RotationSensorChannel and MagnetometerSensorChannel downsamples data before propagating it.
- * Config-class has now more friendly API.
+ * SensorFrameworkConfig-class has now more friendly API.
* sensorfw-qt5testapp improvements.
* API documentation improvements.
* Improved dataflowtests.
@@ -431,7 +431,7 @@
- Replaced direct usage of qDebug() with logging macros.
- Improved error-handling in Loader.
- Sensorfw-Qt5Logger now correctly prints QStrings.
- - Config/Logging singletons are now unloaded before exitting from main().
+ - SensorFrameworkConfig/Logging singletons are now unloaded before exitting from main().
-- Timo Rongas <ext-timo.2.rongas@nokia.com> Tue, 21 Sep 2010 10:32:41 +0300
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/debian/rules
^
|
@@ -48,7 +48,7 @@
dh_testdir
# Add here commands to configure the package.
- cd $(BUILD_DIR) && qmake $(QMAKECONFIG) CONFIG+="configs" "QMAKE_CXXFLAGS=$(CFLAGS)" "MAKE_DOCS=$(MAKE_DOCS)" ../$(PROJECT_NAME).pro
+ cd $(BUILD_DIR) && qmake $(QMAKECONFIG) CONFIG+="configs" CONFIG+="autohybris" "QMAKE_CXXFLAGS=$(CFLAGS)" "MAKE_DOCS=$(MAKE_DOCS)" ../$(PROJECT_NAME).pro
export LD_RUN_PATH=/usr/lib/sensord-qt5/
touch configure-stamp
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/doc/PLUGIN-GUIDE
^
|
@@ -221,7 +221,8 @@
(1) /etc/sensorfw/sensord.conf
(2) /etc/sensorfw/sensord.conf.d/
-Any option set in (1) will override options set in any of the files in (2). Files in (2) are given priority based on alphanumeric order. Using double-digits as the beginning of the filename for clarity is encouraged.
+Any option set in (1) will override options set in any of the files in (2). Files in (2) are processed in alpha-numerical order, and later files can override settings from earlier files. Using double-digits as the beginning of the filename for clarity is encouraged.
+
Configuration files contain sections for different HW. These sections should connect plugin metanames (sampleadaptor) with the real plugin that should be used (sampleadaptor-inputdev). The configuration file also contains option 'deviceId', which specifies which section should be used. This will be removed once we have automatic detection of underlying HW in place.
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/doc/mainpage.h
^
|
@@ -694,9 +694,9 @@
(1) /etc/sensorfw/sensord.conf
(2) /etc/sensorfw/sensord.conf.d/
-Any option set in (1) will override options set in any of the files in (2). Files in (2) are given
-priority based on alphanumeric order. Using double-digits as the beginning of the filename for
-clarity is encouraged.
+Any option set in (1) will override options set in any of the files in (2). Files in (2) are
+processed in alpha-numerical order, and later files can override settings from earlier files.
+Using double-digits as the beginning of the filename for clarity is encouraged.
Configuration files contain sections for different HW. These sections should connect plugin
metanames (sampleadaptor) with the real plugin that should be used (sampleadaptor-inputdev).
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/filters/declinationfilter/declinationfilter.cpp
^
|
@@ -37,7 +37,7 @@
Filter<CompassData, DeclinationFilter, CompassData>(this, &DeclinationFilter::correct),
declinationCorrection_(0)
{
- updateInterval_ = Config::configuration()->value<quint64>("compass/declination_update_interval", 1000 * 60 * 60) * 1000;
+ updateInterval_ = SensorFrameworkConfig::configuration()->value<quint64>("compass/declination_update_interval", 1000 * 60 * 60) * 1000;
loadSettings();
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/filters/orientationinterpreter/orientationinterpreter.cpp
^
|
@@ -59,13 +59,13 @@
addSource(&faceSource, "face");
addSource(&orientationSource, "orientation");
- minLimit = Config::configuration()->value("orientation/overflow_min", QVariant(OVERFLOW_MIN)).toInt();
- maxLimit = Config::configuration()->value("orientation/overflow_max", QVariant(OVERFLOW_MAX)).toInt();
+ minLimit = SensorFrameworkConfig::configuration()->value("orientation/overflow_min", QVariant(OVERFLOW_MIN)).toInt();
+ maxLimit = SensorFrameworkConfig::configuration()->value("orientation/overflow_max", QVariant(OVERFLOW_MAX)).toInt();
- angleThresholdPortrait = Config::configuration()->value("orientation/threshold_portrait",QVariant(THRESHOLD_PORTRAIT)).toInt();
- angleThresholdLandscape = Config::configuration()->value("orientation/threshold_landscape",QVariant(THRESHOLD_LANDSCAPE)).toInt();
- discardTime = Config::configuration()->value("orientation/discard_time", QVariant(DISCARD_TIME)).toUInt();
- maxBufferSize = Config::configuration()->value("orientation/buffer_size", QVariant(AVG_BUFFER_MAX_SIZE)).toInt();
+ angleThresholdPortrait = SensorFrameworkConfig::configuration()->value("orientation/threshold_portrait",QVariant(THRESHOLD_PORTRAIT)).toInt();
+ angleThresholdLandscape = SensorFrameworkConfig::configuration()->value("orientation/threshold_landscape",QVariant(THRESHOLD_LANDSCAPE)).toInt();
+ discardTime = SensorFrameworkConfig::configuration()->value("orientation/discard_time", QVariant(DISCARD_TIME)).toUInt();
+ maxBufferSize = SensorFrameworkConfig::configuration()->value("orientation/buffer_size", QVariant(AVG_BUFFER_MAX_SIZE)).toInt();
// Open the handle for boosting cpu on changes that affect orientation
if (cpuBoostFile.exists()) {
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/sensord/calibrationhandler.cpp
^
|
@@ -41,8 +41,8 @@
{
m_timer.setSingleShot(true);
- m_calibRate = Config::configuration()->value<int>("magnetometer/calibration_rate", 100);
- m_calibTimeout = Config::configuration()->value<int>("magnetometer/calibration_timeout", 60000);
+ m_calibRate = SensorFrameworkConfig::configuration()->value<int>("magnetometer/calibration_rate", 100);
+ m_calibTimeout = SensorFrameworkConfig::configuration()->value<int>("magnetometer/calibration_timeout", 60000);
}
CalibrationHandler::~CalibrationHandler()
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/sensord/main.cpp
^
|
@@ -1,5 +1,3 @@
-
-
/**
@file main.cpp
@brief Sensord initiation point
@@ -32,13 +30,16 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QDebug>
+#include <QSocketNotifier>
#include <systemd/sd-daemon.h>
+#include <unistd.h>
#include <signal.h>
#include <iostream>
#include <errno.h>
#include <unistd.h>
+#include <fcntl.h>
#include "config.h"
#include "sensormanager.h"
@@ -50,9 +51,27 @@
static QtMsgType logLevel;
static QtMessageHandler previousMessageHandler;
+static int normalizeLevel(QtMsgType type)
+{
+ /* Map QtMsgType enum values to something that hopefully
+ * makes sense in less-than / greater-than sense too. */
+ switch (type) {
+ case QtDebugMsg:
+ return 0;
+ case QtInfoMsg:
+ return 1;
+ case QtWarningMsg:
+ return 3;
+ case QtCriticalMsg:
+ return 4;
+ default:
+ return static_cast<int>(type);
+ }
+}
+
static void messageOutput(QtMsgType type, const QMessageLogContext &context, const QString &str)
{
- if (type < logLevel)
+ if (normalizeLevel(type) < normalizeLevel(logLevel))
return;
previousMessageHandler(type, context, str);
@@ -63,11 +82,14 @@
void signalUSR1(int param)
{
Q_UNUSED(param);
-
- logLevel = QtMsgType(logLevel + 1);
- if (logLevel > QtSystemMsg)
+ if (logLevel != QtDebugMsg) {
logLevel = QtDebugMsg;
- qDebug() << "New debugging level: " << logLevel;
+ sensordLogW() << "Debug logging enabled";
+ }
+ else {
+ logLevel = QtWarningMsg;
+ sensordLogW() << "Debug logging disabled";
+ }
}
void signalUSR2(int param)
@@ -87,10 +109,92 @@
void signalINT(int param)
{
- Q_UNUSED(param);
+ signal(param, SIG_DFL);
+ sensordLogD() << "Terminating ...";
QCoreApplication::exit(0);
}
+class SignalNotifier : public QObject
+{
+public:
+ SignalNotifier();
+ ~SignalNotifier();
+private slots:
+ void handleSignalInput(int socket);
+private:
+ static void handleAsyncSignal(int sig);
+ QSocketNotifier *m_socketNotifier;
+ static int s_pipe[2];
+ static const int s_signals[];
+};
+
+SignalNotifier::SignalNotifier()
+ : m_socketNotifier(0)
+{
+ sensordLogD() << "Setup async signal handlers";
+ if (pipe2(s_pipe, O_CLOEXEC) == -1) {
+ qFatal("Failed to create a pipe for signal passunc");
+ }
+ m_socketNotifier = new QSocketNotifier(s_pipe[0], QSocketNotifier::Read, this);
+ connect(m_socketNotifier, &QSocketNotifier::activated,
+ this, &SignalNotifier::handleSignalInput);
+ struct sigaction action;
+ memset(&action, 0, sizeof action);
+ action.sa_handler = handleAsyncSignal;
+ sigemptyset(&action.sa_mask);
+ action.sa_flags = SA_RESTART;
+ for (size_t i = 0; s_signals[i] != -1; ++i )
+ sigaction(s_signals[i], &action, 0);
+}
+
+SignalNotifier::~SignalNotifier()
+{
+ sensordLogD() << "Reset async signal handlers";
+ for (size_t i = 0; s_signals[i] != -1; ++i )
+ signal(s_signals[i], SIG_DFL);
+ delete m_socketNotifier; m_socketNotifier = 0;
+ close(s_pipe[1]), s_pipe[1] = -1;
+ close(s_pipe[0]), s_pipe[0] = -1;
+}
+
+void SignalNotifier::handleAsyncSignal(int sig)
+{
+ /* Can call only async-signal safe functions! */
+ if (write(s_pipe[1], &sig, sizeof sig) == -1) {
+ _exit(EXIT_FAILURE);
+ }
+}
+
+void SignalNotifier::handleSignalInput(int socket)
+{
+ Q_UNUSED(socket);
+ int sig = SIGTERM;
+ uint64_t tmp = 0;
+ if (read(s_pipe[0], &sig, sizeof sig) == -1) {
+ // dontcare
+ }
+ sensordLogD() << "Caught async signal" << strsignal(sig);
+ switch (sig) {
+ case SIGINT:
+ case SIGTERM:
+ signalINT(sig);
+ break;
+ case SIGUSR1:
+ signalUSR1(sig);
+ break;
+ case SIGUSR2:
+ signalUSR2(sig);
+ break;
+ };
+}
+
+int SignalNotifier::s_pipe[2] = { -1, -1 };
+
+const int SignalNotifier::s_signals[] =
+{
+ SIGINT, SIGTERM, SIGUSR1, SIGUSR2, -1
+};
+
int main(int argc, char *argv[])
{
previousMessageHandler = qInstallMessageHandler(messageOutput);
@@ -123,20 +227,16 @@
defConfigDir = parser.configDirPath();
}
- if (!Config::loadConfig(defConfigFile, defConfigDir))
+ if (!SensorFrameworkConfig::loadConfig(defConfigFile, defConfigDir))
{
- sensordLogC() << "Config file error! Load using default paths.";
- if (!Config::loadConfig(CONFIG_FILE_PATH, CONFIG_DIR_PATH))
+ sensordLogC() << "SensorFrameworkConfig file error! Load using default paths.";
+ if (!SensorFrameworkConfig::loadConfig(CONFIG_FILE_PATH, CONFIG_DIR_PATH))
{
sensordLogC() << "Which also failed. Bailing out";
return 1;
}
}
- signal(SIGUSR1, signalUSR1);
- signal(SIGUSR2, signalUSR2);
- signal(SIGINT, signalINT);
-
if (parser.createDaemon())
{
fflush(0);
@@ -182,9 +282,12 @@
sd_notify(0, "READY=1");
}
+ SignalNotifier *signalNotifier = new SignalNotifier();
int ret = app.exec();
+ delete signalNotifier; signalNotifier = 0;
+
sensordLogD() << "Exiting...";
- Config::close();
+ SensorFrameworkConfig::close();
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/sensord/parser.cpp
^
|
@@ -56,8 +56,10 @@
{
data = opt.split("=");
QString logLevel = data.at(1);
- if (logLevel == "test" || logLevel == "debug")
+ if (logLevel == "test")
logLevel_ = QtDebugMsg;
+ else if (logLevel == "debug")
+ logLevel_ = QtInfoMsg;
else if (logLevel == "warning")
logLevel_ = QtWarningMsg;
else if (logLevel == "critical")
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/sensorfw.pro
^
|
@@ -1,5 +1,17 @@
-load(configure)
-qtCompileTest(hybris)
+# RPM build: Hybris plugin has separate spec file that does:
+# qmake CONFIG+=hybris
+# And pro-file behavioral differences are handled via:
+# contains(CONFIG,hybris) { ... }
+#
+# Debian builds: debian/rules triggers build time hybris check:
+# qmake CONFIG+=autohybris
+# And pro-file behavioral differences are handled via:
+# config_hybris { ... }
+
+contains(CONFIG,autohybris) {
+ load(configure)
+ qtCompileTest(hybris)
+}
TEMPLATE = subdirs
CONFIG += ordered
@@ -92,7 +104,8 @@
DBUSCONFIGFILES.path = /etc/dbus-1/system.d
INSTALLS += DBUSCONFIGFILES
- SENSORDCONFIGFILES.files = config/90-sensord-default.conf
+ SENSORDCONFIGFILES.files = config/10-sensord-default.conf
+ SENSORDCONFIGFILES.files += config/20-sensors-default.conf
SENSORDCONFIGFILES.path = /etc/sensorfw/sensord.conf.d
INSTALLS += SENSORDCONFIGFILES
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/sensors/contextplugin/orientationbin.cpp
^
|
@@ -101,7 +101,7 @@
start();
orientationChain->start();
- unsigned int pollInterval = Config::configuration()->value("context/orientation_poll_interval", QVariant(POLL_INTERVAL)).toUInt();
+ unsigned int pollInterval = SensorFrameworkConfig::configuration()->value("context/orientation_poll_interval", QVariant(POLL_INTERVAL)).toUInt();
orientationChain->setIntervalRequest(sessionId, pollInterval);
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/sensors/contextplugin/screeninterpreterfilter.cpp
^
|
@@ -47,7 +47,7 @@
topEdge("top")
{
// Get offset from config
- offset = Config::configuration()->value("context/orientation_offset", QVariant(0)).toInt();
+ offset = SensorFrameworkConfig::configuration()->value("context/orientation_offset", QVariant(0)).toInt();
}
void ScreenInterpreterFilter::interpret(unsigned, const PoseData* data)
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/sensors/contextplugin/stabilityfilter.cpp
^
|
@@ -38,7 +38,7 @@
unstableProperty(unstableProperty)
{
connect(&timer, SIGNAL(timeout()), this, SLOT(timeoutTriggered()));
- timeout = Config::configuration()->value("context/stability_timeout", QVariant(defaultTimeout)).toInt() * 1000;
+ timeout = SensorFrameworkConfig::configuration()->value("context/stability_timeout", QVariant(defaultTimeout)).toInt() * 1000;
}
void StabilityFilter::interpret(unsigned, const QPair<double, double>* data)
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/sensors/magnetometersensor/magnetometerscalefilter.cpp
^
|
@@ -30,7 +30,7 @@
MagnetometerScaleFilter::MagnetometerScaleFilter() :
Filter<CalibratedMagneticFieldData, MagnetometerScaleFilter, CalibratedMagneticFieldData>(this, &MagnetometerScaleFilter::filter)
{
- factor = Config::configuration()->value("magnetometer/scale_coefficient", QVariant(1)).toInt();
+ factor = SensorFrameworkConfig::configuration()->value("magnetometer/scale_coefficient", QVariant(1)).toInt();
}
void MagnetometerScaleFilter::filter(unsigned, const CalibratedMagneticFieldData* data)
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/sensors/magnetometersensor/magnetometersensor.cpp
^
|
@@ -49,7 +49,7 @@
magnetometerReader_ = new BufferReader<CalibratedMagneticFieldData>(1);
- scaleCoefficient_ = Config::configuration()->value("magnetometer/scale_coefficient", QVariant(300)).toInt();
+ scaleCoefficient_ = SensorFrameworkConfig::configuration()->value("magnetometer/scale_coefficient", QVariant(300)).toInt();
if (scaleCoefficient_ != 1)
{
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/sensors/proximitysensor/proximityplugin.cpp
^
|
@@ -30,7 +30,7 @@
void ProximityPlugin::Register(class Loader&)
{
- sensordLog() << "registering proximitysensor";
+ sensordLogD() << "registering proximitysensor";
SensorManager& sm = SensorManager::instance();
sm.registerSensor<ProximitySensorChannel>("proximitysensor");
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/tests/adaptors/adaptortest.cpp
^
|
@@ -45,7 +45,7 @@
void AdaptorTest::initTestCase()
{
- Config::loadConfig("/etc/sensorfw/sensord.conf", "/etc/sensorfw/sensord.conf.d");
+ SensorFrameworkConfig::loadConfig("/etc/sensorfw/sensord.conf", "/etc/sensorfw/sensord.conf.d");
}
void AdaptorTest::init() {}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/tests/chains/chainstest.cpp
^
|
@@ -33,7 +33,7 @@
void ChainTest::initTestCase()
{
- Config::loadConfig("/etc/sensorfw/sensord.conf", "/etc/sensorfw/sensord.conf.d");
+ SensorFrameworkConfig::loadConfig("/etc/sensorfw/sensord.conf", "/etc/sensorfw/sensord.conf.d");
}
void ChainTest::init() {}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/tests/dataflow/dataflowtests.cpp
^
|
@@ -47,7 +47,7 @@
void DataFlowTest::initTestCase()
{
- Config::loadConfig("/etc/sensorfw/sensord.conf", "/etc/sensorfw/sensord.conf.d");
+ SensorFrameworkConfig::loadConfig("/etc/sensorfw/sensord.conf", "/etc/sensorfw/sensord.conf.d");
// Initialise sensormanager
SensorManager& sm = SensorManager::instance();
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/tests/filters/filtertests.cpp
^
|
@@ -44,7 +44,7 @@
void FilterApiTest::initTestCase()
{
- Config::loadConfig(CONFIG_FILE_PATH, CONFIG_DIR_PATH);
+ SensorFrameworkConfig::loadConfig(CONFIG_FILE_PATH, CONFIG_DIR_PATH);
}
/**
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/tests/testapp/abstractsensorhandler.cpp
^
|
@@ -38,13 +38,13 @@
frameCount_(0),
downsample_(false)
{
- if (Config::configuration() != NULL)
+ if (SensorFrameworkConfig::configuration() != NULL)
{
- interval_ = Config::configuration()->value(sensorName_ + "/interval", 100);
- bufferinterval_ = Config::configuration()->value(sensorName_ + "/bufferinterval", 0);
- standbyoverride_ = Config::configuration()->value(sensorName_ + "/standbyoverride", false);
- buffersize_ = Config::configuration()->value(sensorName_ + "/buffersize", 0);
- downsample_ = Config::configuration()->value(sensorName_ + "/downsample", false);
+ interval_ = SensorFrameworkConfig::configuration()->value(sensorName_ + "/interval", 100);
+ bufferinterval_ = SensorFrameworkConfig::configuration()->value(sensorName_ + "/bufferinterval", 0);
+ standbyoverride_ = SensorFrameworkConfig::configuration()->value(sensorName_ + "/standbyoverride", false);
+ buffersize_ = SensorFrameworkConfig::configuration()->value(sensorName_ + "/buffersize", 0);
+ downsample_ = SensorFrameworkConfig::configuration()->value(sensorName_ + "/downsample", false);
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-0.10.8.tar.bz2/tests/testapp/clientadmin.cpp
^
|
@@ -51,24 +51,24 @@
if (parser.configFileInput())
{
QString defConfigFile = parser.configFilePath();
- if (Config::loadConfig(defConfigFile, ""))
- sensordLogT() << "Config file is loading successfully.";
+ if (SensorFrameworkConfig::loadConfig(defConfigFile, ""))
+ sensordLogT() << "SensorFrameworkConfig file is loading successfully.";
else
{
- sensordLogW() << "Config file error! Load using default path.";
- Config::loadConfig(CONFIG_FILE_PATH, "");
+ sensordLogW() << "SensorFrameworkConfig file error! Load using default path.";
+ SensorFrameworkConfig::loadConfig(CONFIG_FILE_PATH, "");
}
} else {
- Config::loadConfig(CONFIG_FILE_PATH, "");
+ SensorFrameworkConfig::loadConfig(CONFIG_FILE_PATH, "");
}
- if (Config::configuration() == NULL)
+ if (SensorFrameworkConfig::configuration() == NULL)
{
sensordLogC() << "Failed to load configuration. Aborting.";
exit(EXIT_FAILURE);
}
- if (!SensorHandler::init(Config::configuration()->groups()))
+ if (!SensorHandler::init(SensorFrameworkConfig::configuration()->groups()))
{
sensordLogC() << "Failed to initialize SensorHandler. Aborting.";
exit(EXIT_FAILURE);
@@ -79,9 +79,9 @@
{
init();
- foreach (const QString& sensorName, Config::configuration()->groups())
+ foreach (const QString& sensorName, SensorFrameworkConfig::configuration()->groups())
{
- int count = Config::configuration()->value<int>(sensorName + "/instances", 0);
+ int count = SensorFrameworkConfig::configuration()->value<int>(sensorName + "/instances", 0);
for(int i = 0; i < count; ++i)
{
SensorHandler* handler = new SensorHandler(sensorName, this);
@@ -120,5 +120,5 @@
}
delete handler;
}
- Config::close();
+ SensorFrameworkConfig::close();
}
|
[-]
[+]
|
Deleted |
_service:tar_git:hybris-libsensorfw-qt5-0.9.6.tar.bz2/.gitignore
^
|
@@ -1,29 +0,0 @@
-Makefile
-*.o
-moc_*
-.qmake.cache
-RPMS/
-*.so
-*.so.*
-*.swp
-config.log
-core/Makefile.hybris
-documentation.list
-installroot/
-doc/html/
-sensord/sensorfwd
-tests/adaptors/sensoradaptors-test
-tests/benchmark/benchmarktest/sensorbenchmark-test
-tests/benchmark/dummyclient/sensordummyclient-qt5
-tests/chains/sensorchains-test
-tests/client/sensorapi-test
-tests/dataflow/sensordataflow-test
-tests/deadclient/sensord-deadclient
-tests/filters/sensorfilters-test
-tests/metadata/sensormetadata-test
-tests/powermanagement/driverpolltest/sensordriverpoll-test
-tests/powermanagement/powermanagementtests/sensorpowermanagement-test
-tests/powermanagement/standbyoverridetests/sensorstandbyoverride-test
-tests/testapp/sensortestapp
-tests/testutils/datafaker/datafaker-qt5
-
|
[-]
[+]
|
Changed |
_service:tar_git:sensorfwd.service
^
|
@@ -1,6 +1,7 @@
[Unit]
Description=Sensor daemon for sensor framework
After=dbus.socket
+After=oneshot-root.service
Requires=dbus.service
Conflicts=actdead.target
|