如何打印出D-Bus上所有可用信息的樹?打印D-Bus內省樹
*Bus Name
* Interface
*Method
*Signature
* Interface
*Method
*Signature
*Method
*Signature
*Bus Name
* Interface
*Method
*Signature
如何打印出D-Bus上所有可用信息的樹?打印D-Bus內省樹
*Bus Name
* Interface
*Method
*Signature
* Interface
*Method
*Signature
*Method
*Signature
*Bus Name
* Interface
*Method
*Signature
我已經創建了一個Git倉庫來演示如何來解決這個問題: https://github.com/smokedice/PyDBusTree
的代碼是相當慢的,因爲它不使用回調。如果有人想改進代碼,請將其發佈到此處,或者推送到存儲庫。
除了D-Feet(在前面的答覆中提到),該gdbus
command line tool將允許在一個給定的唯一或知名總線名特定對象路徑的反思:
$ gdbus introspect --session --dest org.gnome.Contacts --object-path /org/gnome/Contacts
node /org/gnome/Contacts {
interface org.freedesktop.DBus.Properties {
methods:
Get(in s interface_name,
in s property_name,
out v value);
…
signals:
PropertiesChanged(s interface_name,
a{sv} changed_properties,
as invalidated_properties);
properties:
};
…
}
這很酷,你做了,但是如果我們推廣一套通用的標準D-Bus工具,可能會更好。 –
我個人不同意。像D-Feet這樣的工具不會涵蓋所有需求。我現在發現這個問題不明確,因爲我認爲'print'更多地與代碼而不是工具相關聯。這可能是由於語言或上下文。 – smokedice
[這裏](https://github.com/ldo/dbussy_examples/blob/master/introspect_all)的另一個選項:使用['asyncio'-compatible](https://github.com/ldo/dbussy) Python的D-Bus包裝。 –