FreeCalypso > hg > fc-pcsc-tools
annotate misc/fc-pcsc-atr.c @ 30:84d1c31d0fad
first round of refactoring for selection among multiple readers
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 12 Feb 2021 17:09:01 +0000 |
parents | 4bd6275d7c79 |
children | 8a4f3d00d997 |
rev | line source |
---|---|
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 #include <stdio.h> |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 #include <stdlib.h> |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 #include <pcsclite.h> |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 #include <winscard.h> |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include "cardif.h" |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 main(argc, argv) |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 char **argv; |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 { |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 int rc; |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 setup_pcsc_context(); |
30
84d1c31d0fad
first round of refactoring for selection among multiple readers
Mychaela Falconia <falcon@freecalypso.org>
parents:
26
diff
changeset
|
13 get_reader_list(); |
84d1c31d0fad
first round of refactoring for selection among multiple readers
Mychaela Falconia <falcon@freecalypso.org>
parents:
26
diff
changeset
|
14 select_reader_num(0); |
84d1c31d0fad
first round of refactoring for selection among multiple readers
Mychaela Falconia <falcon@freecalypso.org>
parents:
26
diff
changeset
|
15 printf("Card reader name: %s\n", selected_reader); |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 connect_to_card(); |
26
4bd6275d7c79
fc-pcsc-atr trivial program added
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
17 rc = retrieve_atr(); |
4bd6275d7c79
fc-pcsc-atr trivial program added
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
18 if (rc) |
4bd6275d7c79
fc-pcsc-atr trivial program added
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
19 error_exit(); |
4bd6275d7c79
fc-pcsc-atr trivial program added
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
20 else |
4bd6275d7c79
fc-pcsc-atr trivial program added
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
21 good_exit(); |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 } |