Notices


Reply
Thread Tools
Posts: 543 | Thanked: 151 times | Joined on Feb 2010 @ Germany
#21
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?
 

The Following User Says Thank You to Crogge For This Useful Post:
peterleinchen's Avatar
Posts: 4,117 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#22
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).
 

The Following 2 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
#23
Originally Posted by Crogge View Post
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?
I do not know of any "list",
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...

Last edited by peterleinchen; 2012-08-23 at 22:20.
 

The Following User Says Thank You to peterleinchen For This Useful Post:
Posts: 293 | Thanked: 163 times | Joined on Jan 2012 @ beijing-islamabad
#24
something i ever wanted and got it finally,thanks bud,hope you show up with yours other great projects as well.
 

The Following User Says Thank You to imo For This Useful 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:
peterleinchen's Avatar
Posts: 4,117 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#26
Originally Posted by yrannadx View Post
Using your app works fine for me.
Thanks for confirmation.

Originally Posted by yrannadx View Post
Also I will check your suggested code improvements although I have doubts this will ever work after so many tests I made.
Give it a try, even I do not see it causing it. But ...

Originally Posted by yrannadx View Post
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.
...
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.
This leads me to the conclusion, that your SIM2 somehow does not accept the switch code at that time. There is no check, if the 'call' (switch code) has been excuted, in contrary to your on-call check (which I like to add to my script). Do you know any return codes of dbus, that tell us: "call not allowed"?
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?


Originally Posted by yrannadx View Post
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.
Exactly that I was thinking about this afternoon Almost finished, needs some testing... (uploading to devel ...)
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?

Last edited by peterleinchen; 2012-08-25 at 09:03.
 

The Following 2 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
#27
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.
 

The Following 4 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
#28
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.

Last edited by peterleinchen; 2012-08-26 at 23:24. Reason: uploaded
 

The Following 2 Users Say Thank You to peterleinchen For This Useful Post:
Posts: 61 | Thanked: 64 times | Joined on Oct 2007 @ EU
#29
@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.

Last edited by yrannadx; 2012-08-27 at 15:30.
 

The Following User Says Thank You to yrannadx For This Useful Post:
peterleinchen's Avatar
Posts: 4,117 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#30
Nice to hear it is working better now.
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.

Last edited by peterleinchen; 2012-08-27 at 20:50.
 

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

Thread Tools

 
Forum Jump


All times are GMT. The time now is 15:51.