View Single Post
Posts: 68 | Thanked: 16 times | Joined on Feb 2007
#99
simple script which can help you, at leat if you can roam to a different network while on 2G

HTML Code:
#!/bin/sh

echo "$(date +%Y/%d/%y:%H.%M.%S) -- START" >> /var/log/checksim.log
echo $$ > /var/run/sim.pid

while true; do

        INTERVAL=`date +%S`
        IMSI=`dbus-send --system --type=method_call --print-reply --dest=com.nokia.phone.SIM /com/nokia/phone/SIM Phone.Sim.get_imsi 2>/dev/null | grep string | cut -f 5 -d " " | sed "s/\"//g"`
        TIMESTAMP=`date +%Y/%d/%y:%H.%M.%S`
        case $INTERVAL in
                00|0000|1500|3000|4500)
                        echo "$TIMESTAMP -- MARK"  >> /var/log/checksim.log
                ;;
        esac

                if [ -z $IMSI ]; then
                        sleep 5  
                        echo "$TIMESTAMP -- moving to 2G" >> /var/log/checksim.log
                        dbus-send --system --type=method_call --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.set_selected_radio_access_technology byte:1
                        dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteDialog string:"SWITCH TO 2G!" uint32:0 string:"OK"

                        sleep 3600

                        TIMESTAMP=`date +%Y/%d/%y:%H.%M.%S`             
                        echo "$TIMESTAMP -- moving back to 3G/dual" >> /var/log/checksim.log
                        dbus-send --system --type=method_call --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.set_selected_radio_access_technology byte:0
                fi
        sleep 1
done
just launch while in terminal. It will switch to 2G on SIM error. Connection will be moved back to "dual" after 3600 secs.

Have fun.

Last edited by maddler; 2010-05-16 at 17:23.
 

The Following User Says Thank You to maddler For This Useful Post: