le_sim_GetIMSI doesn't seem to work

le_sim_GetIMSI doesn’t return the IMSI from the SIM, and logs says it can’t retrieve it. Command line “cm info” doesn’t show it either. This is on a WP7601, R7 Verizon software, Legato 17.11.

With the latest legato version, can able to retrieve ‘IMSI’ Value.
root@swi-mdm9x28:~# cm sim info
ICCID: 8991440459006589640
Home Network Operator: IDEA
IMSI: 404445900658964
Phone Number:
root@swi-mdm9x28:~# legato version

Need to upgrade legato version. If still faces the issue please provide logs.

Hi @Manikanta,
I’m assuming that the c/c++ the call le_GetIMSI will then work, since cm is an application?


Hi @EvetsMostel,
Yes, le_sim_GetIMSI() will work when called from c file. But to access any API through c file, it should be created as an application. To access le_sim_GetIMSI() API, le_sim.api file should be binded using the .adef file. As below

<executable>.<component>.le_sim → modemService.le_sim

Taken @ref: Application Definition .adef - Legato Docs
To develop Apps, @ref: http://legato.io/legato-docs/latest/basicApps.html


Hi @Manikanta
Of course, not sure how you’d do it any other way. lol


Hi @EvetsMostel, do you have any logs?

Also is the SIM ‘ready’?

Hi @CoRfr,
It seems to be inconsistent, but I think it’s related to when you have a static IPV4 SIM. I will try to post logs later. I make the connection to the network, so the SIM must be “ready”. cm says:
SIM card is inserted and locked (LE_SIM_INSERTED).

Hi @EvetsMostel

SIM card is inserted and locked (LE_SIM_INSERTED)

This means the SIM is locked and need pin code to unlock before WP can read/access the SIM.

You may try below to apply pin code and see does it able to read the IMSI.

cm sim enterpin <pin>
cm sim info

Alternatively, you may use below to unlock it permanently

cm sim unlock <pin>


Hi @lotam,
I don’t believe that this SIM is locked, as it was pulled out of a MC7455 which CAN read the IMSI. Also, I’ve never locked it, unless the Carrier did. It’s my personal SIM.

Can you share response for

cm sim info

I won’t give the particulars since this is a public forum, but it gives the ICCID, Home Network Operator and the phone number. The IMSI and EID are both Blank.

Manikanta from above, says that it needs to be the latest version of Legato. I’m running 17.11 because that’s what R7 is for the wp76xx.

This is odd, my understanding is that the IMSI is only available when the SIM card is in a READY state.
That’s what the code does, cf le_sim.c, GetSimCardInformation.
If it’s only in a INSERTED state, the Legato code doesn’t provide an IMSI.

Could you use the AT port to see if you can read the IMSI through that?

# microcom /dev/ttyAT

If it does return the IMSI while Legato doesn’t, then that would be an issue.

Hi @CoRfr,
Yes, it most certainly does. As I’ve said, I’ve used this sim on a MC7455 (my personal) and the software I use to control it works, and uses the IMSI to determine what the sim carrier is. It won’t work without it.
This is a WP7601 though, again running version 7.11 of Legato.


I do not have a device available at the moment, but could you rebuild Legato with the following patch to see if the IMSI is shown:

Something like:

cd legato
git fetch https://github.com/CoRfr/legato-af/ testimsi
git checkout FETCH_HEAD
make wp76xx

Could you also post some logs from logread with debug level on (log level DEBUG)?
The issue is hard to understand given that it seems that the SIM state is in ready state despite appearing as in inserted state.

Hi @CoRfr,
Sorry, I’ve been trying to get a release out. Still don’t have your info yet, but I did want you to know that for the WP7601, R8, Legato 18.1.0, it still does not output the IMSI. Even the built in cm won’t output it. I will try to get something later today if I can finish up this issue I’m working on.

Sorry, was doing a release and didn’t get back to this.
So, do I need a particular version of Legato to test this on? Or is this fetch going to give me the entire build?


When I try the git command, it says:
fatal: Not a git repository (or any of the parent directories): .git

I am now using R9 for the WP7601 and the IDE on Windows. If I use the cm command “cm sim info”, the SIM ID is there, but the IMSI is missing. I was never able to get your patch.

cm sim info
ICCID: 891480000016xxxxxxxx (value removed for security)
Home Network Operator: Verizon
Phone Number: +1xxxxxxxxxx (Value removed for security)
root@swi-mdm9x28:~# cm sim
SIM card is inserted and locked (LE_SIM_INSERTED).

As you can see that the IMSI is not showing up. The AT+CIMI still returns the IMSI.

Can you guys fix this by R10? When is that due out?


For the patch, you’ll need to do the git fetch operation from a git repository.
So typically you’ll need to checkout the repository as mentioned in GitHub - legatoproject/legato-af: Legato Application Framework

R9 on wp76 uses Legato 18.03.0, so that would look something like

mkdir -p legato-18.03.0
cd legato-18.03.0
repo init -u https://github.com/legatoproject/manifest -m legato/releases/18.03.0/legato.xml
repo sync

Then to checkout the patch:

cd legato/
git fetch https://github.com/CoRfr/legato-af/ testimsi
git cherry-pick FETCH_HEAD
make wp76xx