Change in osmo-remsim[master]: client: request card-remove and sim-local when no bankd/slot is set

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.org
Mon Dec 6 12:52:14 UTC 2021


laforge has submitted this change. ( 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, 52 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  lynxis lazus: Looks good to me, approved



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..96b4b90 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;
@@ -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: 2
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Assignee: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-CC: daniel <dwillmann at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211206/52501cf2/attachment.htm>


More information about the gerrit-log mailing list