View Single Post
Posts: 61 | Thanked: 64 times | Joined on Oct 2007 @ EU
#25
Originally Posted by peterleinchen View Post
Hey yrannadx,

one question at first:
my app is working for you? So using sim-switcher switches from SIM1 to SIM2 and vice versa?

How do you verify your script dows not switch back to SIM1?
Do not rely on operator name shown on hildon-home!
Using your app works fine for me. Sometimes I got the message "Please do NOT call me on already selected SIM ($1) !" which I shouldn't, maybe the currentSIM file got messed when using the command in my script. I think maybe the file is not updated when sim-switcher is run inside a script or maybe other reason.

I would suggest an improvement in your application:
- possibility to use your script silently without pop-up messages, e.g. if I want to switch by Alarmed I don't want success messages to be displayed.

I am using a Desktop Command Widget for checking operator name so that to know exactly what operator I am with, with the following script executed:

Code:
#!/bin/sh

opcountry=$(dbus-send --system --print-reply=literal --dest=com.nokia.phone.net /com/nokia/phone/net \
Phone.Net.get_registration_status | tr '\n' ' ' | awk '{print $8,$10}')
opcode=$(echo $opcountry | cut -f1 -d' ')
countrycode=$(echo $opcountry | cut -f2 -d' ')
dbus-send --system --print-reply --dest=com.nokia.phone.net /com/nokia/phone/net \
Phone.Net.get_operator_name byte:0 uint32:$opcode uint32:$countrycode | grep string \
| awk '{print $2 " " $3}' | tr -d \"
Also I will check your suggested code improvements although I have doubts this will ever work after so many tests I made.


Update:
I was trying to switch to SIM2 for 10 minutes and then back to SIM1 (e.g. for receiving SMS messages if any), without doing anything else, by using the following simple script two times in Alarmed.

Code:
#!/bin/sh

# Check no call in progress
oncall=`run-standalone.sh dbus-send --system --type=method_call --print-reply=literal --dest=com.nokia.csd.Call /com/nokia/csd/call/1 com.nokia.csd.Call.Instance.GetStatus`
if [ $oncall != "uint32 0" ]; then
  dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteDialog string:"No switch while oncall" uint32:0 string:"OK"
  return
fi

# Switch SIM
opcode=`run-standalone.sh dbus-send --system --print-reply=literal --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.get_registration_status | tr '\n' ' ' | awk '{print $8,$10}' | cut -f1 -d' '`
# if operator code is from SIM1 switch to SIM2
if [ $opcode == 1 ]; then
  sim-switcher SIM2
else
  sim-switcher SIM1
fi
The first switch went fine to SIM2, but then switch back to SIM1 failed and the phone remained with Operator2. This due to "Call not allowed" message when trying to make any call with SIM2. The same as before, I could switch back to SIM1 only after running killall csd. So it is quite clear that for some reason switching the SIM in any other way than from application icon will fail.

Maybe you could try running such switch back and forth with Alarmed or other meaning with your adapter, after all switching the SIMs for certain period of time from time to time is a valid case for anybody using 2 SIMs.

Last edited by yrannadx; 2012-08-24 at 09:29.
 

The Following 2 Users Say Thank You to yrannadx For This Useful Post: