mirror of https://gerrit.osmocom.org/simtrace2
use osmo_st2_ or osmo_ prefix for [shared] library symbols
Change-Id: Ie2686b30717b9541b1217802ca967cd0a4cbde9b
This commit is contained in:
parent
964cda309d
commit
208890ad6e
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <osmocom/sim/sim.h>
|
||||
|
||||
struct apdu_context {
|
||||
struct osmo_apdu_context {
|
||||
struct osim_apdu_cmd_hdr hdr;
|
||||
uint8_t dc[256];
|
||||
uint8_t de[256];
|
||||
|
@ -39,11 +39,11 @@ struct apdu_context {
|
|||
} le;
|
||||
};
|
||||
|
||||
enum apdu_action {
|
||||
enum osmo_apdu_action {
|
||||
APDU_ACT_TX_CAPDU_TO_CARD = 0x0001,
|
||||
APDU_ACT_RX_MORE_CAPDU_FROM_READER = 0x0002,
|
||||
};
|
||||
|
||||
|
||||
int apdu_segment_in(struct apdu_context *ac, const uint8_t *apdu_buf,
|
||||
unsigned int apdu_len, bool new_apdu);
|
||||
int osmo_apdu_segment_in(struct osmo_apdu_context *ac, const uint8_t *apdu_buf,
|
||||
unsigned int apdu_len, bool new_apdu);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <osmocom/sim/sim.h>
|
||||
|
||||
/* transport to a SIMtrace device */
|
||||
struct st_transport {
|
||||
struct osmo_st2_transport {
|
||||
/* USB */
|
||||
struct libusb_device_handle *usb_devh;
|
||||
struct {
|
||||
|
@ -18,35 +18,41 @@ struct st_transport {
|
|||
};
|
||||
|
||||
/* a SIMtrace slot; communicates over a transport */
|
||||
struct st_slot {
|
||||
struct osmo_st2_slot {
|
||||
/* transport through which the slot can be reached */
|
||||
struct st_transport *transp;
|
||||
struct osmo_st2_transport *transp;
|
||||
/* number of the slot within the transport */
|
||||
uint8_t slot_nr;
|
||||
};
|
||||
|
||||
/* One istance of card emulation */
|
||||
struct cardem_inst {
|
||||
struct osmo_st2_cardem_inst {
|
||||
/* slot on which this card emulation instance runs */
|
||||
struct st_slot *slot;
|
||||
struct osmo_st2_slot *slot;
|
||||
/* libosmosim SIM card profile */
|
||||
const struct osim_cla_ins_card_profile *card_prof;
|
||||
/* libosmosim SIM card channel */
|
||||
struct osim_chan_hdl *chan;
|
||||
};
|
||||
|
||||
int osmo_st2_transp_tx_msg(struct osmo_st2_transport *transp, struct msgb *msg);
|
||||
|
||||
int cardem_request_card_insert(struct cardem_inst *ci, bool inserted);
|
||||
int cardem_request_pb_and_rx(struct cardem_inst *ci, uint8_t pb, uint8_t le);
|
||||
int cardem_request_pb_and_tx(struct cardem_inst *ci, uint8_t pb,
|
||||
const uint8_t *data, uint16_t data_len_in);
|
||||
int cardem_request_sw_tx(struct cardem_inst *ci, const uint8_t *sw);
|
||||
int cardem_request_set_atr(struct cardem_inst *ci, const uint8_t *atr, unsigned int atr_len);
|
||||
int osmo_st2_slot_tx_msg(struct osmo_st2_slot *slot, struct msgb *msg,
|
||||
uint8_t msg_class, uint8_t msg_type);
|
||||
|
||||
|
||||
int st_modem_reset_pulse(struct st_slot *slot, uint16_t duration_ms);
|
||||
int st_modem_reset_active(struct st_slot *slot);
|
||||
int st_modem_reset_inactive(struct st_slot *slot);
|
||||
int st_modem_sim_select_local(struct st_slot *slot);
|
||||
int st_modem_sim_select_remote(struct st_slot *slot);
|
||||
int st_modem_get_status(struct st_slot *slot);
|
||||
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_tx(struct osmo_st2_cardem_inst *ci, uint8_t pb,
|
||||
const uint8_t *data, uint16_t data_len_in);
|
||||
int osmo_st2_cardem_request_sw_tx(struct osmo_st2_cardem_inst *ci, const uint8_t *sw);
|
||||
int osmo_st2_cardem_request_set_atr(struct osmo_st2_cardem_inst *ci, const uint8_t *atr,
|
||||
unsigned int atr_len);
|
||||
|
||||
|
||||
int osmo_st2_modem_reset_pulse(struct osmo_st2_slot *slot, uint16_t duration_ms);
|
||||
int osmo_st2_modem_reset_active(struct osmo_st2_slot *slot);
|
||||
int osmo_st2_modem_reset_inactive(struct osmo_st2_slot *slot);
|
||||
int osmo_st2_modem_sim_select_local(struct osmo_st2_slot *slot);
|
||||
int osmo_st2_modem_sim_select_remote(struct osmo_st2_slot *slot);
|
||||
int osmo_st2_modem_get_status(struct osmo_st2_slot *slot);
|
||||
|
|
|
@ -30,13 +30,13 @@
|
|||
#include <osmocom/simtrace2/apdu_dispatch.h>
|
||||
|
||||
/*! \brief Has the command-data phase been completed yet? */
|
||||
static inline bool is_dc_complete(struct apdu_context *ac)
|
||||
static inline bool is_dc_complete(struct osmo_apdu_context *ac)
|
||||
{
|
||||
return (ac->lc.tot == ac->lc.cur);
|
||||
}
|
||||
|
||||
/*! \brief Has the expected-data phase been completed yet? */
|
||||
static inline bool is_de_complete(struct apdu_context *ac)
|
||||
static inline bool is_de_complete(struct osmo_apdu_context *ac)
|
||||
{
|
||||
return (ac->le.tot == ac->le.cur);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ static const char *dump_apdu_hdr(const struct osim_apdu_cmd_hdr *h)
|
|||
return buf;
|
||||
}
|
||||
|
||||
static void dump_apdu_ctx(const struct apdu_context *ac)
|
||||
static void dump_apdu_ctx(const struct osmo_apdu_context *ac)
|
||||
{
|
||||
printf("%s; case=%d, lc=%d(%d), le=%d(%d)\n",
|
||||
dump_apdu_hdr(&ac->hdr), ac->apdu_case,
|
||||
|
@ -71,8 +71,8 @@ static void dump_apdu_ctx(const struct apdu_context *ac)
|
|||
* The function retunrs APDU_ACT_RX_MORE_CAPDU_FROM_READER when there
|
||||
* is more data to be received from the card reader (GSM Phone).
|
||||
*/
|
||||
int apdu_segment_in(struct apdu_context *ac, const uint8_t *apdu_buf,
|
||||
unsigned int apdu_len, bool new_apdu)
|
||||
int osmo_apdu_segment_in(struct osmo_apdu_context *ac, const uint8_t *apdu_buf,
|
||||
unsigned int apdu_len, bool new_apdu)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
|
|
|
@ -8,9 +8,10 @@
|
|||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* global GSMTAP instance */
|
||||
/*! global GSMTAP instance */
|
||||
static struct gsmtap_inst *g_gti;
|
||||
|
||||
/*! initialize the global GSMTAP instance for SIM traces */
|
||||
int osmo_st2_gsmtap_init(const char *gsmtap_host)
|
||||
{
|
||||
if (g_gti)
|
||||
|
@ -26,6 +27,11 @@ int osmo_st2_gsmtap_init(const char *gsmtap_host)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*! log one APDU via the global GSMTAP instance.
|
||||
* \param[in] sub_type GSMTAP sub-type (GSMTAP_SIM_* constant)
|
||||
* \param[in] apdu User-provided buffer with APDU to log
|
||||
* \param[in] len Length of apdu in bytes
|
||||
*/
|
||||
int osmo_st2_gsmtap_send_apdu(uint8_t sub_type, const uint8_t *apdu, unsigned int len)
|
||||
{
|
||||
struct gsmtap_hdr *gh;
|
||||
|
|
|
@ -69,7 +69,7 @@ static void apdu_out_cb(uint8_t *buf, unsigned int len, void *user_data)
|
|||
#endif
|
||||
|
||||
/*! \brief Transmit a given command to the SIMtrace2 device */
|
||||
int st_transp_tx_msg(struct st_transport *transp, struct msgb *msg)
|
||||
int osmo_st2_transp_tx_msg(struct osmo_st2_transport *transp, struct msgb *msg)
|
||||
{
|
||||
int rc;
|
||||
|
||||
|
@ -106,12 +106,12 @@ static struct simtrace_msg_hdr *st_push_hdr(struct msgb *msg, uint8_t msg_class,
|
|||
|
||||
/* transmit a given message to a specified slot. Expects all headers
|
||||
* present before calling the function */
|
||||
int st_slot_tx_msg(struct st_slot *slot, struct msgb *msg,
|
||||
uint8_t msg_class, uint8_t msg_type)
|
||||
int osmo_st2_slot_tx_msg(struct osmo_st2_slot *slot, struct msgb *msg,
|
||||
uint8_t msg_class, uint8_t msg_type)
|
||||
{
|
||||
st_push_hdr(msg, msg_class, msg_type, slot->slot_nr);
|
||||
|
||||
return st_transp_tx_msg(slot->transp, msg);
|
||||
return osmo_st2_transp_tx_msg(slot->transp, msg);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -120,7 +120,7 @@ int st_slot_tx_msg(struct st_slot *slot, struct msgb *msg,
|
|||
|
||||
|
||||
/*! \brief Request the SIMtrace2 to generate a card-insert signal */
|
||||
int cardem_request_card_insert(struct cardem_inst *ci, bool inserted)
|
||||
int osmo_st2_cardem_request_card_insert(struct osmo_st2_cardem_inst *ci, bool inserted)
|
||||
{
|
||||
struct msgb *msg = st_msgb_alloc();
|
||||
struct cardemu_usb_msg_cardinsert *cins;
|
||||
|
@ -130,11 +130,11 @@ int cardem_request_card_insert(struct cardem_inst *ci, bool inserted)
|
|||
if (inserted)
|
||||
cins->card_insert = 1;
|
||||
|
||||
return st_slot_tx_msg(ci->slot, msg, SIMTRACE_MSGC_CARDEM, SIMTRACE_MSGT_DT_CEMU_CARDINSERT);
|
||||
return osmo_st2_slot_tx_msg(ci->slot, msg, SIMTRACE_MSGC_CARDEM, SIMTRACE_MSGT_DT_CEMU_CARDINSERT);
|
||||
}
|
||||
|
||||
/*! \brief Request the SIMtrace2 to transmit a Procedure Byte, then Rx */
|
||||
int cardem_request_pb_and_rx(struct 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)
|
||||
{
|
||||
struct msgb *msg = st_msgb_alloc();
|
||||
struct cardemu_usb_msg_tx_data *txd;
|
||||
|
@ -148,12 +148,12 @@ int cardem_request_pb_and_rx(struct cardem_inst *ci, uint8_t pb, uint8_t le)
|
|||
/* one data byte */
|
||||
msgb_put_u8(msg, pb);
|
||||
|
||||
return st_slot_tx_msg(ci->slot, msg, SIMTRACE_MSGC_CARDEM, SIMTRACE_MSGT_DT_CEMU_TX_DATA);
|
||||
return osmo_st2_slot_tx_msg(ci->slot, msg, SIMTRACE_MSGC_CARDEM, SIMTRACE_MSGT_DT_CEMU_TX_DATA);
|
||||
}
|
||||
|
||||
/*! \brief Request the SIMtrace2 to transmit a Procedure Byte, then Tx */
|
||||
int cardem_request_pb_and_tx(struct cardem_inst *ci, uint8_t pb,
|
||||
const uint8_t *data, uint16_t data_len_in)
|
||||
int osmo_st2_cardem_request_pb_and_tx(struct osmo_st2_cardem_inst *ci, uint8_t pb,
|
||||
const uint8_t *data, uint16_t data_len_in)
|
||||
{
|
||||
struct msgb *msg = st_msgb_alloc();
|
||||
struct cardemu_usb_msg_tx_data *txd;
|
||||
|
@ -173,11 +173,11 @@ int cardem_request_pb_and_tx(struct cardem_inst *ci, uint8_t pb,
|
|||
cur = msgb_put(msg, data_len_in);
|
||||
memcpy(cur, data, data_len_in);
|
||||
|
||||
return st_slot_tx_msg(ci->slot, msg, SIMTRACE_MSGC_CARDEM, SIMTRACE_MSGT_DT_CEMU_TX_DATA);
|
||||
return osmo_st2_slot_tx_msg(ci->slot, msg, SIMTRACE_MSGC_CARDEM, SIMTRACE_MSGT_DT_CEMU_TX_DATA);
|
||||
}
|
||||
|
||||
/*! \brief Request the SIMtrace2 to send a Status Word */
|
||||
int cardem_request_sw_tx(struct cardem_inst *ci, const uint8_t *sw)
|
||||
int osmo_st2_cardem_request_sw_tx(struct osmo_st2_cardem_inst *ci, const uint8_t *sw)
|
||||
{
|
||||
struct msgb *msg = st_msgb_alloc();
|
||||
struct cardemu_usb_msg_tx_data *txd;
|
||||
|
@ -194,10 +194,10 @@ int cardem_request_sw_tx(struct cardem_inst *ci, const uint8_t *sw)
|
|||
cur[0] = sw[0];
|
||||
cur[1] = sw[1];
|
||||
|
||||
return st_slot_tx_msg(ci->slot, msg, SIMTRACE_MSGC_CARDEM, SIMTRACE_MSGT_DT_CEMU_TX_DATA);
|
||||
return osmo_st2_slot_tx_msg(ci->slot, msg, SIMTRACE_MSGC_CARDEM, SIMTRACE_MSGT_DT_CEMU_TX_DATA);
|
||||
}
|
||||
|
||||
int cardem_request_set_atr(struct cardem_inst *ci, const uint8_t *atr, unsigned int atr_len)
|
||||
int osmo_st2_cardem_request_set_atr(struct osmo_st2_cardem_inst *ci, const uint8_t *atr, unsigned int atr_len)
|
||||
{
|
||||
struct msgb *msg = st_msgb_alloc();
|
||||
struct cardemu_usb_msg_set_atr *satr;
|
||||
|
@ -212,14 +212,14 @@ int cardem_request_set_atr(struct cardem_inst *ci, const uint8_t *atr, unsigned
|
|||
cur = msgb_put(msg, atr_len);
|
||||
memcpy(cur, atr, atr_len);
|
||||
|
||||
return st_slot_tx_msg(ci->slot, msg, SIMTRACE_MSGC_CARDEM, SIMTRACE_MSGT_DT_CEMU_SET_ATR);
|
||||
return osmo_st2_slot_tx_msg(ci->slot, msg, SIMTRACE_MSGC_CARDEM, SIMTRACE_MSGT_DT_CEMU_SET_ATR);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* Modem Control protocol
|
||||
***********************************************************************/
|
||||
|
||||
static int _modem_reset(struct st_slot *slot, uint8_t asserted, uint16_t pulse_ms)
|
||||
static int _modem_reset(struct osmo_st2_slot *slot, uint8_t asserted, uint16_t pulse_ms)
|
||||
{
|
||||
struct msgb *msg = st_msgb_alloc();
|
||||
struct st_modem_reset *sr ;
|
||||
|
@ -228,28 +228,28 @@ static int _modem_reset(struct st_slot *slot, uint8_t asserted, uint16_t pulse_m
|
|||
sr->asserted = asserted;
|
||||
sr->pulse_duration_msec = pulse_ms;
|
||||
|
||||
return st_slot_tx_msg(slot, msg, SIMTRACE_MSGC_MODEM, SIMTRACE_MSGT_DT_MODEM_RESET);
|
||||
return osmo_st2_slot_tx_msg(slot, msg, SIMTRACE_MSGC_MODEM, SIMTRACE_MSGT_DT_MODEM_RESET);
|
||||
}
|
||||
|
||||
/*! \brief pulse the RESET line of the modem for \a duration_ms milli-seconds*/
|
||||
int st_modem_reset_pulse(struct st_slot *slot, uint16_t duration_ms)
|
||||
int osmo_st2_modem_reset_pulse(struct osmo_st2_slot *slot, uint16_t duration_ms)
|
||||
{
|
||||
return _modem_reset(slot, 2, duration_ms);
|
||||
}
|
||||
|
||||
/*! \brief assert the RESET line of the modem */
|
||||
int st_modem_reset_active(struct st_slot *slot)
|
||||
int osmo_st2_modem_reset_active(struct osmo_st2_slot *slot)
|
||||
{
|
||||
return _modem_reset(slot, 1, 0);
|
||||
}
|
||||
|
||||
/*! \brief de-assert the RESET line of the modem */
|
||||
int st_modem_reset_inactive(struct st_slot *slot)
|
||||
int osmo_st2_modem_reset_inactive(struct osmo_st2_slot *slot)
|
||||
{
|
||||
return _modem_reset(slot, 0, 0);
|
||||
}
|
||||
|
||||
static int _modem_sim_select(struct st_slot *slot, uint8_t remote_sim)
|
||||
static int _modem_sim_select(struct osmo_st2_slot *slot, uint8_t remote_sim)
|
||||
{
|
||||
struct msgb *msg = st_msgb_alloc();
|
||||
struct st_modem_sim_select *ss;
|
||||
|
@ -257,25 +257,25 @@ static int _modem_sim_select(struct st_slot *slot, uint8_t remote_sim)
|
|||
ss = (struct st_modem_sim_select *) msgb_put(msg, sizeof(*ss));
|
||||
ss->remote_sim = remote_sim;
|
||||
|
||||
return st_slot_tx_msg(slot, msg, SIMTRACE_MSGC_MODEM, SIMTRACE_MSGT_DT_MODEM_SIM_SELECT);
|
||||
return osmo_st2_slot_tx_msg(slot, msg, SIMTRACE_MSGC_MODEM, SIMTRACE_MSGT_DT_MODEM_SIM_SELECT);
|
||||
}
|
||||
|
||||
/*! \brief select local (physical) SIM for given slot */
|
||||
int st_modem_sim_select_local(struct st_slot *slot)
|
||||
int osmo_st2_modem_sim_select_local(struct osmo_st2_slot *slot)
|
||||
{
|
||||
return _modem_sim_select(slot, 0);
|
||||
}
|
||||
|
||||
/*! \brief select remote (emulated/forwarded) SIM for given slot */
|
||||
int st_modem_sim_select_remote(struct st_slot *slot)
|
||||
int osmo_st2_modem_sim_select_remote(struct osmo_st2_slot *slot)
|
||||
{
|
||||
return _modem_sim_select(slot, 1);
|
||||
}
|
||||
|
||||
/*! \brief Request slot to send us status information about the modem */
|
||||
int st_modem_get_status(struct st_slot *slot)
|
||||
int osmo_st2_modem_get_status(struct osmo_st2_slot *slot)
|
||||
{
|
||||
struct msgb *msg = st_msgb_alloc();
|
||||
|
||||
return st_slot_tx_msg(slot, msg, SIMTRACE_MSGC_MODEM, SIMTRACE_MSGT_BD_MODEM_STATUS);
|
||||
return osmo_st2_slot_tx_msg(slot, msg, SIMTRACE_MSGC_MODEM, SIMTRACE_MSGT_BD_MODEM_STATUS);
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ static void atr_update_csum(uint8_t *atr, unsigned int atr_len)
|
|||
***********************************************************************/
|
||||
|
||||
/*! \brief Process a STATUS message from the SIMtrace2 */
|
||||
static int process_do_status(struct cardem_inst *ci, uint8_t *buf, int len)
|
||||
static int process_do_status(struct osmo_st2_cardem_inst *ci, uint8_t *buf, int len)
|
||||
{
|
||||
struct cardemu_usb_msg_status *status;
|
||||
status = (struct cardemu_usb_msg_status *) buf;
|
||||
|
@ -81,7 +81,7 @@ static int process_do_status(struct cardem_inst *ci, uint8_t *buf, int len)
|
|||
}
|
||||
|
||||
/*! \brief Process a PTS indication message from the SIMtrace2 */
|
||||
static int process_do_pts(struct cardem_inst *ci, uint8_t *buf, int len)
|
||||
static int process_do_pts(struct osmo_st2_cardem_inst *ci, uint8_t *buf, int len)
|
||||
{
|
||||
struct cardemu_usb_msg_pts_info *pts;
|
||||
pts = (struct cardemu_usb_msg_pts_info *) buf;
|
||||
|
@ -92,9 +92,9 @@ static int process_do_pts(struct cardem_inst *ci, uint8_t *buf, int len)
|
|||
}
|
||||
|
||||
/*! \brief Process a RX-DATA indication message from the SIMtrace2 */
|
||||
static int process_do_rx_da(struct cardem_inst *ci, uint8_t *buf, int len)
|
||||
static int process_do_rx_da(struct osmo_st2_cardem_inst *ci, uint8_t *buf, int len)
|
||||
{
|
||||
static struct apdu_context ac;
|
||||
static struct osmo_apdu_context ac;
|
||||
struct cardemu_usb_msg_rx_data *data;
|
||||
int rc;
|
||||
|
||||
|
@ -103,8 +103,8 @@ static int process_do_rx_da(struct cardem_inst *ci, uint8_t *buf, int len)
|
|||
printf("=> DATA: flags=%x, %s: ", data->flags,
|
||||
osmo_hexdump(data->data, data->data_len));
|
||||
|
||||
rc = apdu_segment_in(&ac, data->data, data->data_len,
|
||||
data->flags & CEMU_DATA_F_TPDU_HDR);
|
||||
rc = osmo_apdu_segment_in(&ac, data->data, data->data_len,
|
||||
data->flags & CEMU_DATA_F_TPDU_HDR);
|
||||
|
||||
if (rc & APDU_ACT_TX_CAPDU_TO_CARD) {
|
||||
struct msgb *tmsg = msgb_alloc(1024, "TPDU");
|
||||
|
@ -132,16 +132,16 @@ static int process_do_rx_da(struct cardem_inst *ci, uint8_t *buf, int len)
|
|||
ac.sw[1] = msgb_apdu_sw(tmsg) & 0xff;
|
||||
printf("SW=0x%04x, len_rx=%d\n", msgb_apdu_sw(tmsg), msgb_l3len(tmsg));
|
||||
if (msgb_l3len(tmsg))
|
||||
cardem_request_pb_and_tx(ci, ac.hdr.ins, tmsg->l3h, msgb_l3len(tmsg));
|
||||
cardem_request_sw_tx(ci, ac.sw);
|
||||
osmo_st2_cardem_request_pb_and_tx(ci, ac.hdr.ins, tmsg->l3h, msgb_l3len(tmsg));
|
||||
osmo_st2_cardem_request_sw_tx(ci, ac.sw);
|
||||
} else if (ac.lc.tot > ac.lc.cur) {
|
||||
cardem_request_pb_and_rx(ci, ac.hdr.ins, ac.lc.tot - ac.lc.cur);
|
||||
osmo_st2_cardem_request_pb_and_rx(ci, ac.hdr.ins, ac.lc.tot - ac.lc.cur);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*! \brief Process an incoming message from the SIMtrace2 */
|
||||
static int process_usb_msg(struct cardem_inst *ci, uint8_t *buf, int len)
|
||||
static int process_usb_msg(struct osmo_st2_cardem_inst *ci, uint8_t *buf, int len)
|
||||
{
|
||||
struct simtrace_msg_hdr *sh = (struct simtrace_msg_hdr *)buf;
|
||||
int rc;
|
||||
|
@ -212,9 +212,9 @@ static const struct option opts[] = {
|
|||
{ NULL, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static void run_mainloop(struct cardem_inst *ci)
|
||||
static void run_mainloop(struct osmo_st2_cardem_inst *ci)
|
||||
{
|
||||
struct st_transport *transp = ci->slot->transp;
|
||||
struct osmo_st2_transport *transp = ci->slot->transp;
|
||||
unsigned int msg_count, byte_count = 0;
|
||||
uint8_t buf[16*265];
|
||||
int xfer_len;
|
||||
|
@ -251,24 +251,24 @@ static void run_mainloop(struct cardem_inst *ci)
|
|||
}
|
||||
}
|
||||
|
||||
static struct st_transport _transp;
|
||||
static struct osmo_st2_transport _transp;
|
||||
|
||||
static struct st_slot _slot = {
|
||||
static struct osmo_st2_slot _slot = {
|
||||
.transp = &_transp,
|
||||
.slot_nr = 0,
|
||||
};
|
||||
|
||||
struct cardem_inst _ci = {
|
||||
struct osmo_st2_cardem_inst _ci = {
|
||||
.slot = &_slot,
|
||||
};
|
||||
|
||||
struct cardem_inst *ci = &_ci;
|
||||
struct osmo_st2_cardem_inst *ci = &_ci;
|
||||
|
||||
static void signal_handler(int signal)
|
||||
{
|
||||
switch (signal) {
|
||||
case SIGINT:
|
||||
cardem_request_card_insert(ci, false);
|
||||
osmo_st2_cardem_request_card_insert(ci, false);
|
||||
exit(0);
|
||||
break;
|
||||
default:
|
||||
|
@ -278,7 +278,7 @@ static void signal_handler(int signal)
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct st_transport *transp = ci->slot->transp;
|
||||
struct osmo_st2_transport *transp = ci->slot->transp;
|
||||
char *gsmtap_host = "127.0.0.1";
|
||||
int rc;
|
||||
int c, ret = 1;
|
||||
|
@ -427,10 +427,10 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
/* simulate card-insert to modem (owhw, not qmod) */
|
||||
cardem_request_card_insert(ci, true);
|
||||
osmo_st2_cardem_request_card_insert(ci, true);
|
||||
|
||||
/* select remote (forwarded) SIM */
|
||||
st_modem_sim_select_remote(ci->slot);
|
||||
osmo_st2_modem_sim_select_remote(ci->slot);
|
||||
|
||||
if (!skip_atr) {
|
||||
/* set the ATR */
|
||||
|
@ -438,11 +438,11 @@ int main(int argc, char **argv)
|
|||
0xA0, 0x73, 0xBE, 0x21, 0x13, 0x67, 0x43, 0x20,
|
||||
0x07, 0x18, 0x00, 0x00, 0x01, 0xA5 };
|
||||
atr_update_csum(real_atr, sizeof(real_atr));
|
||||
cardem_request_set_atr(ci, real_atr, sizeof(real_atr));
|
||||
osmo_st2_cardem_request_set_atr(ci, real_atr, sizeof(real_atr));
|
||||
}
|
||||
|
||||
/* select remote (forwarded) SIM */
|
||||
st_modem_reset_pulse(ci->slot, 300);
|
||||
osmo_st2_modem_reset_pulse(ci->slot, 300);
|
||||
|
||||
run_mainloop(ci);
|
||||
ret = 0;
|
||||
|
|
Loading…
Reference in New Issue