mirror of https://gerrit.osmocom.org/simtrace2
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
This commit is contained in:
parent
7fde63b7c6
commit
aeaf12853e
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue