summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
index fe33431..5bd4f83 100644
--- a/main.cpp
+++ b/main.cpp
@@ -67,6 +67,7 @@ std::string g_sActiveFirmware;
std::string g_sConfigFile;
Json::Value g_jData;
std::string g_sRadioMode;
+std::string g_sSimPin;
MTS::AutoPtr<MTS::IO::ICellularRadio> g_apRadio;
@@ -105,6 +106,7 @@ const uint32_t OPT_SETACTIVEFIRMWARE = 0x02000000;
const uint32_t OPT_CONFIG_FILE = 0x04000000;
const uint32_t OPT_GET_RADIOMODE = 0x08000000;
const uint32_t OPT_SET_RADIOMODE = 0x10000000;
+const uint32_t OPT_UNLOCK_SIM_CARD = 0x20000000;
void handle_sigterm(int signum);
void printHelp(const std::string& sApp);
@@ -144,6 +146,7 @@ static struct option long_options[] = {
{ "set-mip-mn-ha-ss", required_argument, 0, '9' },
{ "get-radio-mode", no_argument, &iOption, OPT_GET_RADIOMODE },
{ "set-radio-mode", required_argument, 0, OPT_SET_RADIOMODE },
+ { "unlock-sim-card", required_argument, 0, OPT_UNLOCK_SIM_CARD },
{ "init-dc", no_argument, &iOption, OPT_INIT_DC },
{ "init-fumo", no_argument, &iOption, OPT_INIT_FUMO },
{ "init-prl", no_argument, &iOption, OPT_INIT_PRL },
@@ -373,6 +376,11 @@ int main(int argc, char** argv) {
} else if(g_iOptions & OPT_SET_RADIOMODE) {
ICellularRadio::CODE res = g_apRadio->setRadioMode(radioModeEnum(g_sRadioMode));
printf("%s\n", code2str(res));
+ } 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();
@@ -586,6 +594,13 @@ void parseOptions(int argc, char** argv)
g_iOptions |= OPT_SET_RADIOMODE;
break;
+ case OPT_UNLOCK_SIM_CARD:
+ if(optarg != 0) {
+ g_sSimPin = optarg;
+ }
+ g_iOptions |= OPT_UNLOCK_SIM_CARD;
+ break;
+
default:
printf("OPTION: [%d] ABORTING!!\n", c);
abort();
@@ -635,6 +650,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");