![]() |
Run script on connection to specific network
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. |
Re: Run script on connection to specific network
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 |
Re: Run script on connection to specific network
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 |
Re: Run script on connection to specific network
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") |
Re: Run script on connection to specific network
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 Please help me to get it work. newpipe |
Re: Run script on connection to specific network
/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.
|
Re: Run script on connection to specific network
Quote:
I used this: Code:
gconftool -R /system/osso/connectivity/IAP |more by ID , do you mean what I marked bold? Quote:
|
Re: Run script on connection to specific network
This is not the GPRS section. Try to understand the output from gconftool by considering the indentation.
|
Re: Run script on connection to specific network
One remark: running /etc/init.d/dbus-scripts reload , doesnt work here
http://talk.maemo.org/showpost.php?p=572440&postcount=2 |
All times are GMT. The time now is 05:53. |
vBulletin® Version 3.8.8