Re: Documentation



On Thursday 25 of March 2010 22:37:34 Bluesky_greenleaf wrote:
> Thanks, But don't find the some examples in source tree of NM in examples
> directory.

http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python
Actually, there are just 3 examples now.

> Also I still have the confuse for the connection
> I have the object path /org/freedesktop/NetworkManager/Devices/0 for WIFI
> under the bus name org.freedesktop.NetworkManager, and

Yes, this is correct.

> /org/freedesktop/NetworkManager/AccessPoint/15 for this connection

This is, however, not the path of your connection, but path of the AP you want 
to connect to. This path should be the last parameter (specific_object) of 
ActivateConnection - instead of "/"; see ActivateConnection description.

As I've written, connections are configured set of settings and you can see 
them in nm-connection-editor (right click on nm-applet and choose "Edit 
connections"). They are provided by so called setting services, which of them 
are two: user and system service.
That's why SERVICE variable should be
SERVICE = "org.freedesktop.NetworkManagerSystemSettings"
or
SERVICE = "org.freedesktop.NetworkManagerUserSettings"
And the CONNECTION will look like this:
CONNECTION="/org/freedesktop/NetworkManagerSettings/1"

> 
> $SERVICE="org.freedesktop.NetworkManager"
> $CONNECTION="/org/freedesktop/NetworkManager/AccessPoint/15"
> $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:"/"
> 
> Error org.freedesktop.NetworkManager.InvalidService: Invalid settings
> service name
> 
> 
> If I try the following, it also have the errors:
> 
> SERVICE="org.freedesktop.NetworkManagerSystemSettings"
>  CONNECTION="/org/freedesktop/NetworkManager/AccessPoint/15"
>  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:"/"
> 
> Error org.freedesktop.NetworkManager.UnknownConnection: Connection was not
> provided by any settings service
> 
> How can I solve this problem? Thanks
> 
Use:
SERVICE="org.freedesktop.NetworkManagerUserSettings"
CONNECTION="/org/freedesktop/NetworkManagerSettings/1"
DEVICE="/org/freedesktop/NetworkManager/Devices/0"
AP="/org/freedesktop/NetworkManager/AccessPoint/15" 

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:"$AP"

The number in CONNECTION may be different, according to your configured 
connections.

For list of D-Bus connection paths you can use,
for user connections:
dbus-send --system --print-reply  --type=method_call \
--dest='org.freedesktop.NetworkManagerUserSettings' \
'/org/freedesktop/NetworkManagerSettings' \ 
org.freedesktop.NetworkManagerSettings.ListConnections

for system connections:
dbus-send --system --print-reply  --type=method_call \
--dest='org.freedesktop.NetworkManagerSystemSettings' \
'/org/freedesktop/NetworkManagerSettings' \ 
org.freedesktop.NetworkManagerSettings.ListConnections

If you didn't create a connection via nm-connection-editor, you can just left-
click nm-applet and you can see available APs. When you click an AP, a new 
connection is created (named "Auto your_AP_SSID").

A nice python script is also here:
http://pastebin.com/f37dffb97

Jirka


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