diff simtool/miscadm.c @ 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 ddd767f6e15b
children
line wrap: on
line diff
--- 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);
+}