diff --git a/configure.ac b/configure.ac index f1b9a81..9c2eadc 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([libfreefare],[0.3.4]) +AC_INIT([libfreefare],[0.3.5]) AC_CONFIG_MACRO_DIR([m4]) @@ -58,7 +58,7 @@ AC_CHECK_LIB([crypto], [DES_ecb_encrypt], [], [AC_MSG_ERROR([Cannot find libcryp AC_CHECK_HEADERS([openssl/aes.h openssl/des.h openssl/rand.h], [], [AC_MSG_ERROR([Cannot find openssl headers.])]) # Checks for pkg-config modules. -LIBNFC_REQUIRED_VERSION="1.6.0" +LIBNFC_REQUIRED_VERSION="1.7.0" PKG_CHECK_MODULES([LIBNFC], [libnfc >= $LIBNFC_REQUIRED_VERSION], [], [AC_MSG_ERROR([libnfc >= $LIBNFC_REQUIRED_VERSION is mandatory.])]) PKG_CONFIG_REQUIRES="libnfc" diff --git a/examples/mifare-classic-format.c b/examples/mifare-classic-format.c index 70152e6..0a703a5 100644 --- a/examples/mifare-classic-format.c +++ b/examples/mifare-classic-format.c @@ -1,5 +1,6 @@ /*- * Copyright (C) 2010, Romain Tartiere, Romuald Conty. + * Copyright (C) 2012, Romuald Conty. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the @@ -164,15 +165,16 @@ main(int argc, char *argv[]) nfc_connstring devices[8]; size_t device_count; - - nfc_init(NULL); - device_count = nfc_list_devices (NULL, devices, 8); + nfc_context *context; + nfc_init (&context); + + device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) errx (EXIT_FAILURE, "No NFC device found."); for (size_t d = 0; d < device_count; d++) { - device = nfc_open (NULL, devices[d]); + device = nfc_open (context, devices[d]); if (!device) { warnx ("nfc_open() failed."); error = EXIT_FAILURE; @@ -247,6 +249,6 @@ main(int argc, char *argv[]) nfc_close (device); } - nfc_exit(NULL); + nfc_exit (context); exit (error); } diff --git a/examples/mifare-classic-read-ndef.c b/examples/mifare-classic-read-ndef.c index 1e1c1ef..891ffb9 100644 --- a/examples/mifare-classic-read-ndef.c +++ b/examples/mifare-classic-read-ndef.c @@ -114,15 +114,16 @@ main(int argc, char *argv[]) nfc_connstring devices[8]; size_t device_count; - - nfc_init(NULL); - device_count= nfc_list_devices (NULL, devices, 8); + nfc_context *context; + nfc_init (&context); + + device_count= nfc_list_devices (context, devices, 8); if (device_count <= 0) errx (EXIT_FAILURE, "No NFC device found."); for (size_t d = 0; d < device_count; d++) { - device = nfc_open (NULL, devices[d]); + device = nfc_open (context, devices[d]); if (!device) { warnx ("nfc_open() failed."); error = EXIT_FAILURE; @@ -228,6 +229,6 @@ error: nfc_close (device); } - nfc_exit(NULL); + nfc_exit (context); exit (error); } diff --git a/examples/mifare-classic-write-ndef.c b/examples/mifare-classic-write-ndef.c index 39898c6..c711c3f 100644 --- a/examples/mifare-classic-write-ndef.c +++ b/examples/mifare-classic-write-ndef.c @@ -195,14 +195,15 @@ main(int argc, char *argv[]) nfc_connstring devices[8]; size_t device_count; - nfc_init(NULL); + nfc_context *context; + nfc_init (&context); - device_count = nfc_list_devices (NULL, devices, 8); + device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) errx (EXIT_FAILURE, "No NFC device found."); for (size_t d = 0; d < device_count; d++) { - device = nfc_open (NULL, devices[d]); + device = nfc_open (context, devices[d]); if (!device) { warnx ("nfc_open() failed."); error = EXIT_FAILURE; @@ -408,6 +409,6 @@ error: } free (card_write_keys); - nfc_exit(NULL); + nfc_exit (context); exit (error); } diff --git a/examples/mifare-desfire-access.c b/examples/mifare-desfire-access.c index 36176fd..63046b9 100644 --- a/examples/mifare-desfire-access.c +++ b/examples/mifare-desfire-access.c @@ -40,15 +40,16 @@ main(int argc, char *argv[]) nfc_connstring devices[8]; size_t device_count; - - nfc_init(NULL); - device_count = nfc_list_devices (NULL, devices, 8); + nfc_context *context; + nfc_init (&context); + + device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) errx (EXIT_FAILURE, "No NFC device found."); for (size_t d = 0; d < device_count; d++) { - device = nfc_open (NULL, devices[d]); + device = nfc_open (context, devices[d]); if (!device) { warnx ("nfc_open() failed."); error = EXIT_FAILURE; @@ -131,7 +132,7 @@ main(int argc, char *argv[]) freefare_free_tags (tags); nfc_close (device); } - nfc_exit(NULL); + nfc_exit (context); exit (error); } /* main() */ diff --git a/examples/mifare-desfire-create-ndef.c b/examples/mifare-desfire-create-ndef.c index 6b01bbc..a652da8 100644 --- a/examples/mifare-desfire-create-ndef.c +++ b/examples/mifare-desfire-create-ndef.c @@ -95,15 +95,16 @@ main(int argc, char *argv[]) nfc_connstring devices[8]; size_t device_count; - - nfc_init(NULL); - device_count = nfc_list_devices (NULL, devices, 8); + nfc_context *context; + nfc_init (&context); + + device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) errx (EXIT_FAILURE, "No NFC device found."); for (size_t d = 0; d < device_count; d++) { - device = nfc_open (NULL, devices[d]); + device = nfc_open (context, devices[d]); if (!device) { warnx ("nfc_open() failed."); @@ -310,6 +311,6 @@ main(int argc, char *argv[]) freefare_free_tags (tags); nfc_close (device); } - nfc_exit(NULL); + nfc_exit (context); exit (error); } diff --git a/examples/mifare-desfire-ev1-configure-ats.c b/examples/mifare-desfire-ev1-configure-ats.c index fb70294..1783c73 100644 --- a/examples/mifare-desfire-ev1-configure-ats.c +++ b/examples/mifare-desfire-ev1-configure-ats.c @@ -88,15 +88,16 @@ main(int argc, char *argv[]) nfc_connstring devices[8]; size_t device_count; - - nfc_init(NULL); - device_count = nfc_list_devices (NULL, devices, 8); + nfc_context *context; + nfc_init (&context); + + device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) errx (EXIT_FAILURE, "No NFC device found."); for (size_t d = 0; (!error) && (d < device_count); d++) { - device = nfc_open (NULL, devices[d]); + device = nfc_open (context, devices[d]); if (!device) { warnx ("nfc_open() failed."); error = EXIT_FAILURE; @@ -174,7 +175,7 @@ main(int argc, char *argv[]) freefare_free_tags (tags); nfc_close (device); } - nfc_exit(NULL); + nfc_exit (context); exit (error); } /* main() */ diff --git a/examples/mifare-desfire-ev1-configure-default-key.c b/examples/mifare-desfire-ev1-configure-default-key.c index ae46a33..fa4174e 100644 --- a/examples/mifare-desfire-ev1-configure-default-key.c +++ b/examples/mifare-desfire-ev1-configure-default-key.c @@ -75,14 +75,15 @@ main(int argc, char *argv[]) nfc_connstring devices[8]; size_t device_count; - nfc_init(NULL); + nfc_context *context; + nfc_init (&context); - device_count = nfc_list_devices (NULL, devices, 8); + device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) errx (EXIT_FAILURE, "No NFC device found."); for (size_t d = 0; (!error) && (d < device_count); d++) { - device = nfc_open (NULL, devices[d]); + device = nfc_open (context, devices[d]); if (!device) { warnx ("nfc_open() failed."); error = EXIT_FAILURE; @@ -247,6 +248,6 @@ main(int argc, char *argv[]) freefare_free_tags (tags); nfc_close (device); } - nfc_exit(NULL); + nfc_exit (context); exit (error); } diff --git a/examples/mifare-desfire-ev1-configure-random-uid.c b/examples/mifare-desfire-ev1-configure-random-uid.c index 111d851..d93d8ab 100644 --- a/examples/mifare-desfire-ev1-configure-random-uid.c +++ b/examples/mifare-desfire-ev1-configure-random-uid.c @@ -85,14 +85,15 @@ main(int argc, char *argv[]) nfc_connstring devices[8]; size_t device_count; - nfc_init(NULL); + nfc_context *context; + nfc_init (&context); - device_count = nfc_list_devices (NULL, devices, 8); + device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) errx (EXIT_FAILURE, "No NFC device found."); for (size_t d = 0; (!error) && (d < device_count); d++) { - device = nfc_open (NULL, devices[d]); + device = nfc_open (context, devices[d]); if (!device) { warnx ("nfc_open() failed."); error = EXIT_FAILURE; @@ -203,7 +204,7 @@ main(int argc, char *argv[]) freefare_free_tags (tags); nfc_close (device); } - nfc_exit(NULL); + nfc_exit (context); exit (error); } /* main() */ diff --git a/examples/mifare-desfire-format.c b/examples/mifare-desfire-format.c index 0889d4c..4baa5db 100644 --- a/examples/mifare-desfire-format.c +++ b/examples/mifare-desfire-format.c @@ -85,14 +85,15 @@ main(int argc, char *argv[]) nfc_connstring devices[8]; size_t device_count; - nfc_init(NULL); + nfc_context *context; + nfc_init (&context); - device_count = nfc_list_devices (NULL, devices, 8); + device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) errx (EXIT_FAILURE, "No NFC device found."); for (size_t d = 0; (!error) && (d < device_count); d++) { - device = nfc_open (NULL, devices[d]); + device = nfc_open (context, devices[d]); if (!device) { warnx ("nfc_open() failed."); error = EXIT_FAILURE; @@ -166,7 +167,7 @@ main(int argc, char *argv[]) freefare_free_tags (tags); nfc_close (device); } - nfc_exit(NULL); + nfc_exit (context); exit (error); } /* main() */ diff --git a/examples/mifare-desfire-info.c b/examples/mifare-desfire-info.c index c8f06b1..a2db8e2 100644 --- a/examples/mifare-desfire-info.c +++ b/examples/mifare-desfire-info.c @@ -39,14 +39,15 @@ main(int argc, char *argv[]) nfc_connstring devices[8]; size_t device_count; - nfc_init(NULL); + nfc_context *context; + nfc_init (&context); - device_count = nfc_list_devices (NULL, devices, 8); + device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) errx (EXIT_FAILURE, "No NFC device found."); for (size_t d = 0; d < device_count; d++) { - device = nfc_open (NULL, devices[d]); + device = nfc_open (context, devices[d]); if (!device) { warnx ("nfc_open() failed."); error = EXIT_FAILURE; @@ -141,7 +142,7 @@ main(int argc, char *argv[]) freefare_free_tags (tags); nfc_close (device); } - nfc_exit(NULL); + nfc_exit (context); exit (error); } /* main() */ diff --git a/examples/mifare-desfire-read-ndef.c b/examples/mifare-desfire-read-ndef.c index 6b9f582..f7fedd5 100644 --- a/examples/mifare-desfire-read-ndef.c +++ b/examples/mifare-desfire-read-ndef.c @@ -124,14 +124,15 @@ main(int argc, char *argv[]) nfc_connstring devices[8]; size_t device_count; - nfc_init(NULL); + nfc_context *context; + nfc_init (&context); - device_count = nfc_list_devices (NULL, devices, 8); + device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) errx (EXIT_FAILURE, "No NFC device found."); for (size_t d = 0; d < device_count; d++) { - device = nfc_open (NULL, devices[d]); + device = nfc_open (context, devices[d]); if (!device) { warnx ("nfc_open() failed."); @@ -269,6 +270,6 @@ main(int argc, char *argv[]) freefare_free_tags (tags); nfc_close (device); } - nfc_exit(NULL); + nfc_exit (context); exit (error); } diff --git a/examples/mifare-desfire-write-ndef.c b/examples/mifare-desfire-write-ndef.c index a34ebda..0082f78 100644 --- a/examples/mifare-desfire-write-ndef.c +++ b/examples/mifare-desfire-write-ndef.c @@ -153,14 +153,15 @@ main(int argc, char *argv[]) nfc_connstring devices[8]; size_t device_count; - nfc_init(NULL); + nfc_context *context; + nfc_init (&context); - device_count = nfc_list_devices (NULL, devices, 8); + device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) errx (EXIT_FAILURE, "No NFC device found."); for (size_t d = 0; d < device_count; d++) { - device = nfc_open (NULL, devices[d]); + device = nfc_open (context, devices[d]); if (!device) { warnx ("nfc_open() failed."); @@ -292,6 +293,6 @@ main(int argc, char *argv[]) freefare_free_tags (tags); nfc_close (device); } - nfc_exit(NULL); + nfc_exit (context); exit (error); } diff --git a/examples/mifare-ultralight-info.c b/examples/mifare-ultralight-info.c index a191cea..f9ca9a6 100644 --- a/examples/mifare-ultralight-info.c +++ b/examples/mifare-ultralight-info.c @@ -36,14 +36,15 @@ main (int argc, char *argv[]) nfc_connstring devices[8]; size_t device_count; - nfc_init (NULL); + nfc_context *context; + nfc_init (&context); - device_count = nfc_list_devices (NULL, devices, sizeof (devices) / sizeof (*devices)); + device_count = nfc_list_devices (context, devices, sizeof (devices) / sizeof (*devices)); if (device_count <= 0) errx (EXIT_FAILURE, "No NFC device found"); for (size_t d = 0; d < device_count; d++) { - if (!(device = nfc_open (NULL, devices[d]))) { + if (!(device = nfc_open (context, devices[d]))) { warnx ("nfc_open() failed."); error = EXIT_FAILURE; continue; @@ -85,6 +86,6 @@ main (int argc, char *argv[]) nfc_close (device); } - nfc_exit (NULL); + nfc_exit (context); exit(error); }