8

Question: Is there any way in which we can find out the methods (and their signatures) which are exposed in a D-Bus interface?

Issue Description: In my phone, I am calling BlueZ methods using D-Bus to adapter interface, when checked on phone 2 of these methods are not available.

Intention is to check if the method name/signatures are modified in other device, I don't have access to code so looking to find the methods in an interface

Philip Withnall
  • 5,293
  • 14
  • 28
ashish
  • 1,384
  • 1
  • 12
  • 21

3 Answers3

15

Using dbus-send, you can list the available services on your system:

Session:

dbus-send --session           \
  --dest=org.freedesktop.DBus \
  --type=method_call          \
  --print-reply               \
  /org/freedesktop/DBus       \
  org.freedesktop.DBus.ListNames

System:

dbus-send --system            \
  --dest=org.freedesktop.DBus \
  --type=method_call          \
  --print-reply               \
  /org/freedesktop/DBus       \
  org.freedesktop.DBus.ListNames

You'll get an answer like that:

   array [
      string "org.freedesktop.DBus"
      string ":1.1"
      string ":1.26"
      string "org.asamk.Signal"
   ]

And if you want to list all methods available behind a dbus service, you can still use dbus-send to introspect the dbus service.

For example with org.asamk.Signal:

  dbus-send --system --type=method_call --print-reply \
      --dest=org.asamk.Signal \
      /org/asamk/Signal \
      org.freedesktop.DBus.Introspectable.Introspect

You'll get this kind of result (truncated)

<node name="/org/asamk/Signal">
 <interface name="org.asamk.Signal">
  <method name="sendMessage" >
   ...parameters
  </method>                      
  <method name="sendGroupMessage" >     
   ...parameters
  </method>
 </interface>
</node>

Here there are 2 methods, sendMessage and sendGroupMessage

michael_bitard
  • 3,613
  • 1
  • 24
  • 35
4

You can also take a look at D-Feet.

Artefacto
  • 96,375
  • 17
  • 202
  • 225
0

With an extra google search and dbus understanding, using D-Bus Introspection helps to get the methods (with signatures) exposed on that particular interface. More information available at link.

Athan Clark
  • 3,886
  • 2
  • 21
  • 39
ashish
  • 1,384
  • 1
  • 12
  • 21