FreeCalypso > hg > fc-pcsc-tools
changeset 203:647267e39c21
fc-simtool update-rec-imm command implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 07 Mar 2021 04:11:28 +0000 |
parents | 3f6f50103dd3 |
children | a462012c9e67 |
files | simtool/dispatch.c simtool/writecmd.c |
diffstat | 2 files changed, 31 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/simtool/dispatch.c Sun Mar 07 04:06:39 2021 +0000 +++ b/simtool/dispatch.c Sun Mar 07 04:11:28 2021 +0000 @@ -92,6 +92,7 @@ extern int cmd_update_bin(); extern int cmd_update_bin_imm(); extern int cmd_update_rec(); +extern int cmd_update_rec_imm(); extern int cmd_user_sum(); extern int cmd_verify_chv(); extern int cmd_verify_ext(); @@ -219,6 +220,7 @@ {"update-bin", 2, 2, 0, cmd_update_bin}, {"update-bin-imm", 2, 2, 0, cmd_update_bin_imm}, {"update-rec", 2, 2, 0, cmd_update_rec}, + {"update-rec-imm", 2, 2, 0, cmd_update_rec_imm}, {"user-sum", 0, 0, 1, cmd_user_sum}, {"verify-chv1", 1, 1, 0, cmd_verify_chv}, {"verify-chv2", 1, 1, 0, cmd_verify_chv},
--- a/simtool/writecmd.c Sun Mar 07 04:06:39 2021 +0000 +++ b/simtool/writecmd.c Sun Mar 07 04:11:28 2021 +0000 @@ -71,3 +71,32 @@ } return update_rec_op(recno, mode, data, curfile_record_len); } + +cmd_update_rec_imm(argc, argv) + char **argv; +{ + unsigned recno, mode; + u_char data[255]; + int rc; + + if (!strcmp(argv[1], "prev")) { + recno = 0; + mode = 0x03; + } else { + recno = strtoul(argv[1], 0, 0); + if (recno < 1 || recno > 255) { + fprintf(stderr, + "error: record number argument is out of range\n"); + return(-1); + } + mode = 0x04; + } + rc = decode_hex_data_from_string(argv[2], data, 1, 255); + if (rc < 0) + return(rc); + if (rc != curfile_record_len) { + fprintf(stderr, "error: hex data length != EF record length\n"); + return(-1); + } + return update_rec_op(recno, mode, data, curfile_record_len); +}