From 9368d3f477c11865ec7e8f48f93e1bbde767e69a Mon Sep 17 00:00:00 2001 From: "rodion.shyshkin" Date: Wed, 31 Mar 2021 20:31:51 +0300 Subject: [GP-1111] mPower R. Apr 2021: +CEMODE shall be set to CEMODE=2 - libmts-io for $ Adding support for --set-ue-mode-of-operation command. --- main.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/main.cpp b/main.cpp index 3ec00db..c2324b7 100644 --- a/main.cpp +++ b/main.cpp @@ -71,6 +71,7 @@ Json::Value g_jData; std::string g_sSimPin; std::string g_sCellularMode; std::string g_sDeltaFwPath; +std::string g_sUEOperationMode; MTS::AutoPtr g_apRadio; @@ -110,6 +111,7 @@ const uint32_t OPT_CONFIG_FILE = 0x04000000; const uint32_t OPT_SET_CELLULAR_MODE = 0x08000000; const uint32_t OPT_UNLOCK_SIM_CARD = 0x20000000; const uint32_t OPT_RESET_RADIO = 0x40000000; +const uint32_t OPT_SET_UE_OPERATION_MODE = 0x80000000; int32_t g_iAuxOptions = 0; const uint32_t AOPT_OMA_DM_START = 0x00000001; @@ -125,6 +127,7 @@ void shutdown(); const char *code2str(MTS::IO::ICellularRadio::CODE code); std::string loadImeiFromDeviceInfo(); MTS::IO::ICellularRadio::CELLULAR_MODES cellularModeFlags(const std::string networks); +MTS::IO::ICellularRadio::UE_MODES_OF_OPERATION ueModesOfOperation(const std::string& mode); static int iOption = 0; @@ -164,6 +167,7 @@ static struct option long_options[] = { { "delta-fwu-upload", required_argument, 0, 'x' }, { "delta-fwu-apply", no_argument, 0, 'A' }, { "init-fumo-local", required_argument, 0, 'F' }, + { "set-ue-mode-of-operation",required_argument, 0, 'U' }, { 0, 0, 0, 0 } }; @@ -408,6 +412,14 @@ int main(int argc, char** argv) { result = g_apRadio->fumoLocalApply(cb); } else if (g_iAuxOptions & AOPT_FUMO_LOCAL) { result = handleFumoLocal(g_sDeltaFwPath); + } else if (g_iOptions & OPT_SET_UE_OPERATION_MODE) { + ICellularRadio::UE_MODES_OF_OPERATION mode = ueModesOfOperation(g_sUEOperationMode); + if (mode != ICellularRadio::UNKNOWN_MODE) { + result = g_apRadio->setUeModeOfOperation(mode); + printf("%s\n", code2str(result)); + } else { + printf("Invalid argument: %s\n", g_sUEOperationMode.c_str()); + } } shutdown(); @@ -648,6 +660,12 @@ void parseOptions(int argc, char** argv) g_iAuxOptions |= AOPT_FUMO_LOCAL; break; + case 'U': + if (optarg) + g_sUEOperationMode = optarg; + g_iOptions |= OPT_SET_UE_OPERATION_MODE; + break; + default: printf("OPTION: [%d] ABORTING!!\n", c); abort(); @@ -693,6 +711,7 @@ void printHelp(const std::string& sApp) { printf("\t--set-mip-mn-ha-ss : set MIP MN HA SS\n"); printf("\t--set-rx-diversity : set RX Diversity\n"); printf("\t--set-cellular-mode : set preferred networks eg. 2g,3g,4g\n"); + printf("\t--set-ue-mode-of-operation : set the UE mode of operation: ps_1, ps_2, csps_1, csps_2\n"); // 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"); @@ -752,6 +771,23 @@ MTS::IO::ICellularRadio::CELLULAR_MODES cellularModeFlags(const std::string netw return static_cast(result); } +MTS::IO::ICellularRadio::UE_MODES_OF_OPERATION ueModesOfOperation(const std::string& mode) { + using namespace MTS::IO; + int result; + if (mode == "ps_1") { + result = ICellularRadio::UE_MODES_OF_OPERATION::PS_MODE1; + } else if (mode == "ps_2") { + result = ICellularRadio::UE_MODES_OF_OPERATION::PS_MODE2; + } else if (mode == "csps_1") { + result = ICellularRadio::UE_MODES_OF_OPERATION::CS_PS_MODE1; + } else if (mode == "csps_2") { + result = ICellularRadio::UE_MODES_OF_OPERATION::CS_PS_MODE2; + } else { + result = ICellularRadio::UNKNOWN_MODE; + } + return static_cast(result); +} + MTS::IO::ICellularRadio::CODE handleDeltaFwUpload(const std::string& sPath) { int fd = open(sPath.c_str(), O_RDONLY); if (fd < 0) { -- cgit v1.2.3 From 0337cce1fb3c7554f1909d1d604941069ca66be6 Mon Sep 17 00:00:00 2001 From: "rodion.shyshkin" Date: Wed, 31 Mar 2021 22:56:48 +0300 Subject: [GP-1111] mPower R. Apr 2021: +CEMODE shall be set to CEMODE=2 - libmts-io for Telit Changes after a code review. --- main.cpp | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/main.cpp b/main.cpp index c2324b7..14b3c31 100644 --- a/main.cpp +++ b/main.cpp @@ -71,7 +71,7 @@ Json::Value g_jData; std::string g_sSimPin; std::string g_sCellularMode; std::string g_sDeltaFwPath; -std::string g_sUEOperationMode; +std::string g_sUeModeOfOperation; MTS::AutoPtr g_apRadio; @@ -111,13 +111,13 @@ const uint32_t OPT_CONFIG_FILE = 0x04000000; const uint32_t OPT_SET_CELLULAR_MODE = 0x08000000; const uint32_t OPT_UNLOCK_SIM_CARD = 0x20000000; const uint32_t OPT_RESET_RADIO = 0x40000000; -const uint32_t OPT_SET_UE_OPERATION_MODE = 0x80000000; int32_t g_iAuxOptions = 0; const uint32_t AOPT_OMA_DM_START = 0x00000001; const uint32_t AOPT_DFU_UPLOAD = 0x00000002; const uint32_t AOPT_DFU_APPLY = 0x00000004; const uint32_t AOPT_FUMO_LOCAL = 0x00000008; +const uint32_t AOPT_SET_UE_MODE_OF_OPERATION = 0x00000010; void handle_sigterm(int signum); void printHelp(const std::string& sApp); @@ -127,7 +127,6 @@ void shutdown(); const char *code2str(MTS::IO::ICellularRadio::CODE code); std::string loadImeiFromDeviceInfo(); MTS::IO::ICellularRadio::CELLULAR_MODES cellularModeFlags(const std::string networks); -MTS::IO::ICellularRadio::UE_MODES_OF_OPERATION ueModesOfOperation(const std::string& mode); static int iOption = 0; @@ -412,13 +411,14 @@ int main(int argc, char** argv) { result = g_apRadio->fumoLocalApply(cb); } else if (g_iAuxOptions & AOPT_FUMO_LOCAL) { result = handleFumoLocal(g_sDeltaFwPath); - } else if (g_iOptions & OPT_SET_UE_OPERATION_MODE) { - ICellularRadio::UE_MODES_OF_OPERATION mode = ueModesOfOperation(g_sUEOperationMode); - if (mode != ICellularRadio::UNKNOWN_MODE) { + } else if (g_iAuxOptions & AOPT_SET_UE_MODE_OF_OPERATION) { + ICellularRadio::UE_MODES_OF_OPERATION mode; + result = ICellularRadio::convertStringToUeMode(g_sUeModeOfOperation, mode); + if (result == ICellularRadio::CODE::SUCCESS) { result = g_apRadio->setUeModeOfOperation(mode); printf("%s\n", code2str(result)); } else { - printf("Invalid argument: %s\n", g_sUEOperationMode.c_str()); + printf("Invalid argument: %s\n", g_sUeModeOfOperation.c_str()); } } @@ -662,8 +662,8 @@ void parseOptions(int argc, char** argv) case 'U': if (optarg) - g_sUEOperationMode = optarg; - g_iOptions |= OPT_SET_UE_OPERATION_MODE; + g_sUeModeOfOperation = optarg; + g_iAuxOptions |= AOPT_SET_UE_MODE_OF_OPERATION; break; default: @@ -771,23 +771,6 @@ MTS::IO::ICellularRadio::CELLULAR_MODES cellularModeFlags(const std::string netw return static_cast(result); } -MTS::IO::ICellularRadio::UE_MODES_OF_OPERATION ueModesOfOperation(const std::string& mode) { - using namespace MTS::IO; - int result; - if (mode == "ps_1") { - result = ICellularRadio::UE_MODES_OF_OPERATION::PS_MODE1; - } else if (mode == "ps_2") { - result = ICellularRadio::UE_MODES_OF_OPERATION::PS_MODE2; - } else if (mode == "csps_1") { - result = ICellularRadio::UE_MODES_OF_OPERATION::CS_PS_MODE1; - } else if (mode == "csps_2") { - result = ICellularRadio::UE_MODES_OF_OPERATION::CS_PS_MODE2; - } else { - result = ICellularRadio::UNKNOWN_MODE; - } - return static_cast(result); -} - MTS::IO::ICellularRadio::CODE handleDeltaFwUpload(const std::string& sPath) { int fd = open(sPath.c_str(), O_RDONLY); if (fd < 0) { -- cgit v1.2.3