changeset 84:51f26fd967e2

lnd-erase command implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 17 Feb 2021 06:15:15 +0000
parents 07e395fddfe1
children 51167ee0151b
files simtool/dispatch.c simtool/lndwrite.c
diffstat 2 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/simtool/dispatch.c	Wed Feb 17 06:08:28 2021 +0000
+++ b/simtool/dispatch.c	Wed Feb 17 06:15:15 2021 +0000
@@ -26,6 +26,7 @@
 extern int cmd_iccid();
 extern int cmd_imsi();
 extern int cmd_lnd_dump();
+extern int cmd_lnd_erase();
 extern int cmd_lnd_write();
 extern int cmd_opl_dump();
 extern int cmd_pb_dump();
@@ -114,6 +115,7 @@
 	{"iccid", 0, 0, cmd_iccid},
 	{"imsi", 0, 0, cmd_imsi},
 	{"lnd-dump", 0, 1, cmd_lnd_dump},
+	{"lnd-erase", 0, 0, cmd_lnd_erase},
 	{"lnd-write", 1, 2, cmd_lnd_write},
 	{"opl-dump", 0, 0, cmd_opl_dump},
 	{"pb-dump", 1, 2, cmd_pb_dump},
--- a/simtool/lndwrite.c	Wed Feb 17 06:08:28 2021 +0000
+++ b/simtool/lndwrite.c	Wed Feb 17 06:15:15 2021 +0000
@@ -31,3 +31,22 @@
 	}
 	return update_rec_op(0, 0x03, record, curfile_record_len);
 }
+
+cmd_lnd_erase(argc, argv)
+	char **argv;
+{
+	int rc;
+	u_char record[255];
+	unsigned count;
+
+	rc = select_ef_lnd();
+	if (rc < 0)
+		return(rc);
+	memset(record, 0xFF, curfile_record_len);
+	for (count = 0; count < curfile_record_count; count++) {
+		rc = update_rec_op(0, 0x03, record, curfile_record_len);
+		if (rc < 0)
+			return(rc);
+	}
+	return(0);
+}