3

I wanted to connect to a wifi protected network using connman dbus service. I could able to connect to open networks using dbus-send commands, but for protected network, I cant connect directly, and I tried registering agent with the path /test/agent, but I have no idea where to specify the ssid and passphrase of the access point to which I have to connect.

I scan networks using this dbus-send command, dbus-send --system --dest=net.connman --print-reply /net/connman/technology/wifi net.connman.Technology.Scan

I do this to get the services, dbus-send --system --print-reply --dest=net.connman / net.connman.Manager.GetServices

this will give a huge output, where in I grep it to get only the object path of the networks available

I do this to get connected to a network, but this works only for open networks

dbus-send --system --print-reply --dest=net.connman /net/connman/service/wifi_008092751818_646c696e6b_managed_none net.connman.Service.Connect

As-far-as I searched, to get connected to password protected Access points (wpa psk networks) , I have to register for a agent, and I did this using,

dbus-send --system --print-reply --dest=net.connman / net.connman.Manager.RegisterAgent objpath:/test/agent

and then I tried the to connect using the previous connect command, but it is not getting connected, and I have no idea where to specify the ssid ans passphrase to get connected too. can some one help me out of this.

And how will I implement in c, I use gdbus to implement to call the methods exposed by connman over dbus like this, proxy = gdbus->createProxyObject("net.connman", "/", "net.connman.Manager"); return_s = gdbus->callMethod(proxy,"GetServices", NULL);

so to get connected to protected network.

  • 1
    In the connman documentation take a loot at Agent's DBus API. The `RequestInput()` method is what you're looking for. You should bind a listener to when this method is called. When the agent needs some input (in this case the password), whatever function you bound the listener to is called and should enter the passphrase into the dict parameter. – DBedrenko Jan 03 '17 at 14:13

0 Answers0