Linux 如何从命令行发出 dbus 信号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3684999/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-04 21:59:53  来源:igfitidea点击:

How to emit dbus signal from command line

linuxdbus

提问by deimus

Is there a way to emit dbus signal from command line using dbus-send or something else ?

有没有办法使用 dbus-send 或其他方式从命令行发出 dbus 信号?

采纳答案by m__

You can use the utility dbus-sendto send D-Bus request from the command line.

您可以使用该实用程序dbus-send从命令行发送 D-Bus 请求。

dbus-send --system --type=signal / com.example.signal_name

or if you'd like to send some data with the signal

或者如果你想用信号发送一些数据

dbus-send --system --type=signal / com.example.signal_name string:"hello"

回答by Stefan George

Check the syntax of dbus-send! It's not that complicated as it seems!

检查 dbus-send 的语法!这并不像看起来那么复杂!

回答by Millhouse

You could also use qdbus. There is a decent tutorial here.

您也可以使用qdbus。有一个像样的教程在这里