From b675db73beafcd7caff6a8ad1c0145155e5791fb Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Tue, 29 Jan 2013 13:52:53 +0100 Subject: [PATCH] nfc-scan-device: fix option -i --- utils/nfc-scan-device.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/utils/nfc-scan-device.c b/utils/nfc-scan-device.c index 39d5c2b..0ff6393 100644 --- a/utils/nfc-scan-device.c +++ b/utils/nfc-scan-device.c @@ -77,11 +77,6 @@ main(int argc, const char *argv[]) bool verbose = false; nfc_context *context; - nfc_init(&context); - - // Display libnfc version - acLibnfcVersion = nfc_version(); - printf("%s uses libnfc %s\n", argv[0], acLibnfcVersion); // Get commandline options for (int arg = 1; arg < argc; arg++) { @@ -91,6 +86,7 @@ main(int argc, const char *argv[]) } else if (0 == strcmp(argv[arg], "-v")) { verbose = true; } else if (0 == strcmp(argv[arg], "-i")) { + // This has to be done before the call to nfc_init() setenv("LIBNFC_INTRUSIVE_SCAN", "yes", 1); } else { ERR("%s is not supported option.", argv[arg]); @@ -99,6 +95,12 @@ main(int argc, const char *argv[]) } } + nfc_init(&context); + + // Display libnfc version + acLibnfcVersion = nfc_version(); + printf("%s uses libnfc %s\n", argv[0], acLibnfcVersion); + #ifdef HAVE_LIBUSB # ifdef DEBUG usb_set_debug(4);