shib
July 8, 2019, 5:30am
1
I have a sim with a pin code and have saved the pin to secure storage with “cm sim storepin pin”
On boot the sim status is “inserted and locked (LE_SIM_INSERTED)”.
The documentation suggests that the pin is automatically read from secure storage on boot.
That is not happening here, the sim remains locked until unlocked manually.
I have read that the secure storage starts a timer which counts up to 300 before completing a backup, but I have tried leaving this for over 10 minutes after issuing “cm sim storepin pin” but it never manages to unlock automatically.
shib
July 8, 2019, 7:08am
2
Using the cellnet api I can confirm that the pin is being stored in the secure storage, but it is not being applied.
This can be done manually in the app, the issue is that it is supposed to be automatic.
shib
July 8, 2019, 11:25pm
3
For anyone else who stumbles across this same issue:
Include the le_cellnet api and the le_sim api in the cdef file.
api:
{
le_cellnet = le_cellnet.api
le_sim = le_sim.api
}
Bind the api’s in the adef file.
bindings:
{
your_project.your_component.le_cellnet -> cellNetService.le_cellnet
your_project.your_component.le_sim -> modemService.le_sim
}
And then in the COMPONENT_INIT do the following:
char pin[8]={0,0,0,0,0,0,0,0};
le_cellnet_GetSimPinCode(LE_SIM_EXTERNAL_SLOT_1,pin,sizeof(pin));
le_sim_EnterPIN(LE_SIM_EXTERNAL_SLOT_1,pin);
I welcome any cleaner solutions.
flu
August 22, 2019, 3:20pm
4
Hello Shane,
Can you please tell if before:
cm sim storepin pin
you also run:
cm sim select EXTERNAL_SLOT_1
KR,
flu
shib
August 22, 2019, 10:57pm
5
I do not explicitly tell it to use EXTERNAL_SLOT_1 because it uses that by default - as reported by cm sim info.
I just performed a test as per your recommendation.
cm sim select EXTERNAL_SLOT_1
cm sim storepin xxxx
reboot
And sim is unlocked automatically as it is supposed to be.
Edit:
My app was still running performing the unlock manually.
I Just checked with my app removed and the sim status is still locked on reboot.
plu
September 12, 2019, 12:49pm
6
hi @shib ,
an internal investigation is on going for this issue,
keep you inform on any progress,
BR
flu
September 13, 2019, 7:43am
7
Hello @shib
If useful, please note that there is an additional workaround:
Call “Ref = le_cellnet_Request()” from your Legato Application.
This will trigger the load of the SIM PIN from the secure storage.
KR.
flu
March 13, 2020, 7:47am
8
Hello Shane,
Here is the solution to this defect:
--- a/[components/cellNetService/cellNetServiceServer.c]
+++ b/[components/cellNetService/cellNetServiceServer.c]
@@ -917,6 +917,13 @@ COMPONENT_INIT
le_wdogChain_Init(1);
le_wdogChain_MonitorEventLoop(0, watchdogInterval);
+ // Try to load SIM PIN from secstore
+ le_sim_Id_t sim = le_sim_GetSelectedCard();
+ if (le_sim_IsPresent(sim))
+ {
+ LoadSimFromSecStore(sim);
+ }
+
LE_INFO("Cellular Network Server is ready");
}
KR.