![]() |
[Announce] SIM-Switcher, automated switching with a double ( dual ) SIM adapter
5 Attachment(s)
Having participated in the 2012 Coding Competition (wiki).
It seems you really use/like this little tool or thought it is worth a vote, as it got enough votes to make it second place in both categories Others, result and Beginners, result. Update: SIM-Switcher is now in Extras repository, thank you all for using/testing/feedbacking/voting! :) Download statistics. So, here is my very first own thread with a nice tool for everybody running a two SIM adapter in his/her N900. I do call them Double-SIM, as Dual-SIM naming pretends to have both SIM online, which is not possible with these adapters. As already stated in this thread there is the possibility to switch the SIM online without rebooting. Some time went by since this approach and I made some improvements to my solution. Functionality: - switch the SIM with one "app" icon click - 'refresh' hildon-home (to update the operator name) - choose the cell mode (2G/3G/Dual) - choose the connection policy, i.e. always ask, any connection, only WLAN, default GPRS connection - connect to a specific InternetAccessPoint (created via fAPN) and (badly desired by me and took me ages to find out) you may - set/unset call forwarding for current SIM and for the SIM you will switch to All done with one-click (from menu). --edit You may also add a shortcut to your desktop via the the desktop menu. Or use it with DCEW (same as command line usage, see) or use it with QBW (see here). edit-- Your adapter will need to support the so called 007 mode, i.e. the switching needs to be executed by calling a number (like 001, **1, 11*, 1#, ...). I have a GDI3SG (fully UMTS compatible) without any effects on battery. Mine has some characteristic/flaw to activate always the second SIM, when the same number is called (is handled in script). After installation, use vi nano txpad leafpad or any other editor of your choice and edit (/home/user/).config/sim_switcher/SIM1 and (/home/user/).config/sim_switcher/SIM2 to your liking. At least you need to give the switching code. So, that's it for now. Here is the deb package. It is also my very first package, so be gentle with me ;) I made it manually. Installed/removed/installed it on my device and everything fine. (will leave it attached, although in repo is newer/latest version) Ah, one more: of course this package depends on starhash-enabler, so please install if you do not have already. (repo package has dependency) I do not expect many users out there with a Double SIM adapter in N900. That is the reason I do attach the DEB directly here and not in the repos (and I do not know how to do that ;)). But if I get some response here, I will do so .... Nevertheless here is the package page. So if you like to vote for it (do not forget to log into maemo.org or you will not see the thumb up, as I always do ;)). Happy switching. -- edit 1 Giveaway functionality: - saving and restoring plugins/widgets/desktop sometimes necessary after crash/kill of hildon-home (seldom hildon-desktop). In x-term call Code:
sim-switcher savehome Code:
sim-switcher restorehome -- --edit 2 Upgrade from Pre-Announce to Announce (put into repos). -- --edit 3 Now in extras-testing with updated version, possible to set the operator name on desktop icon. Vote -- --edit 4 New version with online check before starting the switch. This is needed to not run the full tasks if not connected, could lead to bad call forwarding settings (esp. if SIMs are from same network. This infinite loop may be canceled via command-line 'sim-switcher break'. Automatic call of editor on first start. Vote -- --edit 5 Important Notice Please use only version >=0.5.10 for installation! Otherwise you may experience strange/odd behaviour, see here for more details. Sorry! Vote. -- --edit 6 New stable version 0.5.12 in testing. Please vote for this version. -- --edit 7 Version 0.5.12 is now in Extras repository. -- -- edit 8 New stable version 0.6.5 in Extras-Testing. Please vote for this version again. -- This is it's icon: http://talk.maemo.org/attachment.php...1&d=1346449525 And here are some screenshots (mainly popup messages, as it has no GUI): |
Re: [Pre-Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
Thank you :)
and nice start ;) |
Re: [Pre-Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
I appriciate your effort. though i wanted this feature a couple of years ago when i realized phone was missing sim toolkit support. Good work..
/nkirk |
Re: [Pre-Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
for the people who cant buy please give some advice.
thanks in advance |
Re: [Pre-Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
Quote:
if you can't buy that, then the advice would be to ignore this thread?! |
Re: [Pre-Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
alright im sorry?
|
Re: [Pre-Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
i meant give some advice to build that adapter for people who cant buy this adapter
|
Re: [Pre-Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
Quote:
IIRC these things simply have a SIM electrical pad, with a microcontroller hooked up to two SIMs at the same time, and simply switches signal lines between them. Sounds simple enough, until you see how much space you can't work with. |
Re: [Pre-Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
Quote:
Quote:
|
Re: [Pre-Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
No need for apologies "peterleinchen" i just typed what i felt when i saw the title and how simple & easy this app was. I was using 2 lines on a single sim before switching to N900, I missed that feature badly and I had to settle for a single primary connection because of the absence of stk.
/nkirk |
Re: [Pre-Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
Nice work, peterleinchen! It just *begs* for being in repositories :)
|
giveaway functionality to save/restore desktop after crash / kill of hildon-home (hildon-desktop)
Added following comment (forgotten on OP):
Giveaway functionality: - saving and restoring plugins/widgets/desktop sometimes necessary after crash/kill of hildon-home (seldom hildon-desktop). In x-term call Code:
sim-switcher savehome Code:
sim-switcher restorehome There may follow more ... ;) |
Re: [Pre-Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
Quote:
You may find it now in the repos (atm devel, promoted to testing). |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
@peterleinchen, thanks your application works fine.
However, if you have some experience with switching SIMs, maybe you can help with the following use case: I want to switch to SIM2, synchronize Exchange and then switch back to SIM1, all of this with Alarmed application that runs regularly the below script. For some reason, if I am using in script the code "sudo /opt/sim-switcher/phonet-helper down and then up", the phone remains with SIM2, and when I am trying some call I get "Call not allowed" message. Only after I am running from command line "sudo killall csd" I can switch back to SIM1. If instead of phonet0 down I am using "run-standalone.sh dbus-send --system --print-reply --dest=com.nokia.csd.Call /com/nokia/csd/call com.nokia.csd.Call.Release", the script switches fine to SIM2, sync and back to SIM1, but after a few runs, I still get to the above situation. Any help with this would be appreciated. Thanks. Code:
#!/bin/sh |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
New version in testing.
Added parameter "oper" in config file to add the operator name for specific SIM. Will be shown as name for desktop icon. Keep it short, less than 9 chars, and please do NOT use blanks (but put underlines or such, e.g. "VF_de" instead of "VF de") in that parameter. |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
@yrannadx
Nice one, too. I can only think of timing problems, maybe the 7 seconds is not enough between down and up. I had same problesm, but after setting to 7 seconds it always worked out for me. Do you have high loads? And the CallRelease just ends the call, no more. It may be there, but it is not needed, as shutting down phonet0 is doing the same (OK, almost). Shutting down the telephony system (and enabling again) will bring up the switch. So I am curious how you are able to switch without bringing down? Oh and one more about timing. Maybe also increase he sleep between bringing up the call and shutting down. Maybe your adapter needs more time to detect ... Either way let me know, to make mine more stable, please. But you said my method works for you? Oh and about 'killall csd': that was my first very early approach and it worked out. But after a few switches I ran into troubles also (do not remember exactly, but I think it was about internet connectivity / telephony unavailable). -- Maybe found your issue: imagine going into your script with SIM2 active! Then opcode1 will be 10 and opcode2 will be 10 also. So at the end of script there is no instruction to switch back to SIM1 ... |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
@peterleinchen
Maybe it depends of SIM adapter. My one is Magicsim 28th and the switch actually works fine just by using CallRelease without calling phonet0 down and up. But of course the SIM switch works also with your method, phonet0 down and up, as well as with killall csd. I tried different timings and so on and it was not working. The new code that seems to work is to use CallRelease after calling the switch code and using once the phonet0 down and up after "Disconnect SIM2 Internet" command. Maybe connecting and disconnecting the internet is the problem that prevented the switch back to SIM1 after that. if opcode1 is 10 and opcode2 is 10 also, then that is the intended behavior of the script, to remain with SIM2 and not to switch back, so I think the script is OK. I will try for few days the new code to see if it works after several switches combined with normal phone usage. Code:
# Try with SIM2 |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
@yrannadx
If it is intended (not go back to SIM1, if started withSIM2) then it seems OK. Let me guess: you do not have PIN code enabled on second SIM, but you do have on SIM1? In that case the switching to SIM2 occurs immediately after the call release. And a phonet down/up is not necessary (but do not harm either). So in that/your case just omit down/ups for switch to second SIM and it should work. But it should work also with my approach. What about using command line 'sim-switcher SIM1' in your script (in config file only the switch code)? So in short: Never use killall csd, it will create internet (access point) problems. If there is no PIN code query enabled, switching occurs without any interaction (but it works with my method, too). -- more edit I have some extension ready to let my script wait if there is no cell radio connection available. In my case I do need the SIM to be online to successfully switch. Please let me know if that is valid for your adapter too (go into offline mode and dial 002 and see if the SIM switches, I expect not). |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
@peterleinchen
Actually none of the SIMs have PIN code enable so that's the explanation. On the other hand, it seems none of the methods are working after all. Nor my above attempts, nor calling 'sim-switcher SIM1 and 2' in the script. It is strange why first attempt of running the script succeeded (when using sim-switcher) and second attempt fail with SIM2 remaining active and when I am trying a normal call with SIM2 I get call not allowed (although your script display wrongly the message of successfully switch). This means also that switching back to SIM1 is not possible without using killall csd or reboot. Maybe the sync is causing this strange behavior, otherwise I see no logical explanation for this. The next method I will try is to separate totally the actions of switch SIM and sync, i.e. to switch first the SIM 3 minutes before the sync with Alarmed, do the sync and switch back 3 minutes after the sync with Alarmed as totally independent actions. Regarding your note, I cannot dial 002 in offline mode to switch SIM. |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
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! In your script there is some flaw, which should not cause your behaviour, but who knows? Switch your code to: Code:
. Code:
. |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
Great work, I always wanted to use my business SIM in my beloved N900. Is there any compatibility list which adapters are working / fitting into the N900?
|
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
New version 0.4.1 out.
As yrannadx confirmed the necessity of cell modem to be online, I added some check and an infinite loop until first connectiion, then the switch starts. This may be canceled via command-line 'sim-switcher cancel'. changelog Added direct call of editor for config file without switching code (first start). Added online check before starting the switch (some adapter needs online status), may be deactivated. Added new param (stop) to interactively break/cancel a hanging switch (due to not being online). |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
Quote:
but there are two threads on TMO about dual SIM adapters (one linked in first post), maybe check those. I do use a GDI3SG (perfect, not battery consuming, full UMTS) and yrannadx has the MagicSIM28, so these are at least compatible. If you find other ones, just come back here ... Oh, and of course only the cutting adapter really fit. There is some other alternative to use a non-cutting version, but I do not advise, cause of N900 SIM card holder flaw... |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
something i ever wanted and got it finally,thanks bud,hope you show up with yours other great projects as well.
|
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
Quote:
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 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 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. |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
Quote:
Quote:
Quote:
If this (call not allowed) happens, then I think the switch is not initiated, but the script continues (sets currentSIM) and thinks everything went fine. So it marks the SIM1 as active, whereas still SIM2 is the active one (explanation for your messages and also behaviour). One possibility I may think of causing this is the non-ability of your adapter to have internet AND call at the same time (topic: GPRS class A B C). A full UMTS adapter does not care about such limitations. Was it assured that GPRS internet connection was down before switching back to SIM2? Could you please test this? Quote:
What is your favourite flavour? Be verbose as default or silent? I would say silent on command line as default and verbose per icon. I have added the SIM details and furthermore I would like to add the on-call check (it is not necessary for icon app, but for command line usage). Thanks for your helpful discussion and improving script snippets! :) Another question here is: I have added a infinte loop to wait for getting online. But without notifications you will not see it, or just by "script execution time/halt". I do not want to make it as param, but have added a file to detect this (see changelog version 0.4.1). So what do you think about this infinite loop? |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
New version 0.5.1 uploaded to devel.
changelog: Added details about SIMs in last popup. Added oncall check before starting the switch (sim-switcher may not be called during a call). Deactivated all popups for silent command-line usage. Added new SECOND param (-v / --verbose) to enable popups (default for app icons). Thanks to yrannadx for tips/hints/snippets. |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
And 0.5.2 out (devel).
changelog: Increased time between down and up (hopefully resolves seldom non-switch prob). Small modifications regarding output of operator and network codes. Some corrections regarding call of editor. Other little code reviews. @yrannadx during testnig I also once had this strange behaviour of not being able to switch. I just needed to bring down phonet0 and up it again. Solved. So as this happened to me also, the only reason I see is time between down and up. I had tested it earlier and tried to make it as short as possible (with some safety marfin). But too short is problematic, so I increased this value. Hopefully this solves your issue, please test and report. Meanwhile I just rethought that and will make another command line call 'reactivate' to solve this 'call not allowed' issue easily. And bring version 0.5.3 to devel. Uploaded! changelog Added another command line switch to (re)activate a failed switch. |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
@peterleinchen
This latest version of the script works much better. Seems now that the switch back and forth is successful all the time when run automatically by Alarmed. What's more surprising (really great) in my case is that now I have operator name updated on desktop by default although I am not using refhome. To answer some other items: - When I got "call not allowed" I was not using internet at all, just switch and wait 10 minutes and switch back. But now this scenario seems to work, although I cannot tell for sure before running automatically the switch for next few days. Also MagicSim 28th I think is full UMTS. - Using on-call check in your script is very useful, thanks. - Silent command line usage is great, thanks. - I think waiting for getting online is very useful in areas when there is low GSM signal, there might be scenarios when the switch is started in such conditions and signal drops before doing the switch. I have been traveling across low signal area and almost always things messed up, e.g. I arrived at destination with SIM2 active without being aware about that for example. Update: I can confirm that after several runs, the script works now great, I didn’t got “Call not allowed” not even once since the upgrade. So I can use now the Exchange sync script as I always wanted, thanks. Some more refine of the script suggested: - There is an error in command line: “/usr/bin/sim-switcher: line 452: was: not found”, not sure if this is important. - Check line 335, sleeep is misspelled, although I didn’t notice any change after correcting this line. - currentSIM method seems is not working OK, I had to delete manually the file so that to be able to make the switch back. Maybe you could use the operator code for this check or something else, or disable the check. At least in my case there is no harm if same SIM is tried to be activated. |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
Nice to hear it is working better now. :D
I think the delay between down and up was/is the key! Thanks for reporting back. It was late and I sleeepy ;) Fixed it and putting it as 0.5.4 to devel. About currentSIM: it is working flawlessly for me and mine (others adapters?) do need it, so I am going to keep it in (not making it configurable). As the new 'sim-switcher reactivate' almost is the same as activating the current active SIM. Your switching code is '002' for second SIM and '001' for first SIM, right? Please check your config files for SIM1 and SIM2 again. Using the op name may not be unique (SIMs from same network). But please test it again and give me more details, so we may overcome that little beast also :) And push it further to testing. |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
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. |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
@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) |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
@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 |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
IMPORTANT NOTICE:
Quote:
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 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. |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
Package 0.5.10 promoted to testing.
|
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
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: http://imageplay.net/img/tya22282718...906_010923.png Thus any SIM does not work (only I can call with SIM1). Question: For correct job SIM should be different operators??? |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
Quote:
Thanks for the answer! |
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
Quote:
|
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
Quote:
Quote:
|
Re: [Announce] SIM-Switcher (automated switching with a double ( dual ) SIM adapter)
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. |
All times are GMT. The time now is 08:43. |
vBulletin® Version 3.8.8