On Sat, 2016-06-25 at 14:11 +0200, Michael Hirmke wrote: > Hi again, > > [...] > > > > > > > > of NetworkManager. You'd match on the signal (member) name > > > "StateChanged", and look for object paths starting with > > > "/org/freedesktop/NetworkManager/Devices/" and an interface of > > > "org.freedesktop.NetworkManager.Device". > > > > > > > > The Device.StateChanged signal arguments are documented in the NM > > > D-Bus > > > API; they are new-state (uint), old-state (uint), and reason > > > (uint). > > > > > > > > So once you know you've got a device state change signal, you can > > > read > > > the new-state argument and you'll know when the device is > > > activated or > > > deactivated. > ok, got all devices and their properties, connected to the > StateChanged > signal for every device, but now, when such a signal is thrown, how > do I > know what device it belongs to? I know the old and new state and the > reason, but not the device. > Does every single device need its own signal handler?
You get the Object Path in the signal message header which uniquely identifies the device. Now if you want to know other things about the device, like what interface name it has, then you'll need to make some more D-Bus calls to figure that out (using the standard org.freedesktop.DBus.Properties API), eg: $ dbus-send --system --print-reply \ --dest=org.freedesktop.NetworkManager \ /org/freedesktop/NetworkManager/Devices/1 \ org.freedesktop.DBus.Properties.Get \ string:"org.freedesktop.NetworkManager.Device" string:"Interface" which gives me: variant string "wlp4s0" Dan > [...] > > > > > > > > Dan > > > > Bye. > > Michael. > > -- > > Michael Hirmke _______________________________________________ networkmanager-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/networkmanager-list
