# HG changeset patch # User Mychaela Falconia # Date 1613542108 0 # Node ID 07e395fddfe191bd19bcbfb57dec834372cf029b # Parent fe660c7ea97f57560951e571d97da3cfb26d734e lnd-write command implemented diff -r fe660c7ea97f -r 07e395fddfe1 simtool/Makefile --- a/simtool/Makefile Wed Feb 17 05:59:27 2021 +0000 +++ b/simtool/Makefile Wed Feb 17 06:08:28 2021 +0000 @@ -2,9 +2,9 @@ CFLAGS= -O2 -I/usr/include/PCSC -I../libcommon PROG= fc-simtool OBJS= a38.o chv.o chvext.o curfile.o dispatch.o dumpdir.o grcard1.o grcard2.o\ - hlread.o main.o miscadm.o opldump.o pbcommon.o pbdump.o pberase.o \ - pbupd_file.o pbupd_imm.o pbupd_immhex.o plmnsel.o pnndump.o readcmd.o \ - readops.o restorebin.o savebin.o script.o select.o smserase.o \ + hlread.o lndwrite.o main.o miscadm.o opldump.o pbcommon.o pbdump.o \ + pberase.o pbupd_file.o pbupd_imm.o pbupd_immhex.o plmnsel.o pnndump.o \ + readcmd.o readops.o restorebin.o savebin.o script.o select.o smserase.o\ smsp_common.o smsp_dump.o smsp_erase.o smsp_restore.o smsp_set.o \ sstlist.o sysmo.o telsum.o usersum.o writecmd.o writeops.o LIBS= ../libcommon/libcommon.a diff -r fe660c7ea97f -r 07e395fddfe1 simtool/dispatch.c --- a/simtool/dispatch.c Wed Feb 17 05:59:27 2021 +0000 +++ b/simtool/dispatch.c Wed Feb 17 06:08:28 2021 +0000 @@ -26,6 +26,7 @@ extern int cmd_iccid(); extern int cmd_imsi(); extern int cmd_lnd_dump(); +extern int cmd_lnd_write(); extern int cmd_opl_dump(); extern int cmd_pb_dump(); extern int cmd_pb_dump_rec(); @@ -113,6 +114,7 @@ {"iccid", 0, 0, cmd_iccid}, {"imsi", 0, 0, cmd_imsi}, {"lnd-dump", 0, 1, cmd_lnd_dump}, + {"lnd-write", 1, 2, cmd_lnd_write}, {"opl-dump", 0, 0, cmd_opl_dump}, {"pb-dump", 1, 2, cmd_pb_dump}, {"pb-dump-rec", 2, 3, cmd_pb_dump_rec}, diff -r fe660c7ea97f -r 07e395fddfe1 simtool/lndwrite.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/simtool/lndwrite.c Wed Feb 17 06:08:28 2021 +0000 @@ -0,0 +1,33 @@ +/* + * This module implements lnd-write and lnd-erase commands. + */ + +#include +#include +#include +#include +#include +#include "curfile.h" + +cmd_lnd_write(argc, argv) + char **argv; +{ + int rc; + u_char record[255], *fixp; + + rc = select_ef_lnd(); + if (rc < 0) + return(rc); + memset(record, 0xFF, curfile_record_len); + fixp = record + curfile_record_len - 14; + rc = encode_phone_number_arg(argv[1], fixp, 0); + if (rc < 0) + return(rc); + if (argv[2]) { + rc = qstring_arg_to_gsm7(argv[2], record, + curfile_record_len - 14); + if (rc < 0) + return(rc); + } + return update_rec_op(0, 0x03, record, curfile_record_len); +}