Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[sensorfw] Use a socket env path if set. Fixes MER#1709
This makes this work in case of confinement (think snappy or
flatpack) if the usual paths are
not writeable.
  • Loading branch information
Lorn Potter committed Nov 29, 2016
1 parent d5bbbb9 commit f57c72c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/sensormanager.cpp
Expand Up @@ -109,7 +109,7 @@ SensorManager::SensorManager()
deviation(0)
{
QString pluginPath;
QByteArray env = qgetenv("SENSORFW_LIBRARY_PATH");
QByteArray env = qgetenv("SENSORFW_SOCKET_PATH");
const char* SOCKET_NAME;
if (env.isEmpty())
SOCKET_NAME = "/var/run/sensord.sock";
Expand Down
9 changes: 8 additions & 1 deletion qt-api/socketreader.cpp
Expand Up @@ -50,7 +50,14 @@ bool SocketReader::initiateConnection(int sessionId)
}

socket_ = new QLocalSocket(this);
socket_->connectToServer("/var/run/sensord.sock", QIODevice::ReadWrite);
QByteArray env = qgetenv("SENSORFW_SOCKET_PATH");
const char* SOCKET_NAME;
if (env.isEmpty())
SOCKET_NAME = "/var/run/sensord.sock";
else
SOCKET_NAME = env+"/var/run/sensord.sock";

socket_->connectToServer(SOCKET_NAME, QIODevice::ReadWrite);

if (!(socket_->serverName().size())) {
qDebug() << socket_->errorString();
Expand Down

0 comments on commit f57c72c

Please sign in to comment.