laforge submitted this change.

View Change

Approvals: laforge: Looks good to me, approved; Verified
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(-)

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;

To view, visit change 26863. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I8c79eb29379a789d9d0d21495e30d66ddbdfb022
Gerrit-Change-Number: 26863
Gerrit-PatchSet: 1
Gerrit-Owner: James Tavares <jtavares@kvh.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-MessageType: merged