如何测试 DBUS Daemon

方法如下:

./dbus-daemon --print-address --config-file=/home/charles/code/dbus/cmake/cmake/bus/session.conf
unix:abstract=/tmp/dbus-ZfKHkBvsWm,guid=6fcb847152517d1d7a75bafa5474bf74
org.freedesktop.DBus.Error.NotSupported: cannot change fd limit on this platform

记住打印出来的地址:
unix:abstract=/tmp/dbus-ZfKHkBvsWm,guid=6fcb847152517d1d7a75bafa5474bf74

然后,启动 d-feet, 选择 "Connect to other bus", 输入上面的地址,就建立了一个connection.

然后,执行:

$ DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-ZfKHkBvsWm ./dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus
 org.freedesktop.DBus.GetConnectionUnixProcessID string::1.24 
method return sender=org.freedesktop.DBus -> dest=:1.31 reply_serial=2
   uint32 2500

DBUS_SESSION_BUS_ADDRESS 是一个环境变量,指向 bus-daemon. :1.24为在 d-feet中看到的一个和要被测试 bud daemon的连接的 unique name.


你可能感兴趣的:(Linux)