annotate uicc/main.c @ 93:6041c601304d

fcsim1-mkprov: revert OTA key addition It appears that GrcardSIM2 cards (which is what we got for FCSIM1) do not support OTA after all, contrary to what we were previously led to believe by some tech support emails from Grcard - apparently those support emails and OTA descriptions referred to some other card model(s).
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 21 Apr 2021 05:38:39 +0000
parents f6d5cff989d6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #include <stdio.h>
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 #include <stdlib.h>
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 #include <unistd.h>
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 extern char be_reader_name[];
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 extern char be_atr_string[];
46
e2ef4b8e4136 main tools: display spenh info when serial back end is used
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
7 extern char be_extra_info[];
15
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 main(argc, argv)
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 char **argv;
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 {
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 extern int optind;
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 char command[512];
78
f6d5cff989d6 fc-uicc-tool batch stdin mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 46
diff changeset
14 int rc, batch_stdin;
15
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 parse_global_options(argc, argv);
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 launch_backend();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 collect_backend_init_strings();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 if (argc > optind) {
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 rc = dispatch_ready_argv(argc - optind, argv + optind);
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 if (rc)
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 exit(1);
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 else
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 good_exit();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 }
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 if (be_reader_name[0])
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 printf("Card reader name: %s\n", be_reader_name);
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 if (be_atr_string[0])
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 printf("ATR: %s\n", be_atr_string);
46
e2ef4b8e4136 main tools: display spenh info when serial back end is used
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
30 if (be_extra_info[0])
e2ef4b8e4136 main tools: display spenh info when serial back end is used
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
31 puts(be_extra_info);
78
f6d5cff989d6 fc-uicc-tool batch stdin mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 46
diff changeset
32 batch_stdin = !isatty(0);
15
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 for (;;) {
78
f6d5cff989d6 fc-uicc-tool batch stdin mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 46
diff changeset
34 if (!batch_stdin) {
15
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 fputs("uicc> ", stdout);
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 fflush(stdout);
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 }
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 if (!fgets(command, sizeof command, stdin))
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 good_exit();
78
f6d5cff989d6 fc-uicc-tool batch stdin mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 46
diff changeset
40 if (batch_stdin)
f6d5cff989d6 fc-uicc-tool batch stdin mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 46
diff changeset
41 printf("Stdin command: %s", command);
f6d5cff989d6 fc-uicc-tool batch stdin mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 46
diff changeset
42 rc = simtool_dispatch_cmd(command, 0);
f6d5cff989d6 fc-uicc-tool batch stdin mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 46
diff changeset
43 if (batch_stdin && rc)
f6d5cff989d6 fc-uicc-tool batch stdin mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 46
diff changeset
44 exit(1);
15
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 }
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 }