Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
D-Bus and Connman notes
# Connman Technology API examples: (Object Path: /net/connman/technology/<wifi/ethernet>, Interface: net.connman.Technology)
# GetProperties
dbus-send --system --dest=net.connman --print-reply /net/connman/technology/wifi net.connman.Technology.GetProperties
# Scan
dbus-send --system --dest=net.connman --print-reply /net/connman/technology/wifi net.connman.Technology.Scan
# Disable/Enable wifi
dbus-send --system --dest=net.connman --print-reply /net/connman/technology/wifi net.connman.Technology.SetProperty string:Powered variant:boolean:true
# Disable/Enable ethernet
dbus-send --system --dest=net.connman --print-reply /net/connman/technology/ethernet net.connman.Technology.SetProperty string:Powered variant:boolean:true
# Connman Manager API examples: (Object Path: /, Interface: net.connman.Manager)
dbus-send --system --dest=net.connman --print-reply / net.connman.Manager.GetProperties
dbus-send --system --dest=net.connman --print-reply / net.connman.Manager.GetTechnologies
dbus-send --system --dest=net.connman --print-reply / net.connman.Manager.GetServices
# See:;a=tree;f=doc;hb=HEAD

lewoudar commented Apr 3, 2017

Thanks for this indications.
Do you know how to modify IP configuration manually using the library dbus-python? By reading the docs, i have seen that the IPv4.Configuration dictionary needs to be changed by passing it the same values as the IPv4 dictionary, but when i tried to do changes, i got "net.connman.Error.InvalidArguments: Invalid arguments". This is an example of request i'm trying to do:
net_service.SetProperty('IPv4.Configuration', { "Method": "manual", "Address": "X.X.X.X", "Netmask": "X.X.X.X", "Gateway": "X.X.X.X" })

lewoudar commented Apr 20, 2017

I found the answer myself. In fact, when the dictionary has variant values, it must be specified explicitly by passing through the dbus.Dictionary object, my above command becomes:
data = { "Method": "manual", "Address": "X.X.X.X", "Netmask": "X.X.X.X", "Gateway": "X.X.X.X" } net_service.SetProperty('IPv4.Configuration', dbus.Dictionary(data, signature='sv'))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment