简体   繁体   English

org.freedesktop.DBus.Properties.GetAll 返回“g-dbus-error-quark: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: 没有这样的接口”“”

[英]org.freedesktop.DBus.Properties.GetAll returns "g-dbus-error-quark: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: No such interface “”"

I am writing a python script for search.deb packages on USB-Flash and faced the following problem: when calling the org method.freedesktop.DBus.Properties.GetAll("") I get "g-dbus-error-quark: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: No such interface “”"我正在为 USB-Flash 上的 search.deb 包编写 python 脚本并遇到以下问题:当调用 org method.freedesktop.DBus.Properties.GetAll("") 我得到“g-dbus-error-quark: GDBus .Error:org.freedesktop.DBus.Error.InvalidArgs: 没有这样的接口“””

Replacing the method argument with any of the existing interfaces gives the same result, only the name of the entered interface is written instead of "".用任何现有接口替换方法参数给出相同的结果,只写入输入接口的名称而不是“”。 Passing the device as an argument also doesn't help.将设备作为参数传递也无济于事。

When running the same method via d-feet, the result is the same.当通过 d-feet 运行相同的方法时,结果是相同的。

A fragment of the script code:一段脚本代码:

_bus = dbus.SystemBus()
_proxy = _bus.get_object('org.freedesktop.UDisks2','/org/freedesktop/UDisks2')
_iface = dbus.Interface(_proxy, 'org.freedesktop.DBus.ObjectManager')

for _dev in _iface.GetManagedObjects():
    _dev_obj = _bus.get_object('org.freedesktop.UDisks2', _dev)
    _dev_prop = dbus.Interface(_dev_obj, 'org.freedesktop.DBus.Properties')
    print(_dev_prop.GetAll('org.freedesktop.DBus.Properties'))

Screenshot from d-feet d-feet 截图

What could be the matter?可能是什么问题?

Calling gdbus introspect --system --dest org.freedesktop.UDisks2 --object-path /org/freedesktop/UDisks2 results:调用gdbus introspect --system --dest org.freedesktop.UDisks2 --object-path /org/freedesktop/UDisks2结果:

node /org/freedesktop/UDisks2 {
  interface org.freedesktop.DBus.Properties {
    methods:
      Get(in  s interface_name,
          in  s property_name,
          out v value);
      GetAll(in  s interface_name,
             out a{sv} properties);
      Set(in  s interface_name,
          in  s property_name,
          in  v value);
    signals:
      PropertiesChanged(s interface_name,
                        a{sv} changed_properties,
                        as invalidated_properties);
    properties:
  };
  interface org.freedesktop.DBus.Introspectable {
    methods:
      Introspect(out s xml_data);
    signals:
    properties:
  };
  interface org.freedesktop.DBus.Peer {
    methods:
      Ping();
      GetMachineId(out s machine_uuid);
    signals:
    properties:
  };
  interface org.freedesktop.DBus.ObjectManager {
    methods:
      GetManagedObjects(out a{oa{sa{sv}}} object_paths_interfaces_and_properties);
    signals:
      InterfacesAdded(o object_path,
                      a{sa{sv}} interfaces_and_properties);
      InterfacesRemoved(o object_path,
                        as interfaces);
    properties:
  };
  node Manager {
  };
  node drives {
  };
  node block_devices {
  };
};

According to D-Bus Specification :根据D-Bus 规范

An empty string may be provided for the interface name;可以为接口名称提供一个空字符串; in this case, if there are multiple properties on an object with the same name, the results are undefined (picking one by according to an arbitrary deterministic rule, or returning an error, are the reasonable possibilities).在这种情况下,如果 object 上有多个同名的属性,则结果是未定义的(根据任意确定性规则选择一个或返回错误是合理的可能性)。

My guess you are facing one of these undefined results .我猜你正面临这些未定义的结果之一。

But my question is, why do you need to call this method?但我的问题是,为什么需要调用这个方法? according to the introspection result the requested path doesn't contain any properties!根据反省结果,请求的路径不包含任何属性!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM