From 10739600b73244cdf42918d9f3fb11c09d317100 Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Fri, 16 Dec 2022 17:04:35 +0200 Subject: [GP-1195] Cellular debugging - add a query Add the `radio-query --diagnostics` query. This query executes a radio-specific set of diagnostics AT commands and returns raw output from the radio. --- main.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/main.cpp b/main.cpp index 8a763cf..8f5fd98 100644 --- a/main.cpp +++ b/main.cpp @@ -103,6 +103,7 @@ const uint32_t OPT_SELECTED_BANDS_RAW = 0x20000000; int32_t g_iAuxOptions = 0; const uint32_t AOPT_VOICE_SUPPORT = 0x00000001; const uint32_t AOPT_PDP_CONF_STATIC = 0x00000002; +const uint32_t AOPT_DIAGNOSTICS = 0x00000004; void handle_sigterm(int signum); void printHelp(const std::string& sApp); @@ -392,6 +393,14 @@ int main(int argc, char** argv) { } } } + } else if (g_iAuxOptions & AOPT_DIAGNOSTICS) { + std::string sValue; + result = g_apRadio->getDiagnostics(sValue); + + // Print the results even if the radio has stopped responding at some point. + if (result == ICellularRadio::SUCCESS || result == ICellularRadio::NO_RESPONSE) { + printf("%s", sValue.c_str()); + } } if (g_bIstty && result == ICellularRadio::CODE::SUCCESS) @@ -688,6 +697,7 @@ void parseOptions(int argc, char** argv) { { "selected-bands-raw", no_argument, &iOption, OPT_SELECTED_BANDS_RAW }, { "pdp-conf-static", no_argument, &iAuxOption, AOPT_PDP_CONF_STATIC }, { "ctx-id", required_argument, 0, 'C' }, + { "diagnostics", no_argument, &iAuxOption, AOPT_DIAGNOSTICS }, { 0, 0, 0, 0 } }; /* getopt_long stores the option index here. */ @@ -810,6 +820,7 @@ void printHelp(const std::string& sApp) { printf("\t--voice-support\n"); printf("\t--selected-bands-raw\n"); printf("\t--pdp-conf-static --ctx-id \n"); + printf("\t--diagnostics\n"); // Applicable for LTE910-NA1 dual FW images only // printf("\t--active-firmware\n"); printf("\n"); -- cgit v1.2.3