I tried my luck with:
dbus-send --system --print-reply \
--dest=org.freedesktop.UDisks \
/org/freedesktop/UIDisks/devices/md0 \
org.freedesktop.DBus.Properties.GetAll \
string:""
If I'm using d-free and send "" as parameter to GetAll I get a long list of output
Trying the code above 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've no idea what's wrong. I searched for a solution but did not come up with a decent solution. Maybe it's to trivial, but I have no idea....
You need to specify interface name as a parameter to GetAll. This example works for me (I have UDisks2 instead of UDisks but otherwise it's similar):
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"
I tried my luck with:
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 object path: you put UIDisks
instead of UDisks
. Fixing that should fix your error.
Addressing your comment on this answer about getting all properties at once, the D-Bus specification doesn’t specify that GetAll
should accept an empty string for its interface_name
argument, so it’s a bug if any services do accept this. Instead, you must call GetAll
once for each of the interfaces on the object.
The easiest way of doing this is to use a higher-level D-Bus utility, like gdbus
or D-Feet (as you were trying). dbus-send
is designed for simple, low-level interaction 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'];
};
…
}
After all this years, I finally get around this and found something. Yes, sometimes it takes some time
dbus-send --system --print-reply \--dest=org.freedesktop.UDisks2 \
/org/freedesktop/UDisks2/block_devices/sda1 \
org.freedesktop.DBus.Properties.GetAll \
string:"org.freedesktop.UDisks2.Filesystem"
Works, kind of ot get the Properties of at least the Filesystem interface.
Just took me another few hours to figure out this dbus-send stuff.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With