#!/bin/bash set -x function get_status { NETWORK_STATUS=`dbus-send --system --print-reply --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.get_registration_status | head -n 2 |tail -n 1|awk '{printf $2}'` #0 -home -> go get connected #3 no-serv #4 no serv search #9 no coverage # look in telephony-maemo.c enum net_registration_status # echo $NETWORK_STATUS } NETWORK=`dbus-send --system --print-reply --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.get_registration_status | head -n 6| tail -n 2 |awk '{printf $2}'` if [ "$NETWORK" != "17260" ]; then #echo NOT IN AERO2 exit fi echo -e "AT\r" >/tmp/to_pnatd tail -f /tmp/to_pnatd | pnatd & sleep 1 echo -e "\rAT+CGATT=0\r" >> /tmp/to_pnatd sleep 5 echo -e "\rAT+CGATT=1\r" >> /tmp/to_pnatd ((TIMEOUT_COUNTER=45)); get_status until [ "$NETWORK_STATUS" == "0" ] || [ "$TIMEOUT_COUNTER" == "0" ]; do get_status ((TIMEOUT_COUNTER--)) sleep 1 done killall pnatd if [ "$NETWORK_STATUS" != "0" ]; then MESSAGE="Timeout on waiting to attach" dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:$MESSAGE else sleep 2 #connect to IAP Darmowy Aero2 dbus-send --type=method_call --system --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:"Darmowy Aero2" uint32:0 fi