summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2019-06-22 14:10:35 +0300
committerSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2019-06-22 14:10:35 +0300
commita9f2d8dbd9c02ef260a1a49ee3fa4aa599943df9 (patch)
tree95e3d283c73276ccbc2f9a7812900dfcc0bb6ff9
parent5f7e999597ef8297fa4a82a71dda38dff3cd68fa (diff)
downloadradio-cmd-a9f2d8dbd9c02ef260a1a49ee3fa4aa599943df9.tar.gz
radio-cmd-a9f2d8dbd9c02ef260a1a49ee3fa4aa599943df9.tar.bz2
radio-cmd-a9f2d8dbd9c02ef260a1a49ee3fa4aa599943df9.zip
[MTS-MTQ] SIM unlocking using the PIN code for radio-cmd
Added a new "--unlock-sim-card" command
-rw-r--r--main.cpp16
1 files changed, 16 insertions, 0 deletions
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<MTS::IO::ICellularRadio> 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 <VAL> : switch to a specific firmware image\n");
printf("\t--factory-default [ --msl <MSL> ] : reset to factory defaults\n");
+ printf("\t--unlock-sim-card <SIM PIN> : unlock the SIM card using the PIN code provided\n");
printf("\n");
printf("\t--printlvl (p) <level> : sets the printlvl [0-100]\n");
printf("\t--version (v) : returns version\n");