Skip to content

Commit 8055468

Browse files
authored
Merge pull request #28 from sailfishos/cleanups
Cleanups
2 parents ed7ebcd + a817266 commit 8055468

File tree

203 files changed

+1428
-1755
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

203 files changed

+1428
-1755
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Makefile
2+
*.o
3+
*.so
4+
*.so.*
5+
moc_*

adaptors/accelerometeradaptor/accelerometeradaptor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ AccelerometerAdaptor::~AccelerometerAdaptor()
5656

5757
bool AccelerometerAdaptor::startSensor()
5858
{
59-
if(!powerStatePath_.isEmpty()) {
59+
if (!powerStatePath_.isEmpty()) {
6060
writeToFile(powerStatePath_, "1");
6161
}
6262
return SysfsAdaptor::startSensor();
6363
}
6464

6565
void AccelerometerAdaptor::stopSensor()
6666
{
67-
if(!powerStatePath_.isEmpty()) {
67+
if (!powerStatePath_.isEmpty()) {
6868
writeToFile(powerStatePath_, "0");
6969
}
7070
SysfsAdaptor::stopSensor();
@@ -107,7 +107,7 @@ void AccelerometerAdaptor::commitOutput(struct input_event *ev)
107107
d->y_ = orientationValue_.y_;
108108
d->z_ = orientationValue_.z_;
109109

110-
// sensordLogT() << id() << "Accelerometer reading: " << d->x_ << ", " << d->y_ << ", " << d->z_;
110+
// qCDebug(lcSensorFw) << id() << "Accelerometer reading: " << d->x_ << ", " << d->y_ << ", " << d->z_;
111111

112112
accelerometerBuffer_->commit();
113113
accelerometerBuffer_->wakeUpReaders();

adaptors/accelerometeradaptor/accelerometeradaptorplugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
void AccelerometerAdaptorPlugin::Register(class Loader&)
3232
{
33-
sensordLogD() << "registering accelerometeradaptor";
33+
qCInfo(lcSensorFw) << "registering accelerometeradaptor";
3434
SensorManager& sm = SensorManager::instance();
3535
sm.registerDeviceAdaptor<AccelerometerAdaptor>("accelerometeradaptor");
3636
}

adaptors/alsadaptor-ascii/alsadaptor-ascii.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ ALSAdaptorAscii::ALSAdaptorAscii(const QString& id) : SysfsAdaptor(id, SysfsAdap
5757
QFile sysFile(rangeFilePath_);
5858

5959
if (!(sysFile.open(QIODevice::ReadOnly))) {
60-
sensordLogW() << NodeBase::id() << "Unable to config ALS range from sysfs";
60+
qCWarning(lcSensorFw) << NodeBase::id() << "Unable to config ALS range from sysfs";
6161
} else {
6262
sysFile.readLine(buf, sizeof(buf));
6363
int range = QString(buf).toInt();
6464

6565
introduceAvailableDataRange(DataRange(0, range, 1));
66-
sensordLogT() << NodeBase::id() << "Ambient light range: " << range;
66+
qCDebug(lcSensorFw) << NodeBase::id() << "Ambient light range: " << range;
6767
}
6868
}
6969
powerStatePath = SensorFrameworkConfig::configuration()->value("als/powerstate_path").toByteArray();
@@ -79,12 +79,12 @@ void ALSAdaptorAscii::processSample(int pathId, int fd) {
7979
Q_UNUSED(pathId);
8080

8181
if (read(fd, buf, sizeof(buf)) <= 0) {
82-
sensordLogW() << id() << "read():" << strerror(errno);
82+
qCWarning(lcSensorFw) << id() << "read():" << strerror(errno);
8383
return;
8484
}
8585
buf[sizeof(buf)-1] = '\0';
8686

87-
sensordLogT() << id() << "Ambient light value: " << buf;
87+
qCDebug(lcSensorFw) << id() << "Ambient light value: " << buf;
8888

8989
__u16 idata = atoi(buf);
9090

@@ -99,7 +99,7 @@ void ALSAdaptorAscii::processSample(int pathId, int fd) {
9999

100100
bool ALSAdaptorAscii::startSensor()
101101
{
102-
if(!powerStatePath.isEmpty()) {
102+
if (!powerStatePath.isEmpty()) {
103103
writeToFile(powerStatePath, powerMode);
104104
}
105105

@@ -111,7 +111,7 @@ bool ALSAdaptorAscii::startSensor()
111111

112112
void ALSAdaptorAscii::stopSensor()
113113
{
114-
if(!powerStatePath.isEmpty()) {
114+
if (!powerStatePath.isEmpty()) {
115115
writeToFile(powerStatePath, "0");
116116
}
117117
SysfsAdaptor::stopSensor();

adaptors/alsadaptor-ascii/alsadaptor-asciiplugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
void ALSAdaptorAsciiPlugin::Register(class Loader&)
3737
{
38-
sensordLogD() << "registering alsadaptor-ascii";
38+
qCInfo(lcSensorFw) << "registering alsadaptor-ascii";
3939
SensorManager& sm = SensorManager::instance();
4040
sm.registerDeviceAdaptor<ALSAdaptorAscii>("alsadaptor");
4141
}

adaptors/alsadaptor-evdev/alsadaptor-evdevplugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
void ALSAdaptorEvdevPlugin::Register(class Loader&)
3535
{
36-
sensordLogD() << "registering alsadaptor-evdev";
36+
qCInfo(lcSensorFw) << "registering alsadaptor-evdev";
3737
SensorManager& sm = SensorManager::instance();
3838
sm.registerDeviceAdaptor<ALSAdaptorEvdev>("alsadaptor");
3939
}

adaptors/alsadaptor-sysfs/alsadaptor-sysfs.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ void ALSAdaptorSysfs::processSample(int pathId, int fd)
6262
idata = atoi(asciidata);
6363

6464
if (bytesRead <= 0) {
65-
sensordLogW() << id() << "read(): " << strerror(errno);
65+
qCWarning(lcSensorFw) << id() << "read(): " << strerror(errno);
6666
return;
6767
}
6868

69-
sensordLogT() << id() << "Ambient light value: " << idata;
69+
qCDebug(lcSensorFw) << id() << "Ambient light value: " << idata;
7070

7171
TimedUnsigned* lux = alsBuffer_->nextSlot();
7272
lux->value_ = idata;

adaptors/alsadaptor-sysfs/alsadaptor-sysfsplugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
void ALSAdaptorSysfsPlugin::Register(class Loader&)
3333
{
34-
sensordLogD() << "registering alsadaptor-sysfs";
34+
qCInfo(lcSensorFw) << "registering alsadaptor-sysfs";
3535
SensorManager& sm = SensorManager::instance();
3636
sm.registerDeviceAdaptor<ALSAdaptorSysfs>("alsadaptor");
3737
}

adaptors/alsadaptor/alsadaptor.cpp

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,17 @@ ALSAdaptor::~ALSAdaptor()
8282
#ifdef SENSORFW_MCE_WATCHER
8383
void ALSAdaptor::enableALS()
8484
{
85-
if(!alsEnabled)
86-
{
87-
sensordLogT() << id() << "Requesting MCE to enable ALS";
85+
if (!alsEnabled) {
86+
qCDebug(lcSensorFw) << id() << "Requesting MCE to enable ALS";
8887
dbusIfc->call(QDBus::NoBlock, "req_als_enable");
8988
alsEnabled = true;
9089
}
9190
}
9291

9392
void ALSAdaptor::disableALS()
9493
{
95-
if(alsEnabled)
96-
{
97-
sensordLogT() << id() << "Requesting MCE to disable ALS";
94+
if (alsEnabled) {
95+
qCDebug(lcSensorFw) << id() << "Requesting MCE to disable ALS";
9896
dbusIfc->call(QDBus::NoBlock, "req_als_disable");
9997
alsEnabled = false;
10098
}
@@ -103,12 +101,10 @@ void ALSAdaptor::disableALS()
103101

104102
bool ALSAdaptor::startSensor()
105103
{
106-
if(!powerStatePath_.isEmpty())
107-
{
104+
if (!powerStatePath_.isEmpty()) {
108105
writeToFile(powerStatePath_, "1");
109106
}
110-
if (SysfsAdaptor::startSensor())
111-
{
107+
if (SysfsAdaptor::startSensor()) {
112108
#ifdef SENSORFW_MCE_WATCHER
113109
enableALS();
114110
#endif
@@ -119,8 +115,7 @@ bool ALSAdaptor::startSensor()
119115

120116
void ALSAdaptor::stopSensor()
121117
{
122-
if(!powerStatePath_.isEmpty())
123-
{
118+
if (!powerStatePath_.isEmpty()) {
124119
writeToFile(powerStatePath_, "0");
125120
}
126121
#ifdef SENSORFW_MCE_WATCHER
@@ -131,8 +126,7 @@ void ALSAdaptor::stopSensor()
131126

132127
bool ALSAdaptor::standby()
133128
{
134-
if(SysfsAdaptor::standby())
135-
{
129+
if (SysfsAdaptor::standby()) {
136130
#ifdef SENSORFW_MCE_WATCHER
137131
disableALS();
138132
#endif
@@ -143,8 +137,7 @@ bool ALSAdaptor::standby()
143137

144138
bool ALSAdaptor::resume()
145139
{
146-
if(SysfsAdaptor::resume())
147-
{
140+
if (SysfsAdaptor::resume()) {
148141
#ifdef SENSORFW_MCE_WATCHER
149142
enableALS();
150143
#endif
@@ -157,64 +150,57 @@ void ALSAdaptor::processSample(int pathId, int fd)
157150
{
158151
Q_UNUSED(pathId);
159152

160-
if(deviceType_ == RM680)
161-
{
153+
if (deviceType_ == RM680) {
162154
struct bh1770glc_als als_data;
163155
als_data.lux = 0;
164156

165157
int bytesRead = read(fd, &als_data, sizeof(als_data));
166158

167159
if (bytesRead <= 0) {
168-
sensordLogW() << id() << "read(): " << strerror(errno);
160+
qCWarning(lcSensorFw) << id() << "read(): " << strerror(errno);
169161
return;
170162
}
171-
sensordLogT() << id() << "Ambient light value: " << als_data.lux;
163+
qCDebug(lcSensorFw) << id() << "Ambient light value: " << als_data.lux;
172164

173165
TimedUnsigned* lux = alsBuffer_->nextSlot();
174166
lux->value_ = als_data.lux;
175167
lux->timestamp_ = Utils::getTimeStamp();
176-
}
177-
else if (deviceType_ == RM696)
178-
{
168+
} else if (deviceType_ == RM696) {
179169
struct apds990x_data als_data;
180170
als_data.lux = 0;
181171

182172
int bytesRead = read(fd, &als_data, sizeof(als_data));
183173

184174
if (bytesRead <= 0) {
185-
sensordLogW() << id() << "read(): " << strerror(errno);
175+
qCWarning(lcSensorFw) << id() << "read(): " << strerror(errno);
186176
return;
187177
}
188-
sensordLogT() << id() << "Ambient light value: " << als_data.lux;
178+
qCDebug(lcSensorFw) << id() << "Ambient light value: " << als_data.lux;
189179

190180
TimedUnsigned* lux = alsBuffer_->nextSlot();
191181
lux->value_ = als_data.lux;
192182
lux->timestamp_ = Utils::getTimeStamp();
193-
}
194-
else if (deviceType_ == NCDK)
195-
{
183+
} else if (deviceType_ == NCDK) {
196184
char buffer[32];
197185
memset(buffer, 0, sizeof(buffer));
198186
int bytesRead = read(fd, &buffer, sizeof(buffer));
199187
if (bytesRead <= 0) {
200-
sensordLogW() << id() << "read(): " << strerror(errno);
188+
qCWarning(lcSensorFw) << id() << "read(): " << strerror(errno);
201189
return;
202190
}
203191
QVariant value = QVariant::fromValue(QByteArray(buffer));
204192
bool ok;
205193
double fValue(value.toDouble(&ok));
206-
if(!ok) {
207-
sensordLogT() << id() << "read(): failed to parse float from: " << buffer;
194+
if (!ok) {
195+
qCDebug(lcSensorFw) << id() << "read(): failed to parse float from: " << buffer;
208196
return;
209197
}
210198
TimedUnsigned* lux = alsBuffer_->nextSlot();
211199
lux->value_ = fValue * 10;
212200
lux->timestamp_ = Utils::getTimeStamp();
213-
sensordLogT() << id() << "Ambient light value: " << lux->value_;
214-
}
215-
else
216-
{
217-
sensordLogW() << id() << "Not known device type: " << deviceType_;
201+
qCDebug(lcSensorFw) << id() << "Ambient light value: " << lux->value_;
202+
} else {
203+
qCWarning(lcSensorFw) << id() << "Not known device type: " << deviceType_;
218204
return;
219205
}
220206
alsBuffer_->commit();

adaptors/alsadaptor/alsadaptorplugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
void ALSAdaptorPlugin::Register(class Loader&)
3232
{
33-
sensordLogD() << "registering alsadaptor";
33+
qCInfo(lcSensorFw) << "registering alsadaptor";
3434
SensorManager& sm = SensorManager::instance();
3535
sm.registerDeviceAdaptor<ALSAdaptor>("alsadaptor");
3636
}

0 commit comments

Comments
 (0)