use of a USB Mobile Broadband dongle on a Raspberry PI




Hello

The Raspberry Pi comes with Raspbian ~ Debian Wheezy. This has NetworkManager and ModemManager however for some reason it does not have the nm-applet or
nm-connection-editor

pi@raspberrypi ~ $ uname -a

Linux raspberrypi 3.2.27+ #250 PREEMPT Thu Oct 18 19:03:02 BST 2012 armv6l GNU/Linux


This means I have no way to enter a mobile broadband connection. It would appear that I will have to use a python script to communicate with DBUS. Otherwise I suppose I would have to port nm-connection-editor to Raspbian something I would rather not get involved with at this point in time.

I have found this program on the web
 https://mail.gnome.org/archives/networkmanager-list/2011-March/msg00151.html
# 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 "hello 1"
print con
bus = dbus.SystemBus()
print "hello 2"
proxy = bus.get_object("org.freedesktop.NetworkManagerSystemSettings", "/org/freedesktop/NetworkManagerSettings")
print "hello 3"
settings = dbus.Interface(proxy, "org.freedesktop.NetworkManagerSettings")
print "hello 4"
settings.AddConnection(con)
print "hello 5"


The above program running on my Ubuntu 12.04 LTS PC currently bombs with an error on the   proxy = bus.get_object line.

hello 2
Traceback (most recent call last):
  File "./add_new_connection.sh", line 46, in <module>
    proxy = bus.get_object("org.freedesktop.NetworkManagerSystemSettings", "/org/freedesktop/NetworkManagerSettings")
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 241, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 180, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 278, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.NetworkManagerSystemSettings was not provided by any .service files
I have tried to understand from  http://dbus.freedesktop.org/doc/dbus-python/api/frames.html  but I am afraid at the moment my level of knowledge puts this beyond  my capabilities.
As I am new to Python and DBUS I am in need of assistance to determine what the problem is that causes this error to occur. Once this is solved I will then want to port the script to the Raspberry PI and create a similar connection to that on the Ubuntu PC.



from this machine currently using my dongle I will show you the nm-connection-editor screen of the connection I am now using.


neill.rutherford@freds-server:~$ nmcli dev
DEVICE     TYPE              STATE        
hso0       gsm               connected    
eth1       802-3-ethernet    unavailable  
eth0       802-3-ethernet    unmanaged    
neill.rutherford@freds-server:~$ nmcli con
NAME                      UUID                                   TYPE              TIMESTAMP-REAL                    
hso0 consumerbroadband    8dd2baca-939f-4fe0-a062-9e2a69430dda   gsm               Mon 17 Dec 2012 17:34:04 GMT      
hso0 internetvpn          f045142f-d02e-4366-8405-88694388c828   gsm               Thu 27 Dec 2012 16:29:52 GMT      
Nokia 6300 Network        d26d33bc-ca4f-4748-9793-32ea01ad1266   bluetooth         never                             
Wired connection 1        76c2bc93-bcf2-462f-9276-1870f07b0602   802-3-ethernet    Thu 27 Dec 2012 15:59:52 GMT      
n


 

 

 





begin:vcard
fn:Neill Rutherford
n:Rutherford;Neill
adr:;;6  Hillside;Ludlow;Shropshire;SY8 1RB;United Kingdom
email;internet:Neill Rutherford gmail com
x-mozilla-html:TRUE
version:2.1
end:vcard



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