Change in osmo-remsim[master]: user_shell: Dispatch all events via main_fsm.c

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 May 25 21:07:18 UTC 2020


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-remsim/+/18478 )


Change subject: user_shell: Dispatch all events via main_fsm.c
......................................................................

user_shell: Dispatch all events via main_fsm.c

... avoid calling server_conn_send_rspro() directly from user code.

Change-Id: I7f589ea1b1610e6d716ed0d9f4078b185bc6401d
---
M src/client/user_shell.c
1 file changed, 20 insertions(+), 10 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/78/18478/1

diff --git a/src/client/user_shell.c b/src/client/user_shell.c
index 9c804c6..c8f1b5f 100644
--- a/src/client/user_shell.c
+++ b/src/client/user_shell.c
@@ -74,21 +74,30 @@
 static void handle_stdin_command(struct stdin_state *ss, char *cmd)
 {
 	struct bankd_client *bc = ss->bc;
-	RsproPDU_t *pdu;
-	BankSlot_t bslot;
-	uint8_t buf[1024];
 	int rc;
 
-	bank_slot2rspro(&bslot, &bc->bankd_slot);
-
 	OSMO_ASSERT(ss->rx_msg);
 
 	if (!strcasecmp(cmd, "RESET")) {
 		/* reset the [remote] card */
-		pdu = rspro_gen_ClientSlotStatusInd(bc->srv_conn.clslot, &bslot,
-						    true, false, false, true);
-		server_conn_send_rspro(&bc->bankd_conn, pdu);
+		struct frontend_phys_status pstatus = {
+			.flags = {
+				.reset_active = true,
+				.vcc_present = false,
+				.clk_active = false,
+				.card_present = true,
+			},
+			.voltage_mv = 0,
+			.fi = 0,
+			.di = 0,
+			.wi = 0,
+			.waiting_time = 0,
+		};
+		osmo_fsm_inst_dispatch(bc->main_fi, MF_E_MDM_STATUS_IND, &pstatus);
 	} else {
+		struct frontend_tpdu ftpdu;
+		uint8_t buf[1024];
+
 		/* we assume the user has entered a C-APDU as hex string. parse + send */
 		rc = osmo_hexparse(cmd, buf, sizeof(buf));
 		if (rc < 0) {
@@ -101,8 +110,9 @@
 		}
 
 		/* Send CMD APDU to [remote] card */
-		pdu = rspro_gen_TpduModem2Card(bc->srv_conn.clslot, &bslot, buf, rc);
-		server_conn_send_rspro(&bc->bankd_conn, pdu);
+		ftpdu.buf = buf;
+		ftpdu.len = rc;
+		osmo_fsm_inst_dispatch(bc->main_fi, MF_E_MDM_TPDU, &ftpdu);
 	}
 }
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/18478
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I7f589ea1b1610e6d716ed0d9f4078b185bc6401d
Gerrit-Change-Number: 18478
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/20200525/4e0be271/attachment.htm>


More information about the gerrit-log mailing list