How to list all the removable devices with DBus and UDisks2?

Adnan338 relay.public.adnan at outlook.com
Sat Aug 22 14:26:07 UTC 2020


Originally asked here: 
https://stackoverflow.com/questions/63537158/how-to-list-all-the-removable-devices-with-dbus-and-udisks2



I need to list, filter and open block devices with UDisks2. I am 
trying to list all the removable devices.

The GetBlockDevices method provided by UDisks2 requires a a{sv} 
type. If I am not mistaken, it's a HashTable of string keys and 
Variant values.

How can I use this information to list the devices? So far I tried

import std.stdio, ddbus;

void main()
{
     Connection conn = connectToBus();
     PathIface obj = new PathIface(conn, "org.freedesktop.UDsks2",
             "/org/freedesktop/UDisks2/Manager", 
"org.freedesktop.UDisks2.Manager");

     writeln(obj.call!string("GetBlockDevices", 
"org.freedesktop.DBus", ???));
}

The call method requires an Arg at as it's last parameter. How 
can I provide a a{sv} in there?

I am using the ddbus library.



More information about the Digitalmars-d-learn mailing list