Browse Source

client: request card-remove and sim-local when no bankd/slot is set

When the client leaves the OPERATIONAL state, do the inverse of what
happens when entering that state:
* request "card insert" no longer to be generated towards modem
* request switch back to local SIM
* reset the modem to notice the change

This way entering remote-sim operation due to adding a slotmap
and leaving remote-sim due to removing the slotmap should be
symmetrical.

Change-Id: Ifaa4b60474bf8585bfbe0288062f581821bd3faa
Closes: OS#5216
changes/10/25410/2
Harald Welte 11 months ago
parent
commit
7b87ba1e38
  1. 2
      src/client/client.h
  2. 18
      src/client/main_fsm.c
  3. 10
      src/client/user_ifdhandler.c
  4. 10
      src/client/user_shell.c
  5. 12
      src/client/user_simtrace2.c

2
src/client/client.h

@ -43,7 +43,9 @@ struct frontend_tpdu {
/* API from generic core to frontend (modem/cardem) */
int frontend_request_card_insert(struct bankd_client *bc);
int frontend_request_card_remove(struct bankd_client *bc);
int frontend_request_sim_remote(struct bankd_client *bc);
int frontend_request_sim_local(struct bankd_client *bc);
int frontend_request_modem_reset(struct bankd_client *bc);
int frontend_handle_card2modem(struct bankd_client *bc, const uint8_t *data, size_t len);
int frontend_handle_set_atr(struct bankd_client *bc, const uint8_t *data, size_t len);

18
src/client/main_fsm.c

@ -208,6 +208,23 @@ static void main_st_operational_onenter(struct osmo_fsm_inst *fi, uint32_t prev_
call_script(bc, "request-modem-reset");
}
static void main_st_operational_onleave(struct osmo_fsm_inst *fi, uint32_t next_state)
{
struct bankd_client *bc = (struct bankd_client *) fi->priv;
/* Simulate a card-remval to modem */
frontend_request_card_remove(bc);
call_script(bc, "request-card-remove");
/* Select local SIM */
frontend_request_sim_local(bc);
call_script(bc, "request-sim-local");
/* Reset the modem */
frontend_request_modem_reset(bc);
call_script(bc, "request-modem-reset");
}
static void main_st_operational(struct osmo_fsm_inst *fi, uint32_t event, void *data)
{
struct bankd_client *bc = (struct bankd_client *) fi->priv;
@ -353,6 +370,7 @@ static const struct osmo_fsm_state main_fsm_states[] = {
.out_state_mask = S(MF_ST_INIT) | S(MF_ST_UNCONFIGURED) | S(MF_ST_WAIT_BANKD),
.action = main_st_operational,
.onenter = main_st_operational_onenter,
.onleave = main_st_operational_onleave,
},
};

10
src/client/user_ifdhandler.c

@ -156,11 +156,21 @@ int frontend_request_card_insert(struct bankd_client *bc)
return 0;
}
int frontend_request_card_remove(struct bankd_client *bc)
{
return 0;
}
int frontend_request_sim_remote(struct bankd_client *bc)
{
return 0;
}
int frontend_request_sim_local(struct bankd_client *bc)
{
return 0;
}
int frontend_request_modem_reset(struct bankd_client *bc)
{
return 0;

10
src/client/user_shell.c

@ -20,11 +20,21 @@ int frontend_request_card_insert(struct bankd_client *bc)
return 0;
}
int frontend_request_card_remove(struct bankd_client *bc)
{
return 0;
}
int frontend_request_sim_remote(struct bankd_client *bc)
{
return 0;
}
int frontend_request_sim_local(struct bankd_client *bc)
{
return 0;
}
int frontend_request_modem_reset(struct bankd_client *bc)
{
return 0;

12
src/client/user_simtrace2.c

@ -322,12 +322,24 @@ int frontend_request_card_insert(struct bankd_client *bc)
return osmo_st2_cardem_request_card_insert(ci, true);
}
int frontend_request_card_remove(struct bankd_client *bc)
{
struct osmo_st2_cardem_inst *ci = bc->cardem;
return osmo_st2_cardem_request_card_insert(ci, false);
}
int frontend_request_sim_remote(struct bankd_client *bc)
{
struct osmo_st2_cardem_inst *ci = bc->cardem;
return osmo_st2_modem_sim_select_remote(ci->slot);
}
int frontend_request_sim_local(struct bankd_client *bc)
{
struct osmo_st2_cardem_inst *ci = bc->cardem;
return osmo_st2_modem_sim_select_local(ci->slot);
}
int frontend_request_modem_reset(struct bankd_client *bc)
{
struct osmo_st2_cardem_inst *ci = bc->cardem;

Loading…
Cancel
Save