Add -i option to nfc-scan-device to allow intrusive scan and add a manpage for this util.
This commit is contained in:
parent
397222c33f
commit
bed1d4ba5e
3 changed files with 85 additions and 15 deletions
|
@ -3,9 +3,9 @@ bin_PROGRAMS = \
|
|||
nfc-list \
|
||||
nfc-mfclassic \
|
||||
nfc-mfultralight \
|
||||
nfc-scan-device \
|
||||
nfc-read-forum-tag3 \
|
||||
nfc-relay-picc
|
||||
nfc-relay-picc \
|
||||
nfc-scan-device
|
||||
|
||||
# set the include path found by configure
|
||||
AM_CPPFLAGS = $(all_includes) $(LIBNFC_CFLAGS)
|
||||
|
@ -30,10 +30,6 @@ nfc_mfclassic_LDADD = $(top_builddir)/libnfc/libnfc.la \
|
|||
nfc_mfultralight_SOURCES = nfc-mfultralight.c mifare.c mifare.h
|
||||
nfc_mfultralight_LDADD = $(top_builddir)/libnfc/libnfc.la
|
||||
|
||||
nfc_scan_device_SOURCES = nfc-scan-device.c
|
||||
nfc_scan_device_LDADD = $(top_builddir)/libnfc/libnfc.la \
|
||||
libnfcutils.la
|
||||
|
||||
nfc_read_forum_tag3_SOURCES = nfc-read-forum-tag3.c
|
||||
nfc_read_forum_tag3_LDADD = $(top_builddir)/libnfc/libnfc.la \
|
||||
libnfcutils.la
|
||||
|
@ -42,11 +38,16 @@ nfc_relay_picc_SOURCES = nfc-relay-picc.c
|
|||
nfc_relay_picc_LDADD = $(top_builddir)/libnfc/libnfc.la \
|
||||
libnfcutils.la
|
||||
|
||||
nfc_scan_device_SOURCES = nfc-scan-device.c
|
||||
nfc_scan_device_LDADD = $(top_builddir)/libnfc/libnfc.la \
|
||||
libnfcutils.la
|
||||
|
||||
dist_man_MANS = \
|
||||
nfc-emulate-forum-tag4.1 \
|
||||
nfc-list.1 \
|
||||
nfc-mfclassic.1 \
|
||||
nfc-mfultralight.1 \
|
||||
nfc-relay-picc.1
|
||||
nfc-relay-picc.1 \
|
||||
nfc-scan-device.1
|
||||
|
||||
EXTRA_DIST = CMakeLists.txt
|
||||
|
|
59
utils/nfc-scan-device.1
Normal file
59
utils/nfc-scan-device.1
Normal file
|
@ -0,0 +1,59 @@
|
|||
.TH nfc-scan-device 1 "October 21, 2012" "libnfc" "NFC Utilities"
|
||||
.SH NAME
|
||||
nfc-scan-device \- Scan NFC devices
|
||||
.SH SYNOPSIS
|
||||
.B nfc-scan-device
|
||||
[
|
||||
.I options
|
||||
]
|
||||
.SH DESCRIPTION
|
||||
.B nfc-scan-device
|
||||
is a utility for listing any available device compliant with libnfc.
|
||||
It can optionnally display device's capabilities.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-v
|
||||
Tells
|
||||
.I
|
||||
nfc-scan-device
|
||||
to be verbose and display detailed information about the devices found.
|
||||
.TP
|
||||
.B \-i
|
||||
Tells
|
||||
.I
|
||||
nfc-scan-device
|
||||
to allow intrusive scan (eg. serial ports scan). This is equivalent to set environment variable LIBNFC_INTRUSIVE_SCAN to "yes".
|
||||
|
||||
.SH EXAMPLE
|
||||
For a SCL3711 device (in verbose mode):
|
||||
|
||||
- ACS / ACR122U PICC Interface:
|
||||
acr122_usb:002:005
|
||||
chip: PN532 v1.4
|
||||
initator mode modulations: ISO/IEC 14443A (106 kbps), FeliCa (424 kbps, 212 kbps), ISO/IEC 14443-4B (106 kbps), Innovision Jewel (106 kbps), D.E.P. (424 kbps, 212 kbps, 106 kbps)
|
||||
target mode modulations: ISO/IEC 14443A (106 kbps), FeliCa (424 kbps, 212 kbps), D.E.P. (424 kbps, 212 kbps, 106 kbps)
|
||||
|
||||
.SH BUGS
|
||||
Please report any bugs on the
|
||||
.B libnfc
|
||||
issue tracker at:
|
||||
.br
|
||||
.BR http://code.google.com/p/libnfc/issues
|
||||
.SH LICENCE
|
||||
.B libnfc
|
||||
is licensed under the GNU Lesser General Public License (LGPL), version 3.
|
||||
.br
|
||||
.B libnfc-utils
|
||||
and
|
||||
.B libnfc-examples
|
||||
are covered by the the BSD 2-Clause license.
|
||||
.SH AUTHORS
|
||||
Roel Verdult <roel@libnfc.org>,
|
||||
.br
|
||||
Romain Tartière <romain@libnfc.org>,
|
||||
.br
|
||||
Romuald Conty <romuald@libnfc.org>.
|
||||
.PP
|
||||
This manual page was written by Romuald Conty <romuald@libnfc.org>.
|
||||
It is licensed under the terms of the GNU GPL (version 2 or later).
|
|
@ -60,16 +60,18 @@
|
|||
static nfc_device *pnd;
|
||||
|
||||
static void
|
||||
print_usage(const char *progname)
|
||||
print_usage(const char *argv[])
|
||||
{
|
||||
printf("usage: %s [-v]\n", progname);
|
||||
printf(" -v\t verbose display\n");
|
||||
printf("Usage: %s [OPTIONS]\n", argv[0]);
|
||||
printf("Options:\n");
|
||||
printf("\t-h\tPrint this help message.\n");
|
||||
printf("\t-v\tSet verbose display.\n");
|
||||
printf("\t-i\tAllow intrusive scan.\n");
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, const char *argv[])
|
||||
{
|
||||
(void) argc;
|
||||
const char *acLibnfcVersion;
|
||||
size_t i;
|
||||
bool verbose = false;
|
||||
|
@ -79,12 +81,20 @@ main(int argc, const char *argv[])
|
|||
// Display libnfc version
|
||||
acLibnfcVersion = nfc_version();
|
||||
printf("%s uses libnfc %s\n", argv[0], acLibnfcVersion);
|
||||
if (argc != 1) {
|
||||
if ((argc == 2) && (0 == strcmp("-v", argv[1]))) {
|
||||
|
||||
// Get commandline options
|
||||
for (int arg = 1; arg < argc; arg++) {
|
||||
if (0 == strcmp(argv[arg], "-h")) {
|
||||
print_usage(argv);
|
||||
return EXIT_SUCCESS;
|
||||
} else if (0 == strcmp(argv[arg], "-v")) {
|
||||
verbose = true;
|
||||
} else if (0 == strcmp(argv[arg], "-i")) {
|
||||
setenv("LIBNFC_INTRUSIVE_SCAN", "yes", 1);
|
||||
} else {
|
||||
print_usage(argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
ERR("%s is not supported option.", argv[arg]);
|
||||
print_usage(argv);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue