changeset 101:1888d88478c4

fc-simtool write-hplmn-timer new command
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 14 May 2022 22:54:19 +0000
parents dc772132b5c9
children c2f18d7b0a1e
files simtool/cmdtab.c simtool/miscadm.c
diffstat 2 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/simtool/cmdtab.c	Wed May 05 05:22:28 2021 +0000
+++ b/simtool/cmdtab.c	Sat May 14 22:54:19 2022 +0000
@@ -113,6 +113,7 @@
 extern int cmd_verify_hex();
 extern int cmd_verify_sjs1_adm1();
 extern int cmd_write_acc();
+extern int cmd_write_hplmn_timer();
 extern int cmd_write_iccid();
 extern int cmd_write_iccid_sh18();
 extern int cmd_write_iccid_sh19();
@@ -255,6 +256,7 @@
 	{"verify-pin2", 1, 1, 0, cmd_verify_chv},
 	{"verify-sjs1-adm1", 1, 1, 0, cmd_verify_sjs1_adm1},
 	{"write-acc", 1, 1, 0, cmd_write_acc},
+	{"write-hplmn-timer", 1, 1, 0, cmd_write_hplmn_timer},
 	{"write-iccid", 1, 1, 0, cmd_write_iccid},
 	{"write-iccid-sh18", 1, 1, 0, cmd_write_iccid_sh18},
 	{"write-iccid-sh19", 1, 1, 0, cmd_write_iccid_sh19},
--- a/simtool/miscadm.c	Wed May 05 05:22:28 2021 +0000
+++ b/simtool/miscadm.c	Sat May 14 22:54:19 2022 +0000
@@ -214,3 +214,35 @@
 		return(rc);
 	return write_spn_bin(binrec);
 }
+
+static
+write_hplmn_bin(binrec)
+	u_char *binrec;
+{
+	int rc;
+
+	rc = select_op(DF_GSM);
+	if (rc < 0)
+		return(rc);
+	rc = select_op(EF_HPLMN);
+	if (rc < 0)
+		return(rc);
+	rc = parse_ef_select_response();
+	if (rc < 0)
+		return(rc);
+	if (curfile_structure != 0x00 || curfile_total_size != 1) {
+		fprintf(stderr,
+			"error: EF_HPLMN is not a transparent EF of 1 byte\n");
+		return(-1);
+	}
+	return update_bin_op(0, binrec, 1);
+}
+
+cmd_write_hplmn_timer(argc, argv)
+	char **argv;
+{
+	u_char datum;
+
+	datum = strtoul(argv[1], 0, 0);
+	return write_hplmn_bin(&datum);
+}