Project

General

Profile

Issue #1783

SIM card not recognized (regression, was working with Replicant 4.2)

Added by dje dje about 2 years ago. Updated 4 months ago.

Status:
New
Priority:
Urgent
Category:
SIM card not recognized
Target version:
Start date:
04/05/2017
Due date:
% Done:

0%

Resolution:
Device:
Galaxy S 3 (I9300)

Description

I'm a regular user or Replicant 4.2 on my mobile phone for years and I wanted to switch to a newer version. I had no problem with the previous version of Replicant 4.2.
I removed the security pin code, but the same result appears.

I followed this steps :

  • Run adb logcat -d -b radio > replicant_radio_log.txt after the device booted with Replicant 6.

I installed Lineagos 14 (lineage-14.1-20170405-nightly-i9300) and captured the same log. I have the output of adb shell dmesg after LineageOs has booted too.

  • You can send the logs in a PM as they can contain personal information.
    But for this part what is the email to choose to send logs ?

Thanks.

lineageOS14.tar.gz.gpg - kernel and radio logs for lineageOS14 (68 KB) dje dje, 04/06/2017 10:10 PM

replicant6.0.tar.gz.gpg - kernel and radio logs for replicant 6.0 (67.6 KB) dje dje, 04/06/2017 10:10 PM

replicant4.2.tar.gz.gpg - kernel and radio logs for replicant 4.2 (39.1 KB) dje dje, 04/06/2017 10:10 PM

replicant4.2.tar.gz.gpg - kernel and radio logs for replicant 4.2 Wolfgang key (38.6 KB) dje dje, 04/07/2017 08:36 AM

replicant6.0.tar.gz.gpg - kernel and radio logs for replicant 6.0 Wolfgang key (67 KB) dje dje, 04/07/2017 08:36 AM

lineageOS14.tar.gz.gpg - kernel and radio logs for lineageOS14 Wolfgang key (67.5 KB) dje dje, 04/07/2017 08:36 AM

Replicant6.0-GTi9300-radio.log.gpg - The sim card is not recognized (Replicant 6.0) (36 KB) Nicolas Feudé, 04/10/2017 08:06 PM

Replicant4.2-GTi9300-radio.log.gpg - The sim card is not recognized (Replicant 4.2) (25 KB) Nicolas Feudé, 04/10/2017 08:06 PM

Replicant4.2-GTi9300-radio-works_with_firmwares.log.gpg - The sim card is recognized (Replicant 4.2 with firmwares) (35.2 KB) Nicolas Feudé, 04/10/2017 08:06 PM

Replicant4.2-GTi9300-radio-works_without_firmwares.log.gpg - The sim card is recognized (Replicant 4.2 without firmwares) (35 KB) Nicolas Feudé, 04/10/2017 08:06 PM

larjona_replicant6_radio_log.txt.gpg (22.5 KB) Laura Arjona Reina, 04/15/2017 06:35 PM

larjona_replicant6_radio_log.txt.gpg (22.5 KB) Laura Arjona Reina, 04/15/2017 06:35 PM

dmesg.log.gpg (29 KB) Tomas Nordin, 04/17/2017 04:50 PM

events.log.gpg (6.7 KB) Tomas Nordin, 04/17/2017 04:50 PM

main.log.gpg (23.9 KB) Tomas Nordin, 04/17/2017 04:50 PM

radio.log.gpg (6.49 KB) Tomas Nordin, 04/17/2017 04:50 PM

system.log.gpg (8.58 KB) Tomas Nordin, 04/17/2017 04:50 PM

cyanogenmod_radio.log.gpg (59.9 KB) Piotr Kubaj, 04/19/2017 12:59 PM

replicant_radio.log.gpg (28 KB) Piotr Kubaj, 04/19/2017 12:59 PM

dmesg.log.gpg (23.5 KB) Piotr Kubaj, 04/19/2017 02:54 PM

Replicant-6.0-radio.txt View - Replicant-6.0 radio log on i9300 (245 KB) Raphaël Mélotte, 06/01/2017 09:05 AM

Replicant-4.2-radio_working.txt View - A radio log under 4.2 captured at the very first boot (radio working) (235 KB) Raphaël Mélotte, 06/01/2017 04:42 PM

Replicant-4.2-radio_not-working.txt View - A radio log under 4.2 captured after one reboot (radio not working) (157 KB) Raphaël Mélotte, 06/01/2017 04:42 PM

libsamsung-ril-i9300.so (190 KB) Wolfgang Wiedmeyer, 08/29/2017 10:21 PM

libsamsung-ril-i9300.so.asc (833 Bytes) Wolfgang Wiedmeyer, 08/29/2017 10:21 PM

libsamsung-ril-i9100.so (190 KB) Wolfgang Wiedmeyer, 08/29/2017 10:23 PM

libsamsung-ril-i9100.so.asc (833 Bytes) Wolfgang Wiedmeyer, 08/29/2017 10:23 PM

i9100-dmesg-sim-nopin-patchedril.log View (115 KB) Fil Bergamo, 08/30/2017 09:17 PM

i9100-dmesg-nosim-patchedril.log View (107 KB) Fil Bergamo, 08/30/2017 09:17 PM

i9100-radio-nosim-patchedril.log View (193 KB) Fil Bergamo, 08/30/2017 09:17 PM

i9100-radio-sim-nopin-patchedril.log View (356 KB) Fil Bergamo, 08/30/2017 09:17 PM

i9300-dmesg-nosim-patchedril.log View (124 KB) Fil Bergamo, 08/30/2017 09:17 PM

i9300-dmesg-sim-nopin-patchedril.log View (124 KB) Fil Bergamo, 08/30/2017 09:17 PM

i9300-radio-nosim-patchedril.log View (211 KB) Fil Bergamo, 08/30/2017 09:17 PM

i9300-radio-sim-nopin-patchedril.log View (367 KB) Fil Bergamo, 08/30/2017 09:17 PM

lineageos_radio_log.txt View - phone calls and mobile data working (347 KB) Matthias Aechtner, 10/08/2017 04:21 PM

replicant_4.2_radio_log.txt View - not working (196 KB) Matthias Aechtner, 10/08/2017 04:21 PM

replicant_radio_log.txt View - Replicant 6.0 0002: not working (203 KB) Matthias Aechtner, 10/08/2017 04:22 PM

replicant_radio_log_3.txt.gpg - i9300 with patched RIL, unlocked SIM, receives SMS (44.2 KB) Niclas Hoyer, 12/05/2017 07:53 PM

replicant_radio_log_2.txt.gpg - i9300 with patched RIL, but SIM locked (52.8 KB) Niclas Hoyer, 12/05/2017 07:53 PM

replicant_radio_log.txt.gpg - i9300 without patched RIL (27.2 KB) Niclas Hoyer, 12/05/2017 07:53 PM


Related issues

Related to Issue #1701: No SIM detection on Nexus S with replicant 4.2 Feedback 05/10/2016
Related to Issue #1605: SIM card not recognized GT-i9300 (modem crash) New 01/25/2016
Related to Issue #867: No mobile network / no SIM detected with fresh install of 4.2 on I9000M Resolved 03/02/2014
Related to Issue #1800: Bad SIM detection on Samsung Galaxy S2 I9100 Closed 05/18/2017
Related to Issue #1824: italian fastweb SIM card not recognized New 07/28/2017
Related to Issue #1852: No SIM - SIM unknown for Replicant 6.0 - Works for Replicant 4.2 0004 without an issue - SIM not recognized / unrecognized - PHONE i9300 New 12/13/2017
Related to Issue #1868: SIM not detected New 01/22/2018
Related to Issue #1874: Samsung Galaxy Note ll SIM Vodafone Spain, not detected New 02/23/2018

History

#1 Updated by dje dje about 2 years ago

I forgot to mention that under LineageOS everything works. And the Replicant image is from the build 18.2.17.

By the way the phone handles incoming calls and incoming SMS with no issue (despite the message No SIM card - Orange displayed on the main screen).
But outcoming calls are not possible (Cellular network not available).

Thanks.

#2 Updated by Wolfgang Wiedmeyer about 2 years ago

  • Assignee changed from Paul Kocialkowski to Wolfgang Wiedmeyer

Thanks for your report! Could you also include a radio log with Replicant 4.2?

I had previously instructed users to send the logs to my mail address, but there are now quite a few logs and I'd rather organize this in bug reports. Could you attach the logs as encrypted files to this bug report? See the wiki for instructions. This way, at least other Replicant developers can also view the logs and help me to fix this.

I will write the other users that sent me logs and ask them for permission to attach their logs as encrypted files either to this issue or related ones.

#3 Updated by dje dje about 2 years ago

Wolfgang Wiedmeyer wrote:

Thanks for your report! Could you also include a radio log with Replicant 4.2?

Yes of course.

Each encrypted archive contains both radio and kernel logs. Archives are encrypted with Paul's key and Wolfgang's key.
For lineageOS14 and for replicant 4.2, GSM and Data works.

Thanks !

#4 Updated by dje dje about 2 years ago

Sorry, I fix previous files uploaded, this new files are encrypted with the Wolfgang key.
Previous files can be deleted from issue.

#5 Updated by Nicolas Feudé about 2 years ago

I'm adding my own log from replicant 6.0, made in january. The SIM card is badly recognized eather in Replicant 6.0 and in Replicant 4.2. To be exact, it sometimes works randomly
It works with CyanogenMod 10.2, but i haven't made any log for it. Ask me if you want it.
I've done the log with and without the firmware (replicant 4.2), because the first time the simcard was recognized without the firmwares. It's not related and appears to be ramdomly recognized after a lot of test/reinstallation. I still put them in case it's useful.
The files are encrypted with Paul and Wolfgang keys
I put the file also in the #1605 issue for Replicant 4.2

#6 Updated by Laura Arjona Reina about 2 years ago

Hi, my SIM card is recognized in my i9300 with Cyanogenmod 13, but not with Replicant 6. I'm attaching the logs.
That SIM was working with Replicant 4.2.2 in that phone until one day that suddenly stopped working. Reflashing 4.2 didn't help.
Sorry I cannot provide the replicant 4.2.2, I'm currently using CM13 and couldn't find the time to do more tests, for now...

Thanks in any case for your work!

#7 Updated by Tomas Nordin about 2 years ago

I have Replicant (4.2) on a Samsung S3 GT-I9300. I have lost the mobile
network connectivity. I have tried my SIM-card on another device and it
worked, vice versa I tried another SIM-card on my phone and it did not
work.

There is some confusing behavior of the airplane mode. After a reboot
for example, the menu I get by holding the power button has a menu item
claiming that airplane mode is on. At the same time WIFI and Bluetooth
is on. It can be toggled to say off on that menu-item. During this time
airplane mode is not reported on by other menus like the pull-down menu
or the item found through the Wireless & network settings.

Also, while I have airplane mode not reported ON anywhere, when trying
to make a call despite I can see there is no network (in the
notification area on top), I get a message saying "To place a call,
first turn off Airplane mode."

I have no idea if the airplane mode behavior has anything to do with the
problem or is it an effect of the problem.

I have also discussed this issue a bit on the mailing list
. The logs attached was dumped with root
enabled on the device and starting with adb root if it makes any
difference. I used root because otherwise I got no dmesg log. Encryption
was done using keys of Paul, Denis and Wolfgang.

I have now moved my SIM-card to some other emergency device. I also made
a radio log with the sim removed. Tell me if that log is useful. When I
skimmed that log, it looked similar to me compared to the log with the
SIM-card attached.

#8 Updated by Piotr Kubaj about 2 years ago

I'm adding my own logs. Everything seems to work fine on the latest Replicant 4.2 and the last Cyanogenmod snapshot from the end of 2016, but on the latest Replicant 6.0 the SIM card is undetected. It also seems that I'm unable to set the OS not to require the SIM card PIN. When I set the option not to require it, it asks me for my PIN. When I enter it, it's rejected (tried on Replicant 4.2, the Cyanogenmod snapshot I use, and the other smartphone with stock ROM and without simlock).

#9 Updated by Piotr Kubaj about 2 years ago

Also attaching dmesg from CyanogenMod.

#10 Updated by Wolfgang Wiedmeyer almost 2 years ago

  • Priority changed from Normal to Urgent

#11 Updated by Raphaël Mélotte almost 2 years ago

On a (my first) fresh install of Replicant 6.0, I also have the issue where the SIM card is not recognized.
As F-Droid currently does not work with an external USB dongle nor usb networking (#1792), this makes it a particularly annoying issue where I can't install any app.
I can confirm the same SIM-card/phone works with Samsung's ROM. I can also provide my logs with Replicant and/or LineageOS if it is of any use.

#12 Updated by Tomas Nordin almost 2 years ago

Glad to see that the priority on this went from normal to urgent. Looking forward to get more help to help the helpers. I have no idea myself what to do to debug this. Still on a depressing emergency phone and I want my replicant back in order. Any new ideas?

#13 Updated by Wolfgang Wiedmeyer almost 2 years ago

Tomas, please check if the issue is still there with Replicant 6.0. If it is, then please open a new issue. It doesn't look like a SIM card problem in your case, because the radio interface fails to communicate with the modem pretty much right at the beginning. That's why the logs looked the same to you, with or without the SIM card. There are many of these errors in your log:

E/RILClient( 1900): Connect_RILD: Connecting failed. Connection refused(111)
D/RIL-IPC ( 1892): Reading RFS data failed
E/RIL-IPC ( 1892): Receiving from IPC RFS client failed
E/RIL     ( 1892): IPC RFS client loop failed

#14 Updated by Wolfgang Wiedmeyer almost 2 years ago

Laura Arjona Reina wrote:

Hi, my SIM card is recognized in my i9300 with Cyanogenmod 13, but not with Replicant 6. I'm attaching the logs.
That SIM was working with Replicant 4.2.2 in that phone until one day that suddenly stopped working. Reflashing 4.2 didn't help.
Sorry I cannot provide the replicant 4.2.2, I'm currently using CM13 and couldn't find the time to do more tests, for now...

Hi, it appears that you have attached the Replicant 6.0 log twice. The log is rather short. Could you capture another log after waiting at least one or two minutes after the phone is booted? It looks to me like the radio interface is never really able to access the SIM card at the SIM state never leaves the state "not ready". Not even the IMSI is successfully transferred.

Your issue is quite different compared to the regression between 4.2 and 6.0 that was originally reported. Could you open a new issue with the longer log? And could you also attach the log from CyanogenMod/LineageOS if you already have one? You could name the new issue "SIM card not recognized (SIM card never ready)" or something similar.

#15 Updated by Wolfgang Wiedmeyer almost 2 years ago

Raphaël Mélotte wrote:

On a (my first) fresh install of Replicant 6.0, I also have the issue where the SIM card is not recognized.
As F-Droid currently does not work with an external USB dongle nor usb networking (#1792), this makes it a particularly annoying issue where I can't install any app.
I can confirm the same SIM-card/phone works with Samsung's ROM. I can also provide my logs with Replicant and/or LineageOS if it is of any use.

In case you used Replicant 4.2 before: did it work with 4.2? At least a radio log with Replicant 6.0 is needed to decide what your issue is about. There can be several causes why the SIM card is not recognized.

#16 Updated by Wolfgang Wiedmeyer almost 2 years ago

  • Subject changed from No SIM detection on Samsung Galaxy S3 I9300 to SIM card not recognized (regression, was working with Replicant 4.2)

This issue should only be about the regression between 4.2 and 6.0.

Unfortunately, I don't yet have a fix for this. My guess so far is that with certain SIM cards, reading some data from the internal memory of the SIM card fails. The same failures happen with Replicant 4.2, but the SIM card is still usable. Android 6.0 is probably more strict about these failures. These read errors don't happen with CyanogenMod/LineageOS.

#17 Updated by Raphaël Mélotte almost 2 years ago

Wolfgang Wiedmeyer wrote:

In case you used Replicant 4.2 before: did it work with 4.2? At least a radio log with Replicant 6.0 is needed to decide what your issue is about. There can be several causes why the SIM card is not recognized.

I have never tried Replicant 4.2 before. I can confirm however that it worked with the stock ROM. I remember trying LineageOS one time and if I remember correctly it wasn't working either.
I'll try to test it under Replicant 4.2.
I have another i9300 under LineageOS and I could use the same SIM card with it so it might be one of the two device that isn't able to use it under LineageOS/Replicant but at least I'm sure the SIM card isn't faulty.

EDIT:
I just tested under replicant 4.2. At the very first boot, I'm asked for the PIN code and the card gets unlocked, data networking is working (I didn't test telephony). However, after having rebooted once, I'm no longer asked for the PIN code and data networking is not working.
I'll try to attach a radio log captured at the very first boot (Replicant-4.2-radio_working) and another one after a reboot (Replicant-4.2-radio_not-working).

#19 Updated by Wolfgang Wiedmeyer almost 2 years ago

Raphaël Mélotte wrote:

I'll try to attach a radio log captured at the very first boot (Replicant-4.2-radio_working) and another one after a reboot (Replicant-4.2-radio_not-working).

Thanks, these could provide some additional clues. Your logs look similar to the others in this issue. This line seems to be there in all of them:

06-01 10:53:51.085 2812 2812 D GSMPhone: [GSMPhone] updateCurrentCarrierInProvider: mSubId = -2 currentDds = -1 operatorNumeric = null

currentDds shouldn't be -1. This means that Android couldn't determine how many SIM card slots are available. The value should be retrieved from settings in the data partition. These are generated early at boot and I don't yet know why this happens because the RIL seems to work fine up to this point, at least from what I can see in the logs.

I asked Paul to look into this issue and he hopefully has some time in the near future.

#20 Updated by Wolfgang Wiedmeyer over 1 year ago

While working on QMI-RIL, I noticed something that might be helpful for fixing this issue. The proprietary RIL returns the SIM card type as USIM, while Samsung-RIL returns SIM. I don't know how to distinguish these two in the RIL and detect the proper type, but USIM should likely be the proper type for almost every Replicant user. I expect that almost every Replicant user has a USIM card which were introduced with UMTS.

If the type is USIM, then Android requests different paths in the internal filesystem of the SIM card. My guess is that for the SIM cards that work with the current Samsung-RIL, some kind of fallbacks exist so that the files are found, even when paths for the older SIM type are requested. And the SIM cards, that don't work, don't have such fallbacks and only work when paths for the newer USIM type are requested.

This issue very likely affects all devices that use Samsung-RIL in the same way. I attached RILs for i9300 and i9100 that report USIM type. You can test them in the following way:
  1. Download *.so and *.asc file for your device
  2. Verify the signature:
    gpg --armor --verify path/to/libsamsung-ril-YOUR_DEVICE.so.asc path/to/libsamsung-ril-YOUR_DEVICE.so
    

    It should have the signature of the Replicant 6.0 release key.
  3. Set up ADB and make sure it's running as root
  4. Install the new RIL:
    adb remount
    adb push path/to/libsamsung-ril-YOUR_DEVICE.so /system/lib/libsamsung-ril.so
    adb shell killall rild
    

It's quite possible that this change doesn't fix the regression yet and that there is something else that needs to be fixed as well. Please attach new radio logs if it doesn't work. Then we can go from there to find the other bugs. If it doesn't work and you have PIN lock enabled, it would be helpful if you could remove the PIN lock with another device or inside LineageOS. It may work without PIN lock because of another bug.

#21 Updated by Wolfgang Wiedmeyer over 1 year ago

  • Related to Issue #1824: italian fastweb SIM card not recognized added

#22 Updated by Fil Bergamo over 1 year ago

Thanks Wolfgang, for working also on this thing!

I tried your RILs right away..
No luck though..

Both with and without PIN lock, no SIM gets recognized, neither on i9100 nor on i9300..
I attached some other logs, all taken with your updated RIL in place.

Thanks again for looking into this.
I'm willing to do anything to help, so just ask and I'll try to do what's needed.

Cheers,

Fil

#23 Updated by Wolfgang Wiedmeyer over 1 year ago

Fil Bergamo wrote:

Thanks Wolfgang, for working also on this thing!

Yeah, it's probably the most frustrating Replicant bug I have looked into so far. AFAIR this is going on now since December of last year, when I received the first mails about this issue. The solution is probably a one-liner and pretty obvious, once you have figured it out ;)

I tried your RILs right away..
No luck though..

Both with and without PIN lock, no SIM gets recognized, neither on i9100 nor on i9300..
I attached some other logs, all taken with your updated RIL in place.

Thanks for the logs! Yes, they still show the same errors:

08-30 22:51:02.000  2896  2896 E SIMRecords: [SIMRecords] Exception in get GID1 com.android.internal.telephony.uicc.IccException: sw1:103 sw2:0

I expect that at least some of these SIMRecords exceptions are fatal for Android 6 which leads to the impression that the SIM card is not recognized. As an example, the request for the content of GID1 is this one:

08-30 22:51:01.670  2896  2896 D RILJ    : [3730]> iccIO: SIM_IO 0xb0 0x6f3e  path: 3F007FFF,0,0,26 aid: null [SUB0]

The path 3F007FFF is now the same as for the proprietary RIL which is good. As I previously already noticed in the other issue, the specified size (0x26 or 38) is wrong. It should be 8. That's currently my lead and what should be further investigated. With my SIM cards, it is also 8 with Replicant.

#24 Updated by Finn Damn over 1 year ago

Same issue: The SIM card in my i9100 is still not recognized with the patched file. :'(
By the way, the battery consumption is very high with Replicant 6, so after ca. 15 hours the battery must be charged again - with Replicant 4.2 it was after 2 to 3 days without a lot of usage. Maybe this issue is affected by that.

#25 Updated by Matthias Aechtner over 1 year ago

Hi,

I, too, have the problem of "No SIM card". So I wanted to add my logs and compare to the situation of others.

In my radio log for Replicant 6.0 I also have the line that Wolfgang pointed out in Raphaël's log:

D GSMPhone: [GSMPhone] updateCurrentCarrierInProvider: mSubId = -2 currentDds = -1 operatorNumeric = null

In my case the SIM card is not working with replicant 4.2 either, so no regression :-)

Neither do I have the IccException that was mentioned about Fil's log, nor the line with iccIO:

E SIMRecords: [SIMRecords] Exception in get GID1 com.android.internal.telephony.uicc.IccException: sw1:103 sw2:0
D RILJ    : [3730]> iccIO: SIM_IO 0xb0 0x6f3e  path: 3F007FFF,0,0,26 aid: null [SUB0]

The SIM card does work in my S3 with lineageOS and it works of cause in other phones.

Cheers,

Matthias

#26 Updated by Fil Bergamo over 1 year ago

I don't know if it can be of any help, but I just learned that my simcard that isn't recognized under R6.0 is a "USIM" type.
Could the sim type be relevant in this issue?
Could it be a lack of support of 3G-related protocols in 6.0 that were supported in 4.2?

#27 Updated by Hephaestus Aitnaios over 1 year ago

Fil Bergamo wrote:

I don't know if it can be of any help, but I just learned that my simcard that isn't recognized under R6.0 is a "USIM" type.
Could the sim type be relevant in this issue?
Could it be a lack of support of 3G-related protocols in 6.0 that were supported in 4.2?

How can one check whether or not a SIM card is of the "USIM" type?

#28 Updated by Fil Bergamo over 1 year ago

Hephaestus Aitnaios wrote:

How can one check whether or not a SIM card is of the "USIM" type?

Well, your telephony provider should tell you..
In my case, i found it written in the on the dashboard of my web account..

#29 Updated by Niclas Hoyer over 1 year ago

My SIM card is a "USIM" card. It does work normally on my i9100 using Replicant 4.2.
It is not recognized on Replicant 6.0. I tried my i9100 and also my new i9300 (see first log).

Then I started debugging on my i9300. At first I got the same exceptions, then I tried the patched RILs from Wolfgang. The exceptions were different (see second log), but there were still messages that my SIM is locked. So I used my i9100 to deactivate the SIM pin. Then I tried again with my i9300 and the patched RIL.

The SIM is still not recognized by Android, BUT I got an SMS from my provider that new settings are sent to my device. So GSM seems to be working (see third log). Then I did some more tests. Basically every incoming connection works, so I can receive SMS and even phone calls, but everything outgoing is blocked, because the SIM card is still "not recognized" and as such there is "no connection".

So maybe it works using patches RILs, but there is "just" some GUI bug?

#30 Updated by Fil Bergamo over 1 year ago

Niclas Hoyer wrote:

The SIM is still not recognized by Android, BUT I got an SMS from my provider that new settings are sent to my device. So GSM seems to be working (see third log). Then I did some more tests. Basically every incoming connection works, so I can receive SMS and even phone calls, but everything outgoing is blocked, because the SIM card is still "not recognized" and as such there is "no connection".

So maybe it works using patches RILs, but there is "just" some GUI bug?

Interesting suggestion here...
I don't think the bug would be in the GUI, but rather on underlying levels of the framework, if at all.
I can have a check on that, trying a little debugging..
Just give me some time and I'll get back here with a response..

#31 Updated by Fil Bergamo over 1 year ago

Niclas Hoyer wrote:

The SIM is still not recognized by Android, BUT I got an SMS from my provider that new settings are sent to my device. So GSM seems to be working (see third log). Then I did some more tests. Basically every incoming connection works, so I can receive SMS and even phone calls, but everything outgoing is blocked, because the SIM card is still "not recognized" and as such there is "no connection".

I confirm that I can receive calls and SMS's even if the SIM card is still unrecognized by the device.
I'm now looking into Replicant's source code, and I want to do some debugging to understand exactly where the information about gsm connection state is returned to the phone app.
Maybe it will be useful to understand what causes the state of the GSM connection to be reported as "missing"..

It would be much appreciated if someone can tell me where exactly the phone service is located inside the source tree. It would speed up my research a lot, instead of following references around the tree, like I'm doing right now..

#32 Updated by Niclas Hoyer over 1 year ago

I just ordered a "multicard" SIM from my provider, that allows me to use my i9100 and my i9300 simultaneously with the same number. I thought that would be great for debugging this issue. Unfortunately the new SIMs just work on Replicant 6.0. I still have the old SIM, which is deactivated. I think it should still be useful for debugging. All of them are "USIM" type SIMs supporting GSM/UMTS/LTE, same provider and they look the same. I wonder what could be different, that the old one isn't recognized.

It would be much appreciated if someone can tell me where exactly the phone service is located inside the source tree. It would speed up my research a lot, instead of following references around the tree, like I'm doing right now..

I was just poking around the tree by myself. One possible starting point could be Samsung-RIL, the libre software replacement for the proprietary RIL, that talks to the Android framework: https://redmine.replicant.us/projects/replicant/wiki/Samsung-RIL

#33 Updated by Fil Bergamo over 1 year ago

  • Related to Issue #1852: No SIM - SIM unknown for Replicant 6.0 - Works for Replicant 4.2 0004 without an issue - SIM not recognized / unrecognized - PHONE i9300 added

#34 Updated by Fil Bergamo about 1 year ago

#35 Updated by Fil Bergamo about 1 year ago

  • Related to Issue #1874: Samsung Galaxy Note ll SIM Vodafone Spain, not detected added

#36 Updated by Denis 'GNUtoo' Carikli 8 months ago

  • Category changed from Telephony and mobile data to SIM card not recognized

#37 Updated by Avgot Abike 6 months ago

Hello,

Like several other users, I had this issue and went to my mobile service provider to get a new SIM card and it worked. Before that, I tried to follow what happens in the radio log in the case of the old SIM card and does not happen with the new SIM card. Four consecutive lines caught my attention with old SIM card, and indeed it does not appear with the new one :

10-23 12:23:47.972 3445 3445 D SubscriptionController: [getSubId]- sSlotIdxToSubId.size == 0, return DummySubIds slotIdx=0
10-23 12:23:47.974 3445 3445 D SubscriptionController: [getSlotId]- subId invalid
10-23 12:23:47.974 3445 3445 D SubscriptionController: getSimStateForSlotIdx: simState=READY ordinal=5
10-23 12:23:47.974 2324 2937 D SubscriptionManager: getSimStateForSubscriber: simState=5 slotIdx=0

I interpret the two first lines as the SubscriptionController being unable to get a slot because getSubId returns DummySubIds. It does that because sSlotIndexToSubId is empty in SubscriptionController.java and the DummySubIds are generated by the function getDummySubIds(slotIndex) which from my reading of the code could return null if it does not find an appropriate integer with the function getActiveSubInfoCountMax(). However the latter function calls TelephonyManager::getSimCount() and should return 1 in the case of the mono-SIM Galaxy S2.

When come the two last line of the sample hereabove, it says that SubscriptionController::getSimStateForSlotIdx et SubscriptionManager::getSimStateForSubscriber return 5 (READY), which is strange after having stated that no slot was available.

However with the new SIM card, none of that occurs, and this can be confirmed when looking at the logs of Issue #1868 where the author made the same test as me (old SIM not working, new SIM working). In his new SIM logs, no trace of getSubId returning DummySubIds nor getSlotId complaining about invalid subId.

I hope it makes sense and could originate some progress on this annoying issue, which I believe is very blocking for the widespread of Replicant 6. Many thanks to the contributors !

#38 Updated by Fil Bergamo 4 months ago

I followed Avgot Abike's suggestions and had a look around the code for

sSlotIdxToSubId

in

frameworks/opt/telephony/src/java/com/android/internal/telephony/SubscriptionController.java

There are a bunch of TODOs/FIXMEs that caught my attention, both above the variable's definition, and in various other places, that suggest something is wrong with the current implementation in SubscritionController.

line 137:

 // FIXME: Does not allow for multiple subs in a slot and change to SparseArray
    protected static Map<Integer, Integer> sSlotIdxToSubId =
            new ConcurrentHashMap<Integer, Integer>();

See also line 751:

// (...)
// If sSlotIdxToSubId already has a valid subId for a slotId/phoneId,
// do not add another subId for same slotId/phoneId.
Integer currentSubId = sSlotIdxToSubId.get(slotId);
if (currentSubId == null
        || !SubscriptionManager.isValidSubscriptionId(currentSubId)) {
    // TODO While two subs active, if user deactivats first
    // one, need to update the default subId with second one.

    // FIXME: Currently we assume phoneId == slotId which in the future
    // may not be true, for instance with multiple subs per slot.
    // But is true at the moment.
    sSlotIdxToSubId.put(slotId, subId);
// (...)

And most interesting, line 1258:

protected int[] getDummySubIds(int slotIdx) {
        // FIXME: Remove notion of Dummy SUBSCRIPTION_ID.
        // I tested this returning null as no one appears to care,
        // but no connection came up on sprout with two sims.
        // We need to figure out why and hopefully remove DummySubsIds!!!
        int numSubs = getActiveSubInfoCountMax()
        // (....)

And finally, line 1611:

    // FIXME: We need we should not be assuming phoneId == slotId as it will not be true
    // when there are multiple subscriptions per sim and probably for other reasons.
    public int getSubIdUsingPhoneId(int phoneId) {
        int[] subIds = getSubId(phoneId);
        if (subIds == null || subIds.length == 0) {
            return SubscriptionManager.INVALID_SUBSCRIPTION_ID;
        }
        return subIds[0];
    }

Unfortunately I have no clue at all about what those comments mean..
Someone who knows about telephony???

Could it be a meaningful hint or just a red herring???

Also available in: Atom PDF