UIM card application state "illegal"

Hey!

I’m trying to debug an issue with an EM7565 that doesn’t want to even register in the network, it ends up in “limited” registration state in 3G. The output of “UIM Get Card Status” reports “Application state” as “illegal” for USIM:
# qmicli -d /dev/cdc-wdm0 -p --uim-get-card-status
[/dev/cdc-wdm0] Successfully got card status
Provisioning applications:
Primary GW: slot ‘1’, application ‘1’
Primary 1X: session doesn’t exist
Secondary GW: session doesn’t exist
Secondary 1X: session doesn’t exist
Slot [1]:
Card state: ‘present’
UPIN state: ‘not-initialized’
UPIN retries: ‘0’
UPUK retries: ‘0’
Application [1]:
Application type: ‘usim (2)’
Application state: ‘illegal’
Application ID:
A0:00:00:00:87:10:02:F2:30:FF:01:89:07:02:00:00
Personalization state: ‘ready’
UPIN replaces PIN1: ‘no’
PIN1 state: ‘disabled’
PIN1 retries: ‘3’
PUK1 retries: ‘10’
PIN2 state: ‘enabled-not-verified’
PIN2 retries: ‘3’
PUK2 retries: ‘10’
Slot [2]:
Card state: ‘absent’
UPIN state: ‘not-initialized’
UPIN retries: ‘0’
UPUK retries: ‘0’

What does that “illegal” mean?

Thanks in advance

For future reference, the specific issue I saw was because the operator (Zain Bahrain) seems to have a list of IMEIs allowed for a certain SIM. To solve this, either ask for a new SIM without this limitation, or ask operator support to add your IMEI to the SIM account’s whitelist.