From fce491c8299c0b680834e1f243e3d74a24e902ae Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Wed, 15 Apr 2015 17:11:11 +0200 Subject: [PATCH] README: add a section to help to configure libnfc --- README | 22 +++++++++++++++++++++- libnfc/conf.c | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/README b/README index bb4d7c0..2a54d86 100644 --- a/README +++ b/README @@ -3,7 +3,7 @@ * * Libnfc historical contributors: * Copyright (C) 2009 Roel Verdult -* Copyright (C) 2009-2013 Romuald Conty +* Copyright (C) 2009-2015 Romuald Conty * Copyright (C) 2010-2012 Romain Tartière * Copyright (C) 2010-2013 Philippe Teuwen * Copyright (C) 2012-2013 Ludovic Rousseau @@ -55,6 +55,26 @@ Under GNU/Linux systems, if you use udev, you could use the provided udev rules. Under FreeBSD, if you use devd, there is also a rules file: contrib/devd/pn53x.conf. +Configuration +============= + +In order to change the default behavior of the library, the libnfc uses a +configuration file located in sysconfdir (as provided to ./configure). + +A sample commented file is available in sources: libnfc.conf.sample + +If you have compiled using: + ./configure --prefix=/usr --sysconfdir=/etc +you can make configuration directory and copy the sample file: + sudo mkdir /etc/nfc + sudo cp libnfc.conf.sample /etc/nfc/libnfc.conf + +To configure multiple devices, you can either modify libnfc.conf or create a +file per device in a nfc/devices.d directory: + sudo mkdir -p /etc/nfc/devices.d + printf 'name = "My first device"\nconnstring = "pn532_uart:/dev/ttyACM0"\n' | sudo tee /etc/nfc/devices.d/first.conf + printf 'name = "My second device"\nconnstring = "pn532_uart:/dev/ttyACM1"\n' | sudo tee /etc/nfc/devices.d/second.conf + How to report bugs ================== diff --git a/libnfc/conf.c b/libnfc/conf.c index 2319a75..47b2d03 100644 --- a/libnfc/conf.c +++ b/libnfc/conf.c @@ -185,6 +185,7 @@ conf_devices_load(const char *dirname, nfc_context *context) while ((readdir_r(d, &entry, &result) == 0) && (result != NULL)) { de = &entry; #endif + // FIXME add a way to sort devices if (de->d_name[0] != '.') { const size_t filename_len = strlen(de->d_name); const size_t extension_len = strlen(".conf");