Cm sim storepin

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.

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.

For anyone else who stumbles across this same issue:

Include the le_cellnet api and the le_sim api in the cdef file.

        le_cellnet = le_cellnet.api
        le_sim = le_sim.api		

Bind the api’s in the adef file.

        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};

I welcome any cleaner solutions.