[maemo-developers] [maemo-developers] Update on command line wifi connections

From: D. Scott Brown d.scott.brown at gmail.com
Date: Sat Oct 7 22:17:55 EEST 2006
Here's what I'm trying to achieve:

I've tried four methods limited or no success (see below for source  
and results), and I'm down to one last possibility. I don't have  
access to a linux box to test the real C API in osso-ic.h, and I  
would be happy to compensate any willing developer for his time if he  
can get this to work.

As I understand it, you can connect to any arbitrary wifi network  
using this function from osso-ic.h:
	gint osso_iap_connect(const char *iap, dbus_uint32_t flags, void *arg);
Described here:

Can someone try writing a simple command line program that connects  
to the wifi network in a string parameter?

Here's what I've tried on my own:

I tried using dbus directly, but it fails for everything but  

#____file: dbus_tester.py_____
import dbus
bus = dbus.SystemBus()
obj = bus.get_object('com.nokia.icd', '/com/nokia/icd')
iface = dbus.Interface(obj, 'com.nokia.icd')
print iface.get_statistics()
#below doesn't work

After re-reading the docs for the tenth time I noticed this sentence:  
"Applications should use the ICd D-BUS API only for statistics  
querying (get_statistics) and receiving IAP state change information  
(status_changed)." This might explain why the dbus calls won't,  
except that using osso fails the same way:

#____file: osso_tester.py_____
import osso
osso_c = osso.Context("osso_tester","0.0.1",False)
print osso_c.rpc_run("com.nokia.icd", "/com/nokia/icd",  
"com.nokia.icd", 'get_statistics', wait_reply=True, use_system_bus=True)
#below doesn't work:
#print osso_c.rpc_run("com.nokia.icd", "/com/nokia/icd",  
"com.nokia.icd", 'connect', ('linksys',1), wait_reply=True,  

I also tried using the linux wireless tools, but this doesn't appear  
to connect to anything:

#___file: wifi_connect.sh_____
sudo gainroot <
/usr/sbin/iwconfig wlan0 essid $1
/usr/sbin/iwconfig wlan0 key $2
/usr/sbin/iwconfig wlan0 commit

The only thing I've been able to get working is to use the  
connectivity_preload hack, but that pops up a system modal dialog  
with tiny fonts and the wrong orientation.

#____file: sock_tester.py_____
import socket, os
os.system('source /usr/bin/connectivity_preload.sh')
s = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
s.connect(("www.google.com", 80))

My last ditch solution is to try creating a custom theme that makes  
the connect dialog full screen, with big fonts, and images that  
roughly match the link at the beginning of this message. It would be  
ugly and suck, but I'm out of ideas.

Hope one of you can help,

More information about the maemo-developers mailing list