comparison simtool/hlread.c @ 97:597c4e87a1f4

fc-simtool: imsi high-level read command implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 24 Jan 2021 22:16:33 +0000
parents a5dfab380a90
children 90eff13a72fd
comparison
equal deleted inserted replaced
96:a5dfab380a90 97:597c4e87a1f4
63 decode_reversed_nibbles(sim_resp_data, 10, buf); 63 decode_reversed_nibbles(sim_resp_data, 10, buf);
64 buf[20] = '\0'; 64 buf[20] = '\0';
65 printf("%s\n", buf); 65 printf("%s\n", buf);
66 return(0); 66 return(0);
67 } 67 }
68
69 cmd_imsi()
70 {
71 int rc;
72 char buf[17];
73
74 rc = select_op(DF_GSM);
75 if (rc < 0)
76 return(rc);
77 rc = select_op(EF_IMSI);
78 if (rc < 0)
79 return(rc);
80 rc = parse_ef_select_response();
81 if (rc < 0)
82 return(rc);
83 if (curfile_structure != 0x00 || curfile_total_size != 9) {
84 fprintf(stderr, "error: expected transparent EF of 9 bytes\n");
85 return(-1);
86 }
87 rc = readbin_op(0, 9);
88 if (rc < 0)
89 return(rc);
90 decode_reversed_nibbles(sim_resp_data + 1, 8, buf);
91 buf[16] = '\0';
92 printf("%s parity=%c len=%u\n", buf + 1, buf[0], sim_resp_data[0]);
93 return(0);
94 }