diff options
author | James Tavares <jtavares@kvh.com> | 2022-01-10 18:06:45 -0500 |
---|---|---|
committer | James Tavares <jtavares@kvh.com> | 2022-01-10 18:06:45 -0500 |
commit | aeaf12853e98181048cf5900a8a17eaac7a2bb0f (patch) | |
tree | c593c26c3dbace1517020b6d200d0e45325f698c | |
parent | 7fde63b7c64d48fa8a046de8033dd2ad138332f1 (diff) |
simtrace2-tool: add "modem sim-card (insert|remove)" command
Add a new command to request that the simtrace2 firmware manipulate the
card detect signal, causing the downstream cellular modem to believe
that the SIM card has been inserted or removed, respectfully.
Change-Id: I8c79eb29379a789d9d0d21495e30d66ddbdfb022
-rw-r--r-- | host/src/simtrace2-tool.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/host/src/simtrace2-tool.c b/host/src/simtrace2-tool.c index d92638f..eb61ee2 100644 --- a/host/src/simtrace2-tool.c +++ b/host/src/simtrace2-tool.c @@ -65,6 +65,7 @@ static void print_help(void) printf( "Commands:\n" "\tmodem reset (enable|disable|cycle)\n" "\tmodem sim-switch (local|remote)\n" + "\tmodem sim-card (insert|remove)\n" "\n"); } @@ -167,6 +168,29 @@ static int do_modem_sim_switch(int argc, char **argv) return 0; } +/* emulate SIM card insertion / removal from modem */ +static int do_modem_sim_card(int argc, char **argv) +{ + char *command; + if (argc < 1) + return -EINVAL; + command = argv[0]; + argc--; + argv++; + + if (!strcmp(command, "insert")) { + printf("Setting SIM=INSERTED; Modem reset recommended\n"); + return osmo_st2_cardem_request_card_insert(ci, 1); + } else if (!strcmp(command, "remove")) { + printf("Setting SIM=REMOVED; Modem reset recommended\n"); + return osmo_st2_cardem_request_card_insert(ci, 0); + } else { + fprintf(stderr, "Unsupported modem sim-card command: '%s'\n", command); + return -EINVAL; + } + return 0; +} + static int do_subsys_modem(int argc, char **argv) { char *command; @@ -182,6 +206,8 @@ static int do_subsys_modem(int argc, char **argv) rc = do_modem_reset(argc, argv); } else if (!strcmp(command, "sim-switch")) { rc = do_modem_sim_switch(argc, argv); + } else if (!strcmp(command, "sim-card")) { + rc = do_modem_sim_card(argc, argv); } else { fprintf(stderr, "Unsupported command for subsystem modem: '%s'\n", command); return -EINVAL; |