Re: How to get modem connection objpath and modem device objpath? Re: how to let http brings up networkmanager modem connectivity?
- From: Jirka Klimes <jklimes redhat com>
- To: hong sheng <hong022011 gmail com>
- Cc: networkmanager-list gnome org
- Subject: Re: How to get modem connection objpath and modem device objpath? Re: how to let http brings up networkmanager modem connectivity?
- Date: Fri, 24 Sep 2010 10:41:17 +0200
On Friday 24 of September 2010 01:36:45 hong sheng wrote:
> 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
>
Yeah, object paths change. You can list all available connections (object
paths) via ListConnection() method on org.freedesktop.NetworkManagerSettings
interface. And get settings of the connection using GetSettings(). There is
also NewConnection signal emitted (with object path as a parameter) when a new
connection becomes available.
List of available devices is produced by GetDevices() method of
org.freedesktop.NetworkManager interface. See [1] for that stuff.
e.g.:
dbus-send --system --print-reply \
--dest=org.freedesktop.NetworkManagerSystemSettings \
/org/freedesktop/NetworkManagerSettings \
org.freedesktop.NetworkManagerSettings.ListConnections
dbus-send --system --print-reply \
--dest='org.freedesktop.NetworkManagerSystemSettings' \
'/org/freedesktop/NetworkManagerSettings/0' \
org.freedesktop.NetworkManagerSettings.Connection.GetSettings
org.freedesktop.ModemManager provides EnumerateDevices() to list modem
devices' object paths and there is a signal DeviceAdded emitted while devices
are plugged [2].
You can use these D-Bus means to wire a script.
However, that's not all necessary. You can just use nmcli to activate a
connection identifying it via its name (id) or uuid (that doesn't change).
And, you don't need to know D-Bus objects paths.
Jirka
[1] http://projects.gnome.org/NetworkManager/developers/spec-08.html
[2] http://projects.gnome.org/NetworkManager/developers/mm-spec-04.html
> 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]