Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Problems with QDBus on an embedded Linux device - registerService returns false.
darenT last edited by
I'm new to DBus, but I'm trying to use it in two Qt applications on an embedded device. I have a very simple interface that consists of one slot:
@QString SendMessage(const QString &cmd);@
The server application is then using the following code to start the connection:
@ DbusService* dBus = new DbusService;
QDBusConnection connection = QDBusConnection::sessionBus(); bool ret = connection.registerService("com.domain.project.interface"); qDebug() << "returns" << ret; ret = connection.registerObject("/", dBus); qDebug() << "returns" << ret;@
This works fine on the desktop. In the embedded system, the connection.registerService function returns false. As a result, any messages to the server fail. I'm not sure why. Running 'ps' tells me that [dbus-daemon --system] and [dbus-daemon --sesson] are both running.
Finally, I have noticed that Qt Creator complains when I debug the application. I see the following warning messages:
bq. Could not load shared library symbols for 10 libraries, e.g. /opt/arm/lib/libQtDBus.so.4.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?Could not load shared library symbols for /usr/lib/libdbus-1.so.3.
Do you need "set solib-search-path" or "set sysroot"?
If additional information is required to debug this problem, please let me know. I'll be happy to update my post. Thanks!
darenT last edited by
It turns out the session bus was not getting started on the device. I enabled it, but then I ran into the problem of the address not getting propagated to the environment variables. I can manually set it in a terminal, but I'm not sure how to do the same in Qt Creator.
Anyway, rather than spend more time figuring out the issues with the session bus, I switched to using the system bus. I just had to change the /etc/dbus-1/system.conf file to allow anyone to talk to the system bus and my applications work on the embedded device. I know that's probably not the long term solution, but it works for now.