Search code examples
bashdbus

DBus introspection object tree using dbus-send


Is it possible to gather the complete object tree of a DBus connection name using dbus-send?

Currently I am able to do this performing multiple calls to the desired destination specifying the method 'org.freedesktop.DBus.Introspectable.Introspect' and using '/' as path the first time, than retrieving the inner nodes and performing a new call on those.

For example:

$ dbus-send --session --print-reply --reply-timeout=2000 --type=method_call --dest=org.gnome.Bluetooth.applet / org.freedesktop.DBus.Introspectable.Introspect

gives nodes Factory and org. So I proceed with the calls:

$ dbus-send --session --print-reply --reply-timeout=2000 --type=method_call --dest=org.gnome.Bluetooth.applet /Factory org.freedesktop.DBus.Introspectable.Introspect

$ dbus-send --session --print-reply --reply-timeout=2000 --type=method_call --dest=org.gnome.Bluetooth.applet /org org.freedesktop.DBus.Introspectable.Introspect

and so on...

I would like to retrive the complete tree at once.

I know tools like d-feet can do this, but I need a cli interface and dbus-send would be very handy.


Solution

  • No, this is not possible. You can ask bus to list all service names, but there is no way to ask all interfaces, so usually there are two scenarios: 1) You know interface names and use them 2) you start with / and process recursively based on Introspect() responses. D-feet does (2)