Using dbus-send to call GetAll

I tried my luck:

dbus-send --system --print-reply \ --dest=org.freedesktop.UDisks \ /org/freedesktop/UIDisks/devices/md0 \ org.freedesktop.DBus.Properties.GetAll \ string:"" 

If I use d-free and send "" as the GetAll parameter I get a long list of output

Trying to execute the above code just gives an error:

 Error org.freedesktop.DBus.Error.UnknownMethod: Method "GetAll" with signature "s" on interface "org.freedesktop.DBus.Properties" doesn't exist 

So I'm doing something wrong, but I don’t know what happened. I was looking for a solution, but did not come up with a decent solution. Maybe this is trivial, but I have no idea ....

+6
source share
3 answers

You need to specify the interface name as a parameter for GetAll. This example works for me (I have UDisks2 instead of UDisks, but otherwise it looks like):

 dbus-send --system --print-reply \ --dest=org.freedesktop.UDisks2 \ /org/freedesktop/UDisks2/block_devices/loop0 org.freedesktop.DBus.Properties.GetAll string:"org.freedesktop.UDisks2.Block" 
+2
source

Error org.freedesktop.DBus.Error.UnknownMethod: method "GetAll" with signature "s" on Interface "org.freedesktop.DBus.Properties" does not exist

I have a similar problem, I run d-foot, an introspective interface and find out that I should write not "full / path / to / object", but simply "/ object", in your case not "/ org / freedesktop / UIDisks / devices / md0 ", but" / md0 ".

If this does not help, try comparing all the parameters in the dbus call with what d-foot to show, I'm sure you found the problem.

0
source

I tried my luck:

 dbus-send --system --print-reply \ --dest=org.freedesktop.UDisks \ /org/freedesktop/UIDisks/devices/md0 \ org.freedesktop.DBus.Properties.GetAll \ string:"" 

You have a typo in the path of the object: instead of UDisks you put UIDisks . A fix that should fix your mistake.


Turning to your comment on this answer about getting all the properties at once, the D-Bus specification does not indicate that GetAll should accept an empty string for its interface_name argument, therefore its error if any services accept this. Instead, you should call GetAll once for each of the object's interfaces.

The easiest way to do this is to use a higher-level D-Bus utility, such as gdbus or D-Feet (as you tried). dbus-send designed for simple, low-level communication with D-Bus services.

 $ gdbus introspect --system --dest org.freedesktop.UDisks2 --object-path /org/freedesktop/UDisks2/block_devices/sda1 --only-properties node /org/freedesktop/UDisks2/block_devices/sda1 { interface org.freedesktop.UDisks2.Partition { properties: readonly u Number = 1; … }; interface org.freedesktop.UDisks2.Filesystem { properties: readonly aay MountPoints = [b'/boot/efi']; }; … } 
0
source

Source: https://habr.com/ru/post/972091/


All Articles