How to send method call by dbus-send?

3k views Asked by At

I am analyzing Chromium OS.
I have captured a dbus method call using dbus-monitor and want to reappear it by dbus-send.
Below is what I want to reappear.

my-chromiumos ! # dbus-monitor --system "path=/org/chromium/SessionManager"
    method call time=1632639141.486152 sender=:1.325 -> destination=org.chromium.SessionManager serial=402 path=/org/chromium/SessionManager; interface=org.chromium.SessionManagerInterface; member=RestartJob
       file descriptor
             inode: 489350
             type: socket
             address family: unix
             name @
             peer @
       array [
          string "/opt/google/chrome/chrome"
          string "--gpu-sandbox-failures-fatal=no"
          string "--enable-logging"
          string "--use-cras"
          string "--use-gl=egl"
          string "--user-data-dir=/home/chronos"
          string "--vmodule=*night_light*=1,*/ash/wm/tablet_mode/*=1,wizard_controller=1,*/webui/chromeos/login/*=1,*/browser/chromeos/login/screens/*=1,enrollment_screen_handler=1,*/browser/chromeos/login/enrollment/*=1,*/ui/ozone/*=1,*/ui/display/manager/chromeos/*=1"
          string "--enable-wayland-server"
          string "--aura-legacy-power-button"
          string "--login-profile=user"
          string "--system-developer-mode"
          string "--bwsi"
          string "--homepage=chrome://newtab/"
          string "--incognito"
          string "--log-level=1"
          string "--login-user=$guest"
       ]
       uint32 0
1

There are 1 answers

0
Shubham On

Please take a look at dbus-send documentation for more details.

dbus-send --dest=org.chromium.SessionManager \
          --print-reply \
          --type=method_call \
          /org/chromium/SessionManager \
          org.chromium.SessionManagerInterface.RestartJob

It looks like the above method call do not take any argument, but you should confirm with the available API documentation.

Also, I found this Chrome OS D-Bus Best Practices guide, please take a look at it as well.