How to send Dbus messages manually
Introduction
The goal of this guide is to allow you to send Dbus messages manually to some application using the command line, in order to do this we are going to use dbus-monitor to check the Dbus messages that are sent as well as dbus-send to send the desired message.
Configure Dbus
First you need create an universal unique ID and configure Dbus to show you the method calls, in order to do this please follow these steps:
1. Create a UUID, you will need to do this every time that you reboot the board.
mkdir /var/lib/dbus/ dbus-uuidgen > /var/lib/dbus/machine-id
2. Enable eavesdrop to allow dbus-monitor to show the method calls. Create a file called system-local.conf in /etc/dbus-1 with the following content:
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> <busconfig> <policy context="default"> <allow eavesdrop="true" send_requested_reply="false"/> <allow eavesdrop="true" receive_requested_reply="false"/> <allow eavesdrop="true"/> </policy> </busconfig>
3. Now restart your board.
4. Run dbus-monitor with the following command:
dbus-monitor --system &
4. Send the Dbus messages using dbus-send
#Example of dbus calling method function dbus-send --system --type="method_call" --dest=com.user.server /com/user/server com.user.server.function
with this you should be able to send Dbus messages manually from console.