Is your feature request related to a problem?
I accidentally broke access to my system with the PIN so I tried to recover it.
esp_modem didn't allow that so I tried adding a few things, see below.
In theory I would also add a way to really verify that the PIN is blocked, which can be done by sending a "AT+CPIN?" request (see e.g. https://techoverflow.net/2024/07/18/how-to-enter-the-puk-using-at-codes/).
That would allow more elegant treatment from the application layer.
The concept code I'm submitting copies "set_pin" and calls it "set_puk" which in retrospect is poor naming (I would call it e.g. "reset_pin" instead).
Needless to say I successfully unblocked my SIM card with this.
FYI I have a Lilygo T-SIM7080G board.
Describe the solution you'd like.
I added a call to set_puk to my application :
// check if PIN needed
bool pin_ok = false;
if (gsm_dce->read_pin(pin_ok) == command_result::OK && !pin_ok) {
if (gsm_dce->set_pin(CONFIG_GSM_SIM_PIN) == command_result::OK) {
// vTaskDelay(pdMS_TO_TICKS(1000));
} else {
ESP_LOGE(tag, "Failed to set SIM PIN");
// Try PUK
if (gsm_dce->set_puk(CONFIG_GSM_SIM_PUK, CONFIG_GSM_SIM_PIN) == command_result::OK) {
ESP_LOGI(tag, "PUK ok");
} else {
// abort();
gsm_failure++;
continue;
}
}
}
see comments above, a more solid test should be between set_pin and set_puk .
Describe alternatives you've considered.
I preferred this over popping the SIM card into my phone. I happen to have both on my desk but that isn't always the case.
I also thought about putting this on the SIM-7070 layer but it seemed to me like this is not board specific.
Additional context.
patch.txt
Is your feature request related to a problem?
I accidentally broke access to my system with the PIN so I tried to recover it.
esp_modem didn't allow that so I tried adding a few things, see below.
In theory I would also add a way to really verify that the PIN is blocked, which can be done by sending a "AT+CPIN?" request (see e.g. https://techoverflow.net/2024/07/18/how-to-enter-the-puk-using-at-codes/).
That would allow more elegant treatment from the application layer.
The concept code I'm submitting copies "set_pin" and calls it "set_puk" which in retrospect is poor naming (I would call it e.g. "reset_pin" instead).
Needless to say I successfully unblocked my SIM card with this.
FYI I have a Lilygo T-SIM7080G board.
Describe the solution you'd like.
I added a call to set_puk to my application :
see comments above, a more solid test should be between set_pin and set_puk .
Describe alternatives you've considered.
I preferred this over popping the SIM card into my phone. I happen to have both on my desk but that isn't always the case.
I also thought about putting this on the SIM-7070 layer but it seemed to me like this is not board specific.
Additional context.
patch.txt