From a9f2d8dbd9c02ef260a1a49ee3fa4aa599943df9 Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Sat, 22 Jun 2019 14:10:35 +0300 Subject: [MTS-MTQ] SIM unlocking using the PIN code for radio-cmd Added a new "--unlock-sim-card" command --- main.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/main.cpp b/main.cpp index b74c9c6..52698fb 100644 --- a/main.cpp +++ b/main.cpp @@ -65,6 +65,7 @@ std::string g_sMIPMnHaSs; std::string g_sRxDiversity; std::string g_sActiveFirmware; std::string g_sConfigFile; +std::string g_sSimPin; Json::Value g_jData; MTS::AutoPtr g_apRadio; @@ -102,6 +103,7 @@ const uint32_t OPT_MSID = 0x00800000; const uint32_t OPT_SETRXDIVERSITY = 0x01000000; const uint32_t OPT_SETACTIVEFIRMWARE = 0x02000000; const uint32_t OPT_CONFIG_FILE = 0x04000000; +const uint32_t OPT_UNLOCK_SIM_CARD = 0x08000000; void handle_sigterm(int signum); void printHelp(const std::string& sApp); @@ -137,6 +139,7 @@ std::string loadImeiFromDeviceInfo(); { "set-mip-rev-tun", required_argument, 0, '7' }, { "set-mip-mn-aaa-ss", required_argument, 0, '8' }, { "set-mip-mn-ha-ss", required_argument, 0, '9' }, + { "unlock-sim-card", required_argument, 0, 'u' }, { "init-dc", no_argument, &iOption, OPT_INIT_DC }, { "init-fumo", no_argument, &iOption, OPT_INIT_FUMO }, { "init-prl", no_argument, &iOption, OPT_INIT_PRL }, @@ -358,6 +361,11 @@ int main(int argc, char** argv) { jArgs["fwid"] = g_sActiveFirmware; result = g_apRadio->setActiveFirmware(jArgs); printf("%s\n", code2str(result)); + } else if(g_iOptions & OPT_UNLOCK_SIM_CARD) { + Json::Value jArgs(Json::objectValue); + jArgs["pin"] = g_sSimPin; + result = g_apRadio->unlockSimCard(jArgs); + printf("%s\n", code2str(result)); } shutdown(); @@ -571,6 +579,13 @@ void parseOptions(int argc, char** argv) { g_iOptions |= OPT_SETMIPMNHASS; break; + case 'u': + if(optarg != 0) { + g_sSimPin = optarg; + } + g_iOptions |= OPT_UNLOCK_SIM_CARD; + break; + default: printf("OPTION: [%d] ABORTING!!\n", c); abort(); @@ -618,6 +633,7 @@ void printHelp(const std::string& sApp) { // Applicable for LTE910-NA1 dual FW images only // printf("\t--set-active-firmware : switch to a specific firmware image\n"); printf("\t--factory-default [ --msl ] : reset to factory defaults\n"); + printf("\t--unlock-sim-card : unlock the SIM card using the PIN code provided\n"); printf("\n"); printf("\t--printlvl (p) : sets the printlvl [0-100]\n"); printf("\t--version (v) : returns version\n"); -- cgit v1.2.3