View Full Version : Problem in Qt DBus (register service name for system bus connection)

19th April 2012, 03:51
Dear all

I try the Qt4.7 DBus example, including :

- chat room example
- remote car example

using the code and project setting provided with Qt. Session bus is used in both examples, and they work well. But now I would like to change the session bus into system bus, by changing the line : QDBusConnection::sessionBus() into QDBusConnection::systemBus() only, while keeping the rest unchanged. However it doesnt work now. By tracking the programme line by line, I find that it fails to invoke : registerService("xxx.yyy.zzz"). Can anyone help to solve the problem? Does it involve the system bus permission in linux?

thank you very much
best regards

11th September 2012, 08:33
Old post but I was stuck with the same problem, so for anyone else interested the solution is you need to create a DBus policy conf.

For example:


<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"

<!-- Only user root can own the foo helper -->
<policy user="root">
<allow own="org.kde.foohelper"/>

<!-- Allow anyone to call into the service - we'll reject callers using PolicyKit -->
<policy context="default">
<allow send_interface="org.kde.foohelper"/>
<allow receive_sender="org.kde.foohelper"/>
<allow receive_interface="org.kde.foohelper"/>