James Tavares has uploaded this change for review. ( https://gerrit.osmocom.org/c/simtrace2/+/26863 )
Change subject: simtrace2-tool: add "modem sim-card (insert|remove)" command ......................................................................
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 --- M host/src/simtrace2-tool.c 1 file changed, 26 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/63/26863/1
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 @@ 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 @@ 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 @@ 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;
laforge has removed a vote from this change. ( https://gerrit.osmocom.org/c/simtrace2/+/26863 )
Change subject: simtrace2-tool: add "modem sim-card (insert|remove)" command ......................................................................
Removed Verified-1 by Jenkins Builder (1000002)
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/simtrace2/+/26863 )
Change subject: simtrace2-tool: add "modem sim-card (insert|remove)" command ......................................................................
Patch Set 1: Verified+1 Code-Review+2
laforge has submitted this change. ( https://gerrit.osmocom.org/c/simtrace2/+/26863 )
Change subject: simtrace2-tool: add "modem sim-card (insert|remove)" command ......................................................................
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 --- M host/src/simtrace2-tool.c 1 file changed, 26 insertions(+), 0 deletions(-)
Approvals: laforge: Looks good to me, approved; Verified
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 @@ 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 @@ 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 @@ 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;