答案分为不同的层:
dbus 的参数结构在这里定义:https://dbus.freedesktop.org/doc/dbus-specification.html#type-system
我们从中得知a{sv} 是一个包含一个(或多个?)DICT(键值对列表)的数组。键是 STRING,值是 VARIANT,它是任何类型的数据,前面有一个类型代码。
谢天谢地,我们不必处理低级细节。 Python 会处理这个问题。
所以解决办法就是:
obj.Mount(dict(key="value", key2="value2"),
dbus_interface="org.freedesktop.UDisks2.Filesystem")
实际的键名在 udisks 文档中定义
IN a{sv} options: Options - known options (in addition to standard options)
includes fstype (of type 's') and options (of type 's').
OUT s mount_path: The filesystem path where the device was mounted.
来自http://storaged.org/doc/udisks2-api/latest/gdbus-org.freedesktop.UDisks2.Filesystem.html#gdbus-method-org-freedesktop-UDisks2-Filesystem.Mount
而标准选项是指
Option name, Value type, Description
auth.no_user_interaction, 'b', If set to TRUE, then no user interaction will happen when checking if the method call is authorized.
来自http://storaged.org/doc/udisks2-api/latest/udisks-std-options.html
所以,添加我们拥有的键名
obj.Mount(dict(fstype="value", options="value2"),
dbus_interface="org.freedesktop.UDisks2.Filesystem")
关于价值观我认为你必须研究https://linux.die.net/man/8/mount中的Filesystem Independent Mount Options和Filesystem Dependent Mount Options部分
所以最终的解决方案看起来像
obj.Mount(dict(fstype="vfat", options="ro"),
dbus_interface="org.freedesktop.UDisks2.Filesystem")