Hi all, Here is the source code to create a 3g connection: add-system-3g-connection.py --------------------------- #!/bin/env python # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # Copyright (C) 2010 Red Hat, Inc. # import dbus s_con = dbus.Dictionary( { 'id': 'china-unicom-wcdma-connection', 'uuid': 'd9e29b06-b609-44e0-b743-57a4d74141df', 'type': 'gsm', 'autoconnect': dbus.Boolean(False)}) s_ppp = dbus.Dictionary({ 'refuse-eap': dbus.Boolean(True), 'refuse-chap': dbus.Boolean(True), 'refuse-mschap': dbus.Boolean(True), 'refuse-mschapv2': dbus.Boolean(True)}) s_ip4 = dbus.Dictionary({'method': 'auto'}) s_gsm = dbus.Dictionary({ 'number': '*99#', 'apn': '3gnet'}) s_serial = dbus.Dictionary({'baud': dbus.UInt32(115200L)}) con = dbus.Dictionary({ 'connection': s_con, 'ppp': s_ppp, 'ipv4': s_ip4, 'gsm': s_gsm, 'serial': s_serial }) print con bus = dbus.SystemBus() proxy = bus.get_object("org.freedesktop.NetworkManagerSystemSettings", "/org/freedesktop/NetworkManagerSettings") settings = dbus.Interface(proxy, "org.freedesktop.NetworkManagerSettings") settings.AddConnection(con) --------------------------- David From: cmkf_2006 hotmail com To: networkmanager-list gnome org Subject: How to create a mobile broadband connection (system connection) via command line ? Date: Tue, 15 Mar 2011 09:39:12 +0800 Hi all, I can use nm-applet to create a system connection for my 3G usb card on my notebook, it works fine, and I can find the config file at /etc/NetworkManager/system connection. Now I need to use this 3G card on another PC, it is fedora 13, no any GUI, only has the command line mode. I copy the configure file from notebook, and put it in /etc/NetworkManager/system connection, the nm-tool and nmcli can not find this connection, so I can not let it works. My question is, how can I create a system connection for my mobild broadband device via command line ? I looked the examples in NetworkManager sources (python source code), but it only can add normal or Wifi connection, I have no idea how about mobile broadband device. Thanks for your help. David _______________________________________________ networkmanager-list mailing list networkmanager-list gnome org http://mail.gnome.org/mailm an/listinfo/networkmanager-list |