FreeCalypso > hg > fc-pcsc-tools
comparison uicc/hlread.c @ 22:1b1468869ccf
new trimmed fc-uicc-tool is here
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 12 Feb 2021 04:34:53 +0000 |
parents | |
children | d4b5a6e547ca |
comparison
equal
deleted
inserted
replaced
21:d4dc86195382 | 22:1b1468869ccf |
---|---|
1 /* | |
2 * This module implements some high-level or user-friendly read commands. | |
3 */ | |
4 | |
5 #include <sys/types.h> | |
6 #include <stdio.h> | |
7 #include "simresp.h" | |
8 #include "file_id.h" | |
9 | |
10 cmd_iccid() | |
11 { | |
12 int rc; | |
13 unsigned len; | |
14 char buf[21]; | |
15 | |
16 rc = select_op(FILEID_MF); | |
17 if (rc < 0) | |
18 return(rc); | |
19 rc = select_op(EF_ICCID); | |
20 if (rc < 0) | |
21 return(rc); | |
22 rc = select_resp_get_transparent(&len); | |
23 if (rc < 0) | |
24 return(rc); | |
25 if (len != 10) { | |
26 fprintf(stderr, "error: expected transparent EF of 10 bytes\n"); | |
27 return(-1); | |
28 } | |
29 rc = readbin_op(0, 10); | |
30 if (rc < 0) | |
31 return(rc); | |
32 decode_reversed_nibbles(sim_resp_data, 10, buf); | |
33 buf[20] = '\0'; | |
34 printf("%s\n", buf); | |
35 return(0); | |
36 } |