|
|
2010-03-17
, 23:49
|
|
Posts: 36 |
Thanked: 42 times |
Joined on Jan 2010
|
#22
|
|
|
2010-03-18
, 02:17
|
|
Posts: 36 |
Thanked: 42 times |
Joined on Jan 2010
|
#23
|
@JohnLF
Hum yes, I'm more a perl guy but that's a good idea, I could try to do that in python. Could be fun.
And to add a GUI, you can just create a conf file and the script called by dbus-scripts can read that file
[w32g] ### the comment reflect the default configuration ### true is true (case insensitive), everything else is false ### the command used to test the wifi connection before downgrading to 2g ### if you don't want to do test just delete after = connection_test = sudo /bin/ping -c 1 www.google.com ### notification message when going to 3g message_on_idle = 3G cellular mode set ### notification message when going to 2g message_on_connected = 2G (GSM) cellular mode set ### shall we go back to 3g when wlan disconnect ? #### if you want to have false just delete after = change_on_idle = true ### shall we go back to dual or 3g ? change_to_dual = true ### if you want go to 2g only when connected to some wlan you can add their wlan id here ### you can find the wlan id using the command ### gconftool-2 -R /system/osso/connectivity/IAP ### For example : ### wifi = 91f493fb-7c89-4fc6-ac2c-b822923dde45 9ee5dd55-9a32-4ee9-9131-c464ad31d907 # wifi =
|
|
2010-03-18
, 23:14
|
|
Posts: 183 |
Thanked: 115 times |
Joined on Nov 2007
@ Seattle, WA
|
#24
|
|
|
2010-03-19
, 00:22
|
|
Posts: 36 |
Thanked: 42 times |
Joined on Jan 2010
|
#25
|
An alternative to fcron and dbus would be to put a script in /etc/network/if-up.d (and in if-down.d). If you want to keep doing the polling, put a script there that enables fcron-managed polling.

|
|
2010-03-19
, 15:39
|
|
Posts: 56 |
Thanked: 7 times |
Joined on Dec 2009
@ Spokane, WA
|
#26
|
| The Following User Says Thank You to gregc2009 For This Useful Post: | ||
|
|
2010-03-23
, 21:11
|
|
Posts: 36 |
Thanked: 42 times |
Joined on Jan 2010
|
#27
|
Ran into a problem with it last night. I was on a work call and when I got home, it was dumped as the phone switched to the home wifi and then dropped to 2G. Called him back and then I was leaving home and after I lost my wifi, the script brought me back to 3G and dumped the call. Anyway to add a provision for it not to do anything if there is an active call?
dbus-send --system --dest=com.nokia.csd.Call --print-reply=literal /com/nokia/csd/call/1 com.nokia.csd.Call.Instance.GetStatus
|
|
2010-04-07
, 22:21
|
|
|
Posts: 551 |
Thanked: 507 times |
Joined on Feb 2010
@ North West England
|
#28
|
|
|
2010-04-07
, 22:27
|
|
Posts: 156 |
Thanked: 90 times |
Joined on Jan 2010
|
#29
|
|
|
2010-04-07
, 23:33
|
|
Posts: 267 |
Thanked: 183 times |
Joined on Jan 2010
@ Campinas, SP, Brazil
|
#30
|
I use dbus-scripts, it's a daemon a bit like cron but for dbus. So I add a rule to dbus-scripts, that rule watch for a wifi connection or deconnection signal.
Just follow the instructions of the install/configuration doc at the beginning of the following script and copy the script in a file /home/user/bin/w32g :
#!/usr/bin/perl # # You need to install dbus-scripts (BE CAREFUL, it's a devel package) # # as root you need to create a file /etc/sudoers.d/w32g # with this line : # user ALL = NOPASSWD: /bin/ping # and run the command update-sudoers because only root can use ping # # always as root and you need to create another file # /etc/dbus-scripts/w32g with one of the following line : # # to only change to 2g on connection (on one line) : # /home/user/bin/w32g * * com.nokia.icd status_changed * WLAN_INFRA CONNECTED # # to change to 2g on connection and 3g on deconnection # /home/user/bin/w32g * * com.nokia.icd status_changed * WLAN_INFRA * # # if you want to change to 2g only with some wifi networks, put their maemo wifi id separated by | # my $wifi = '91f493fb-7c89-4fc6-ac2c-b822923dde45|...'; # you can find the wifi id with the command gconftool-2 -R /system/osso/connectivity/IAP my $wifi = ''; # if you don't want to test connection, change the ping string by "/bin/true" my $connection_test = "sudo /bin/ping -c 1 www.google.com"; ### end of documentation/configuration my ($wifi_id,$state) = @ARGV[4,6]; # if we are not on the good wifi network we do nothing and exit exit if $wifi and not $wifi eq $wifi_id; my $dbus_wifi = "dbus-send --system --type=method_call --print-reply " . "--dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.set_selected_radio_access_technology"; my $dbus_notif = "dbus-send --system --type=method_call --print-reply " . "--dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint"; if ($state eq 'CONNECTED') { # we verified that the connection works my $ret = system($connection_test); if ($ret == 0) { system("$dbus_wifi byte:1"); system("$dbus_notif string:'2G (GSM) cellular mode set'") } } elsif ($state eq 'IDLE') { # to change to 3g instead of dual, use 2 instead of 0 in the line below system("$dbus_wifi byte:0"); system("$dbus_notif string:'3G cellular mode set'") }Last edited by nbc; 2010-03-17 at 23:45.