mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-16 21:28:33 +03:00
WIP: generic board-info
Change-Id: I0642269c924a0abe464a64c004681f507f14bc92
This commit is contained in:
@@ -44,6 +44,7 @@ struct osmo_st2_cardem_inst {
|
|||||||
int osmo_st2_slot_tx_msg(struct osmo_st2_slot *slot, struct msgb *msg,
|
int osmo_st2_slot_tx_msg(struct osmo_st2_slot *slot, struct msgb *msg,
|
||||||
uint8_t msg_class, uint8_t msg_type);
|
uint8_t msg_class, uint8_t msg_type);
|
||||||
|
|
||||||
|
int osmo_st2_generic_request_board_info(struct osmo_st2_slot *slot);
|
||||||
|
|
||||||
int osmo_st2_cardem_request_card_insert(struct osmo_st2_cardem_inst *ci, bool inserted);
|
int osmo_st2_cardem_request_card_insert(struct osmo_st2_cardem_inst *ci, bool inserted);
|
||||||
int osmo_st2_cardem_request_pb_and_rx(struct osmo_st2_cardem_inst *ci, uint8_t pb, uint8_t le);
|
int osmo_st2_cardem_request_pb_and_rx(struct osmo_st2_cardem_inst *ci, uint8_t pb, uint8_t le);
|
||||||
|
|||||||
@@ -154,6 +154,19 @@ int osmo_st2_slot_tx_msg(struct osmo_st2_slot *slot, struct msgb *msg,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* Generic protocol
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
/*! \brief Requeset the SIMtrace2 board information structure from the device */
|
||||||
|
int osmo_st2_generic_request_board_info(struct osmo_st2_slot *slot)
|
||||||
|
{
|
||||||
|
struct msgb *msg = st_msgb_alloc();
|
||||||
|
|
||||||
|
return osmo_st2_slot_tx_msg(0, msg, SIMTRACE_MSGC_GENERIC, SIMTRACE_CMD_BD_BOARD_INFO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Card Emulation protocol
|
* Card Emulation protocol
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ static void print_help(void)
|
|||||||
"\n"
|
"\n"
|
||||||
);
|
);
|
||||||
printf( "Commands:\n"
|
printf( "Commands:\n"
|
||||||
|
"\tgeneric board-info\n"
|
||||||
"\tmodem reset (enable|disable|cycle)\n"
|
"\tmodem reset (enable|disable|cycle)\n"
|
||||||
"\tmodem sim-switch (local|remote)\n"
|
"\tmodem sim-switch (local|remote)\n"
|
||||||
"\tmodem sim-card (insert|remove)\n"
|
"\tmodem sim-card (insert|remove)\n"
|
||||||
@@ -216,6 +217,33 @@ static int do_subsys_modem(int argc, char **argv)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int do_generic_board_info(int argc, char **argv)
|
||||||
|
{
|
||||||
|
return osmo_st2_generic_request_board_info(ci->slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int do_subsys_generic(int argc, char **argv)
|
||||||
|
{
|
||||||
|
char *command;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
if (argc < 1)
|
||||||
|
return -EINVAL;
|
||||||
|
command = argv[0];
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
|
||||||
|
if (!strcmp(command, "board-info")) {
|
||||||
|
rc = do_generic_board_info(argc, argv);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "Unsupported command for subsystem generic: '%s'\n", command);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
static int do_command(int argc, char **argv)
|
static int do_command(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *subsys;
|
char *subsys;
|
||||||
@@ -227,7 +255,9 @@ static int do_command(int argc, char **argv)
|
|||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
|
|
||||||
if (!strcmp(subsys, "modem"))
|
if (!strcmp(subsys, "generic")) {
|
||||||
|
rc= do_subsys_generic(argc, argv);
|
||||||
|
} else if (!strcmp(subsys, "modem"))
|
||||||
rc = do_subsys_modem(argc, argv);
|
rc = do_subsys_modem(argc, argv);
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "Unsupported subsystem '%s'\n", subsys);
|
fprintf(stderr, "Unsupported subsystem '%s'\n", subsys);
|
||||||
|
|||||||
Reference in New Issue
Block a user