Bash 使用dbussend的DBus内省对象树

Bash 使用dbussend的DBus内省对象树,bash,dbus,Bash,Dbus,是否可以使用DBus send收集DBus连接名的完整对象树 目前,我可以执行多个对所需目标的调用,指定方法“org.freedesktop.DBus.Introspectable.Introspect”,并第一次使用“/”作为路径,而不是检索内部节点并对这些节点执行新的调用 例如: $ dbus-send --session --print-reply --reply-timeout=2000 --type=method_call --dest=org.gnome.Bluetooth.appl

是否可以使用DBus send收集DBus连接名的完整对象树

目前,我可以执行多个对所需目标的调用,指定方法“org.freedesktop.DBus.Introspectable.Introspect”,并第一次使用“/”作为路径,而不是检索内部节点并对这些节点执行新的调用

例如:

$ 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...
我想立刻检索整棵树


我知道像d-feet这样的工具可以做到这一点,但我需要一个cli界面,dbus send将非常方便。

不,这是不可能的。您可以要求总线列出所有服务名称,但无法询问所有接口,因此通常有两种情况:1)您知道接口名称并使用它们2)您从
/
开始,然后根据
内省()
响应递归处理。D-feet确实(2)

busctl
是与DBU交互的便捷工具

尝试一下:

busctl tree
我已经找到了一个可能的“一次性解决方案”,至少满足了我的需要:gdbus-introspect--session--dest-org.gnome.Bluetooth.applet--object-path/--recurse--xml