fix home plmn extraction for PCSC USIM module

This commit is contained in:
Andre Puschmann 2019-07-19 10:17:34 +02:00
parent 028b44c1af
commit 2e9a981a8a
2 changed files with 11 additions and 2 deletions

View File

@ -184,12 +184,12 @@ bool pcsc_usim::get_home_plmn_id(srslte::plmn_id_t* home_plmn_id)
plmn_str << (int)imsi_vec[i];
}
if (not home_plmn_id->from_string(plmn_str.str())) {
if (home_plmn_id->from_string(plmn_str.str())) {
log->error("Error reading home PLMN from SIM.\n");
return false;
}
log->info("Read Home PLMN Id=%s\n", plmn_str.str().c_str());
log->info("Read Home PLMN Id=%s\n", home_plmn_id->to_string().c_str());
return true;
}

View File

@ -55,6 +55,15 @@ int main(int argc, char **argv)
std::string imsi = usim.get_imsi_str();
cout << "IMSI: " << imsi << endl;
srslte::plmn_id_t home_plmn_id = {};
if (usim.get_home_plmn_id(&home_plmn_id) == false) {
printf("Error reading home PLMN\n");
return SRSLTE_ERROR;
}
cout << "Home PLMN: " << home_plmn_id.to_string() << endl;
auth_result_t result = usim.generate_authentication_response(rand_enb, autn_enb, mcc, mnc, res, &res_len, k_asme);
return SRSLTE_SUCCESS;