Skip to content

Commit

Permalink
[cellular] sara/quectel: make sure that we report a timeout error if …
Browse files Browse the repository at this point in the history
…we fail to get IMSI
  • Loading branch information
avtolstoy committed Mar 12, 2021
1 parent c394e85 commit 466844f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions hal/network/ncp_client/quectel/quectel_ncp_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ using CidType = decltype(CellularGlobalIdentity::cell_id);
const int QUECTEL_DEFAULT_CID = 1;
const char QUECTEL_DEFAULT_PDP_TYPE[] = "IP";

const int IMSI_MAX_RETRY_CNT = 5;
const int IMSI_MAX_RETRY_CNT = 10;
const int CCID_MAX_RETRY_CNT = 2;

const int DATA_MODE_BREAK_ATTEMPTS = 5;
Expand Down Expand Up @@ -949,15 +949,15 @@ int QuectelNcpClient::checkNetConfForImsi() {
const int r = CHECK_PARSER(resp.readResult());
if (r == AtResponse::OK && imsiLength > 0) {
netConf_ = networkConfigForImsi(buf, imsiLength);
break;
return SYSTEM_ERROR_NONE;
} else if (imsiCount >= IMSI_MAX_RETRY_CNT) {
// if max retries are exhausted
return SYSTEM_ERROR_AT_RESPONSE_UNEXPECTED;
}
++imsiCount;
HAL_Delay_Milliseconds(100*imsiCount);
} while (imsiCount < IMSI_MAX_RETRY_CNT);
return SYSTEM_ERROR_NONE;
return SYSTEM_ERROR_TIMEOUT;
}

int QuectelNcpClient::selectSimCard() {
Expand Down
4 changes: 2 additions & 2 deletions hal/network/ncp_client/sara/sara_ncp_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -955,15 +955,15 @@ int SaraNcpClient::checkNetConfForImsi() {
const int r = CHECK_PARSER(resp.readResult());
if (r == AtResponse::OK && imsiLength > 0) {
netConf_ = networkConfigForImsi(buf, imsiLength);
break;
return SYSTEM_ERROR_NONE;
} else if (imsiCount >= IMSI_MAX_RETRY_CNT) {
// if max retries are exhausted
return SYSTEM_ERROR_AT_RESPONSE_UNEXPECTED;
}
++imsiCount;
HAL_Delay_Milliseconds(100*imsiCount);
} while (imsiCount < IMSI_MAX_RETRY_CNT);
return SYSTEM_ERROR_NONE;
return SYSTEM_ERROR_TIMEOUT;
}

int SaraNcpClient::selectSimCard(ModemState& state) {
Expand Down

0 comments on commit 466844f

Please sign in to comment.