Active Topics

 


Reply
Thread Tools
Posts: 187 | Thanked: 28 times | Joined on Apr 2007 @ Southampton, UK
#1
Hi all

I've tried searching for this but haven't found anything relevant as of yet.

What I want to do is get the N900 to run a script if it's connected to a specific network (specifically a backup script).

Alternatively does anyone know of a way of detecting what network the N900 is connected to using either Python or a command line command?

Many thanks for any help you can offer.
__________________
There is no place like /home.
 
Posts: 1,224 | Thanked: 1,763 times | Joined on Jul 2007
#2
dbus-scripts allows for running a script upon connection event. For example the following line in the config file /etc/dbus-scripts.d/orange runs the script /usr/local/bin/db-orange whenever a connection called orange of type DUMMY is established.

/usr/local/bin/db-orange * * com.nokia.icd status_changed orange DUMMY CONNECTED

Note that if you use connection generated by the GUI, you need to use their ID, rather than name.

For the second question, run the commands:

dbus-send --print-reply --system --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.get_statistics
and
dbus-send --print-reply --system --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.get_state
 

The Following 5 Users Say Thank You to Matan For This Useful Post:
Posts: 187 | Thanked: 28 times | Joined on Apr 2007 @ Southampton, UK
#3
Hi Matan

When I try running the dbus commands I get a series of unintelligible strings and ints, is there any way of making it tell me the name of the connection in a more human readable form. For example if I connect to a network with the ssid wifi can I get it to say when it's connected to wifi?

Thanks for any help.

Peter
__________________
There is no place like /home.
 
Posts: 1,224 | Thanked: 1,763 times | Joined on Jul 2007
#4
The first string in get_statistics gives you the id of the string. you need to look at the gconf database to convert it to a name.

In python you need to do something like:

self.conns = gconf_client.all_dirs("/system/osso/connectivity/IAP")
for item in self.conns:
name=gconf_client.get_string(item+"/name")
 

The Following User Says Thank You to Matan For This Useful Post:
Posts: 18 | Thanked: 3 times | Joined on Nov 2009 @ Graz, Austria
#5
Hi,
I also want to run a shell command when my mobile connects to a specific wifi connection but I can't find the directory "/etc/dbus-scripts.d/". I just see "/etc/dbus-1/". Is there something different with the new firmware?
Code:
Nokia-N900-42-11:/# uname -a
Linux Nokia-N900-42-11 2.6.28-omap1 #1 PREEMPT Thu Dec 17 09:40:52 EET 2009 armv7l unknown
I just want to run the command "vpnc vpnc" when the phone connects to the wifi "tug".

Please help me to get it work.

newpipe
 
Posts: 540 | Thanked: 288 times | Joined on Sep 2009
#6
/etc/network/up.d is also a place good place to run shell scripts (you need to check the connection from the scripts however). Sorry that I can't remember offhand exact commands for you.
 
Posts: 74 | Thanked: 34 times | Joined on Jan 2008
#7
Originally Posted by Matan View Post
The first string in get_statistics gives you the id of the string. you need to look at the gconf database to convert it to a name.

In python you need to do something like:

self.conns = gconf_client.all_dirs("/system/osso/connectivity/IAP")
for item in self.conns:
name=gconf_client.get_string(item+"/name")
I must have misunderstand you, as pasting these in python - doesnt work.
I used this:
Code:
gconftool -R  /system/osso/connectivity/IAP |more
and looked for the GPRS section (first in my case)
by ID , do you mean what I marked bold?
last_used_type = GPRS
flightmode_wlan = false
wlan_tx_power = 8
last_used_attrs = 83886080
last_used_network = Internet 3G
/system/osso/connectivity/IAP/36d13d8b-5baf-49af-8a3c-508c3c2a558f:
wlan_security = NONE
 
Posts: 1,224 | Thanked: 1,763 times | Joined on Jul 2007
#8
This is not the GPRS section. Try to understand the output from gconftool by considering the indentation.
__________________
My repository

"N900 community support for the MeeGo-Harmattan" Is the new "Mer is Fremantle for N810".

No more Nokia devices for me.
 
Posts: 74 | Thanked: 34 times | Joined on Jan 2008
#9
One remark: running /etc/init.d/dbus-scripts reload , doesnt work here

http://talk.maemo.org/showpost.php?p=572440&postcount=2

Last edited by niv; 2010-05-13 at 10:21. Reason: missing then statment
 
Reply


 
Forum Jump


All times are GMT. The time now is 15:39.