Notices


Reply
Thread Tools
Posts: 61 | Thanked: 64 times | Joined on Oct 2007 @ EU
#31
One more problem found: from time to time I get the message for the SIM I switched to as "empty string operator name, MNC: 0 and MCC: 0". The message is displayed about one second before having the GSM signal icon in place, thus I assume you are checking these parameters to early for the second SIM.

And finally I think I found the reason sim-switcher script is not always working as scheduled job, despite what I thought earlier that this was solved by increasing the delay between down and up. When running in this way (e.g. through Alarmed), the calls for switching the SIMs might be performed with the phone in some sleep or idle state and thus first switch succeed and switching back fails (due to "Calls not allowed" error). This highly depends on how many hours the phone was in idle state, so that is the explanation sometimes the script succeeded and sometimes fails and then I had to run killall csd to be able to switch back. In this situation, reactivate is not working.

Wondering if you have some idea how to wake up the phone in some state similar with the one when using the script through application icon and put that code in the script? I hope this makes sense.
 

The Following 2 Users Say Thank You to yrannadx For This Useful Post:
peterleinchen's Avatar
Posts: 4,117 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#32
@yrannadx

This message needs a huge sleep (for getiing the network code reliable). So I added a 30 s wait. Seems not to be enough in all situations. Especially not using param iap and forw_aft. So I added a infinite loop (no messages/popups) just before that to assure SIM is online before getting/printing network codes.

For your special problem I tried to switch forth and back with an sleepy/idle device and I could not reproduce. So I have no chance to support you here. The only way to get device into "app icon state" would be to unlock, which is not a good idea.
At first I thought it could be some lagging or swapping problem, but I tried with no delay between call and call release and no prob. So I am running out of ideas. Maybe try to do some research with longer sleeping time between call and call release, or add sleep time between call release and phonet down or add a second call/call release or or ...
Or it just may be a flaw of your adapter (like mine has when giving code2 on SIM2 it switches to SIM1). I am sorry to be not more helpful here. But please keep me informed or ask for more support.

--
just queued 0.5.8 to devel
and 0.5.9 (still learning about packaging on device)

Last edited by peterleinchen; 2012-08-30 at 21:30.
 

The Following 2 Users Say Thank You to peterleinchen For This Useful Post:
Posts: 61 | Thanked: 64 times | Joined on Oct 2007 @ EU
#33
@peterleinchen

Thanks, I will check your improved version of the application next week.

However, I still believe there is something wrong with saving data for both files:

/home/user/.config/sim-switcher/.tmp/currentSIM
/home/user/.config/sim-switcher/.tmp/home.plugins

Today I had a situation where home.plugins file was not saved (.tmp directory was empty) and then I didn't got home plugins restored. This would have been very bad if I would not use yesterday savehome command. Maybe you could do a check that the file home.plugins was really saved before killing hildon-home?

Regarding the other problem, I already tried with unlock and the following code is working for me although is not nice. I made it generic so that other users could use it if they will replace WLAN1,2,3 on line 22 with own wlans and then opcode (operator code) for SIM1 on line 58 and 90 from 1 to whatever operator code is in particular case, but this works only if operator code for SIM1 differ from SIM2. Of course if this is useful, the script could be made more generic and add these data that needs to be changed at the beginning of the script.

Code:
#!/bin/sh

CONNECTED=false
DROPCONN=false

call_check ()
{
  # 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:"Sync dropped due to active call!" uint32:0 string:"OK"
    exit 1
  fi
}

# check for existing wifi connectivity
if [ "$(/sbin/route | awk '/au/ {print $1}')" == "default" ]; then
  CONNECTED=true
else
  #Bring up WLAN
  sudo ifconfig wlan0 up
  for i in WLAN1 WLAN2 WLAN3
  do
    # scan for SSIDs, if not found continue
    if [ -z `sudo iwlist wlan0 scan | grep -m 1 -o \"$i\"` ]; then
      continue;
    fi
    # find IAP_ID from SSID
    IAP_ID=`gconftool-2 -R /system/osso/connectivity/IAP | tac | awk "/name = $i/,/connectivity\/IAP/" | awk -F '/|:' '/connectivity\/IAP/{ print $6}'`
    # try to connect to known wifi
    dbus-send --system --type=method_call --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:"$IAP_ID" uint32:0
    sleep 20
    if [ "$(/sbin/route | awk '/au/ {print $1}')" == "default" ]; then
      CONNECTED=true
      DROPCONN=true
      break
    fi
  done
  # if no WLAN was found (i.e. outdoor), then put WLAN down
  if [ "$DROPCONN" == "false" ]; then 
    sudo ifconfig wlan0 down
  fi
fi

# If no wifi try with GPRS
if [ "$CONNECTED" == "false" ]; then
  opcode=`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' '`
  
  # Temporary disable SIM switch
  #opcode=10

  # Check lock state of the phone and unlock
  lock=`dbus-send --system --type=method_call --dest="com.nokia.mce" --print-reply "/com/nokia/mce/request" com.nokia.mce.request.get_tklock_mode|awk -F "\"" '/g/ {print $2}'`
  call_check
  dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_tklock_mode_change string:"unlocked"

  # if operator code is (1) switch to SIM2
  if [ $opcode == 1 ]; then
    sim-switcher SIM2
    if [ $? -ne 0 ]; then
      exit 1
    fi
  fi
  # Connect Internet
  dbus-send --system --type=method_call --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:"Internet" uint32:0
  if [ $? -ne 0 ]; then
    exit 1
  fi
  CONNECTED=true
  DROPCONN=true
  sleep 10
fi

if [ "$CONNECTED" == "true" ]; then
  # sync erminig if having connectivity
  #/usr/bin/erminig -a

  # sync MfE
  dbus-send --print-reply --type=method_call --session --dest=com.nokia.asdbus /com/nokia/asdbus com.nokia.asdbus.sync
  sleep 90

  # drop the wifi connection if it was initiated by this script (saves battery)
  if [ "$DROPCONN" == "true" ]; then
    call_check
    dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true
  fi
fi

# Switch back to SIM1
if [ $opcode == 1 ]; then
  sim-switcher SIM1
fi

# Lock back if needed
if [ "$lock" == "locked" ]; then
  call_check
  dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_tklock_mode_change string:"locked"
fi
 

The Following 2 Users Say Thank You to yrannadx For This Useful Post:
peterleinchen's Avatar
Posts: 4,117 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#34
IMPORTANT NOTICE:
Originally Posted by yrannadx View Post
However, I still believe there is something wrong with saving data for both files:

/home/user/.config/sim-switcher/.tmp/currentSIM
/home/user/.config/sim-switcher/.tmp/home.plugins
Yep, sorry!

PLEASE everybody watch out !


I put version 0.5.10 into devel and this one resolves the /home/user problem with root/user rights. There was some strange behaviour (at least I did not know about) with conffiles and root owner. Do not ask more it took me a few versions ...

For everybody having already installed an older version of sim-switcher:
please check owner and rights for /home/user/.config/sim-switcher directory and files. It needs to belong to user, not root.
Make a copy of (or have in mind) your config. And then purge sim-switcher (apt-get purge sim-switcher), enable devel (or wait a few day until I push to testing), and do a install again (sudo apt-get install sim-switcher). I needed do to it twice to have apt set up sim-switcher correctly.
So
Code:
sudo apt-get purge sim-switcher
sudo apt-get install sim-switcher
sudo apt-get purge sim-switcher
sudo apt-get install sim-switcher
will be safe.
If you are asked to keep old or new config files (SIM1 / SIM2), then it is correctly set up. Please answer with yes ('y') to these questions at first install.

For everybody starting with >=0.5.10, you just need to say yes to config files overwriting at first install.

Please excuse this inconvenience, it was due to lack of deb packaging knowledge of mine.

Last edited by peterleinchen; 2012-08-31 at 21:35.
 

The Following 3 Users Say Thank You to peterleinchen For This Useful Post:
peterleinchen's Avatar
Posts: 4,117 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#35
Package 0.5.10 promoted to testing.
 

The Following 3 Users Say Thank You to peterleinchen For This Useful Post:
Posts: 138 | Thanked: 90 times | Joined on Mar 2012
#36
Thanks for program SIM-Switcher!
I am sorry for bad English.
I adapter MagicSIM28 also have two SIM one operator (with different tariffs). At switching with SIM1 on SIM2 (and on the contrary) I receive the following message on a screenshot:



Thus any SIM does not work (only I can call with SIM1).
Question: For correct job SIM should be different operators???
 
Posts: 138 | Thanked: 90 times | Joined on Mar 2012
#37
Originally Posted by yrannadx View Post
My one is Magicsim 28th
At me too Magicsim 28th. That you have printed in sim = "" (SIM swithing code, as given by your adapter). I have entered 001 and 002, but does not work!
Thanks for the answer!
 
Posts: 61 | Thanked: 64 times | Joined on Oct 2007 @ EU
#38
Originally Posted by Tiran View Post
At me too Magicsim 28th. That you have printed in sim = "" (SIM swithing code, as given by your adapter). I have entered 001 and 002, but does not work!
Thanks for the answer!
You should try first the SIM switch by simply dialing the number 001 and 002 from phone application. It should work. If not working, maybe you need to enable 007 mode by using another phone (N900 don't have SIM Toolkit support).
 

The Following 2 Users Say Thank You to yrannadx For This Useful Post:
Posts: 138 | Thanked: 90 times | Joined on Mar 2012
#39
Originally Posted by yrannadx View Post
You should try first the SIM switch by simply dialing the number 001 and 002 from phone application. It should work.
I have tried to switch SIM dialling number 001 and 002 of the telephone application, but does not work.

Originally Posted by yrannadx View Post
If not working, maybe you need to enable 007 mode by using another phone (N900 don't have SIM Toolkit support).
And here is more detailed please! I should insert the SIM-adapter into other phone but how there to switch on a mode 007 and what I there should change??? The mode 007 enable from phone menu??? If it is possible describe these actions more in detail!

Last edited by Tiran; 2012-09-06 at 14:06.
 
peterleinchen's Avatar
Posts: 4,117 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#40
IIRC the MagicSIM needs to be put in 007 mode first by using "any" GSM phone supporting STK. I.e. you will find in the phone menu anywhere (depending on phone model) an entry where to configure the SIM adpter. May it be under STK or Extras or SIM menu or or or.

If you put here your model (not the N900 of course) you should find lots of helpful hints.

As the N900 does not support the STK, SIM-Switcher relies to have the adapter set up to use 007 mode.
Then you need to set these switching codes in the config files.
 

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

Thread Tools

 
Forum Jump


All times are GMT. The time now is 11:02.