Skip to content

Loading…

Problem with reading Properties #41

Closed
swistaczek opened this Issue · 3 comments

2 participants

@swistaczek

Hello,
First of all I would like to say thanks you for great library :), I am trying to read properties for NetworkManager ( http://projects.gnome.org/NetworkManager/developers/mm-spec-04.html ) using following code:

    @bus        = DBus::SystemBus.instance
    @mm_service = @bus['org.freedesktop.ModemManager'
    @proxy = @mm_service.object('/org/freedesktop/ModemManager/Modems/0')
    @proxy.introspect
[85] pry(main)> @proxy['org.freedesktop.ModemManager.Modem']['Enabled']
NoMethodError: undefined method `Get' for #<DBus::ProxyObjectInterface:0x0000000304d190>
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p392/bundler/gems/ruby-dbus-f25a6953df05/lib/dbus/introspect.rb:333:in `[]'

Could you @mvidner please point me where I am making mistake? Thanks in advantage.

I would like to fix this odd method https://github.com/swistaczek/ruby-network-manager/blob/master/lib/network_manager/modem.rb#L27

@mvidner
Owner

Thanks for the report. It turns out that ModemManager introspection output is a bit quirky, splitting the Properties interface into two elements (see below) and ruby-dbus only interprets one of them, missing the Properties.Get method.

$ dbus-send --system --print-reply --dest=org.freedesktop.ModemManager /org/freedesktop/ModemManager/Modems/0 org.freedesktop.DBus.Introspectable.Introspect | grep \<interface
  <interface name="org.freedesktop.DBus.Introspectable">
  <interface name="org.freedesktop.DBus.Properties">                              HERE
  <interface name="org.freedesktop.ModemManager.Modem.Simple">
  <interface name="org.freedesktop.ModemManager.Modem.Gsm.Ussd">
  <interface name="org.freedesktop.ModemManager.Modem.Location">
  <interface name="org.freedesktop.ModemManager.Modem.Gsm.SMS">
  <interface name="org.freedesktop.ModemManager.Modem.Gsm.Network">
  <interface name="org.freedesktop.ModemManager.Modem.Gsm.Card">
  <interface name="org.freedesktop.ModemManager.Modem.Time">
  <interface name="org.freedesktop.DBus.Properties">                             AND HERE
  <interface name="org.freedesktop.ModemManager.Modem">

I think I should make the introspection parser merge them, perhaps even with a set of fall back property introspection.

@swistaczek
@swistaczek

Hello @mvidner, I was unable to find section responsible for params merge. Could you help me with fixing this bug please?

@mvidner mvidner added a commit that closed this issue
@mvidner reading split interface elements in introspection; fixes #41
ModemManager does this with the property interface, resulting in
    NoMethodError: undefined method `Get' for #<DBus::ProxyObjectInterface:...>
without the fix
f54a324
@mvidner mvidner closed this in f54a324
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.