How to get modem connection objpath and modem device objpath? Re: how to let http brings up networkmanager modem connectivity?



Hi Jirka,

Thanks for the help. However, it seems for my Case, the Connection is /3 if I put the wifi start config into /etc/NetworkManager/system-connection,
but it has to change to /1 if I remove those wifi start config and just put modem start config in /system-connection. In addition, the device objpath is changed to: /org/freedesktop/
NetworkManager/Devices/1. (wifi is on /0).

So, my question is: How can I dynamically know the device objpath and connection objpath? Is there any signal or callback function or dbus method call to get the modem device objpath and modem connection objpath? How can I write a simple program to get these information?

thanks a lot

Xiaohong
 


On Fri, Sep 17, 2010 at 1:07 AM, Jirka Klimes <jklimes redhat com> wrote:
On Wednesday 15 of September 2010 23:49:56 hong sheng wrote:
> Hi
>
> I would skip the networkmanager applet in our platform. In stead, I want to
> let the http brower automatically bring up the 3G connectivity for
> NetworkManager. So, what d-bus message I should send to bring up the 3G
> connectivity ?
>
> Thanks
>
> Hong

To activate a connection, ActivateConnection method should be called via D-Bus
on org.freedesktop.NetworkManager interface. The NM D-Bus API can be found at
http://projects.gnome.org/NetworkManager/developers/spec-08.html

You can do it e.g.:
#!/bin/bash

SERVICE="org.freedesktop.NetworkManagerSystemSettings"
CONNECTION="/org/freedesktop/NetworkManagerSettings/2"
DEVICE="/org/freedesktop/NetworkManager/Devices/0"

dbus-send --system --print-reply --type=method_call --
dest='org.freedesktop.NetworkManager' \
'/org/freedesktop/NetworkManager'
org.freedesktop.NetworkManager.ActivateConnection \
string:"$SERVICE" objpath:"$CONNECTION" objpath:"$DEVICE" objpath:"/"

or use command line tool nmcli:
nmcli nm con up id "your connection name"
or
nmcli nm con up uuid <connection uuid>

List connections with:
nmcli con list

Jirka

Note:
org.freedesktop.NetworkManagerSystemSettings service means system connections
managed by NM itself (and stored via a plugin, e.g. keyfile) ~ "Available to
all users"
org.freedesktop.NetworkManagerUserSettings service is run by clients (nm-
applet) and is available just while the client is up.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]