Help with adding wifi connections with python



Hello,
I am trying to move from wicd to network-manager and from a python point of view it is not easy.
I have found a number of libraries but non of them works with Ubuntu 11.10 (nm 0.9).
(the project is wireless manager for xbmc)
 
These examples are great http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python
But do not cover more then one example of security setup.
I have reviewed the code for nmcli but it does not cover create connections.
 
I am now pretty close by using this example from this list
 
http://osdir.com/ml/networkmanager-list/2010-07/msg00107.html
 
It exectutes fine with sudo but the password is not set. I have no clue how to find more information and I really need some examples.
 
 
s_con = { 'id': 'XXX', 'uuid': '5ef2d781-1197-44eb-8744-cd78b9c07315', 'type': '802-11-wireless', 'autoconnect': False, 'name': 'connection' }
s_wifi = { 'ssid': dbus.ByteArray("XXX"), 'mode': 'infrastructure', 'security': '802-11-wireless-security', 'name': '802-11-wireless' }
s_wsec = { 'key-mgmt': 'wpa-psk', 'wpa-key': 'xxx', 'name': '802-11-wireless-security' }
s_ip4 = { 'method': 'auto', 'name': 'ipv4' }
con = { 'connection': s_con, '802-11-wireless': s_wifi, '802-11-wireless-security': s_wsec, 'ipv4': s_ip4 }
 
This is how far I am nowbefore adding functionality to create connections.
http://dl.dropbox.com/u/17892827/xbmc/vikjon0-py-nm.py
http://forum.xbmc.org/showthread.php?t=119592
 
 
best regards, Jonas


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