comparison libcommon/apducmd.c @ 9:c9ef9e91dd8e

new libcommon, initial version
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 14 Mar 2021 06:55:38 +0000
parents
children bccf028921bb
comparison
equal deleted inserted replaced
8:34bbb0585cab 9:c9ef9e91dd8e
1 /*
2 * This module implements a low-level debug command
3 * for users to manually send arbitrary APDUs.
4 */
5
6 #include <sys/types.h>
7 #include <stdio.h>
8 #include "simresp.h"
9
10 cmd_apdu(argc, argv)
11 char **argv;
12 {
13 u_char cmd[260];
14 int rc;
15 unsigned len;
16
17 rc = decode_hex_data_from_string(argv[1], cmd, 5, 260);
18 if (rc < 0)
19 return(rc);
20 len = rc;
21 rc = apdu_exchange(cmd, len);
22 if (rc < 0)
23 return(rc);
24 printf("%04X\n", sim_resp_sw);
25 return(0);
26 }