This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-remsim/+/25410 ) Change subject: client: request card-remove and sim-local when no bankd/slot is set ...................................................................... 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 --- M src/client/client.h M src/client/main_fsm.c M src/client/user_ifdhandler.c M src/client/user_shell.c M src/client/user_simtrace2.c 5 files changed, 54 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/10/25410/1 diff --git a/src/client/client.h b/src/client/client.h index 0024f52..9cfdc5d 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -43,7 +43,9 @@ /* 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); diff --git a/src/client/main_fsm.c b/src/client/main_fsm.c index 673b19e..4ca07e6 100644 --- a/src/client/main_fsm.c +++ b/src/client/main_fsm.c @@ -208,6 +208,23 @@ 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; @@ -232,9 +249,9 @@ bc->bankd_conn.server_port = pdu_rx->msg.choice.configClientBankReq.bankd.port; rspro2bank_slot(&bc->bankd_slot, &pdu_rx->msg.choice.configClientBankReq.bankSlot); /* bankd port 0 is a magic value to indicate "no bankd" */ - if (bc->bankd_conn.server_port == 0) + if (bc->bankd_conn.server_port == 0) { osmo_fsm_inst_state_chg(fi, MF_ST_UNCONFIGURED, 0, 0); - else { + } else { osmo_fsm_inst_state_chg(fi, MF_ST_WAIT_BANKD, 0, 0); /* TODO: do we need to disconnect before? */ osmo_fsm_inst_dispatch(bc->bankd_conn.fi, SRVC_E_ESTABLISH, NULL); @@ -353,6 +370,7 @@ .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, }, }; diff --git a/src/client/user_ifdhandler.c b/src/client/user_ifdhandler.c index a690503..a416e6e 100644 --- a/src/client/user_ifdhandler.c +++ b/src/client/user_ifdhandler.c @@ -156,11 +156,21 @@ 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; diff --git a/src/client/user_shell.c b/src/client/user_shell.c index b22ee9a..5d37e97 100644 --- a/src/client/user_shell.c +++ b/src/client/user_shell.c @@ -20,11 +20,21 @@ 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; diff --git a/src/client/user_simtrace2.c b/src/client/user_simtrace2.c index fa6c319..8d8a6c9 100644 --- a/src/client/user_simtrace2.c +++ b/src/client/user_simtrace2.c @@ -322,12 +322,24 @@ 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; -- To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/25410 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-remsim Gerrit-Branch: master Gerrit-Change-Id: Ifaa4b60474bf8585bfbe0288062f581821bd3faa Gerrit-Change-Number: 25410 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge at osmocom.org> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210908/aa6f39ce/attachment.htm>