43 #endif // HAVE_CONFIG_H
55 #define MAX_DEVICE_COUNT 16
56 #define MAX_TARGET_COUNT 16
61 print_usage(
const char *progname)
63 printf(
"usage: %s [-v]\n", progname);
64 printf(
" -v\t verbose display\n");
68 main(
int argc,
const char *argv[])
71 const char *acLibnfcVersion;
78 if (context == NULL) {
79 ERR(
"Unable to init libnfc (malloc)");
85 printf(
"%s uses libnfc %s\n", argv[0], acLibnfcVersion);
87 if ((argc == 2) && (0 == strcmp(
"-v", argv[1]))) {
102 nfc_device_desc_t ndd;
103 ndd.pcDriver =
"ARYGON";
104 ndd.pcPort =
"/dev/ttyUSB0";
105 ndd.uiSpeed = 115200;
111 nfc_device_desc_t ndd;
112 ndd.pcDriver =
"PN533_USB";
113 strcpy(ndd.acDevice,
"SCM Micro / SCL3711-NFC&RW");
117 size_t szDeviceFound =
nfc_list_devices(context, connstrings, MAX_DEVICE_COUNT);
119 if (szDeviceFound == 0) {
120 printf(
"No NFC device found.\n");
123 for (i = 0; i < szDeviceFound; i++) {
125 pnd =
nfc_open(context, connstrings[i]);
128 ERR(
"Unable to open NFC device: %s", connstrings[i]);
141 nm.nmt = NMT_ISO14443A;
146 if (verbose || (res > 0)) {
147 printf(
"%d ISO14443A passive target(s) found%s\n", res, (res == 0) ?
".\n" :
":");
149 for (n = 0; n < res; n++) {
150 print_nfc_target(&ant[n], verbose);
160 if (verbose || (res > 0)) {
161 printf(
"%d Felica (212 kbps) passive target(s) found%s\n", res, (res == 0) ?
".\n" :
":");
163 for (n = 0; n < res; n++) {
164 print_nfc_target(&ant[n], verbose);
172 if (verbose || (res > 0)) {
173 printf(
"%d Felica (424 kbps) passive target(s) found%s\n", res, (res == 0) ?
".\n" :
":");
175 for (n = 0; n < res; n++) {
176 print_nfc_target(&ant[n], verbose);
181 nm.nmt = NMT_ISO14443B;
186 if (verbose || (res > 0)) {
187 printf(
"%d ISO14443B passive target(s) found%s\n", res, (res == 0) ?
".\n" :
":");
189 for (n = 0; n < res; n++) {
190 print_nfc_target(&ant[n], verbose);
195 nm.nmt = NMT_ISO14443BI;
200 if (verbose || (res > 0)) {
201 printf(
"%d ISO14443B' passive target(s) found%s\n", res, (res == 0) ?
".\n" :
":");
203 for (n = 0; n < res; n++) {
204 print_nfc_target(&ant[n], verbose);
209 nm.nmt = NMT_ISO14443B2SR;
214 if (verbose || (res > 0)) {
215 printf(
"%d ISO14443B-2 ST SRx passive target(s) found%s\n", res, (res == 0) ?
".\n" :
":");
217 for (n = 0; n < res; n++) {
218 print_nfc_target(&ant[n], verbose);
223 nm.nmt = NMT_ISO14443B2CT;
228 if (verbose || (res > 0)) {
229 printf(
"%d ISO14443B-2 ASK CTx passive target(s) found%s\n", res, (res == 0) ?
".\n" :
":");
231 for (n = 0; n < res; n++) {
232 print_nfc_target(&ant[n], verbose);
242 if (verbose || (res > 0)) {
243 printf(
"%d Jewel passive target(s) found%s\n", res, (res == 0) ?
".\n" :
":");
245 for (n = 0; n < res; n++) {
246 print_nfc_target(&ant[n], verbose);