nfc_list_devices() function returns now the number of devices found.
This commit is contained in:
parent
00818e048c
commit
1ec504e163
12 changed files with 23 additions and 34 deletions
|
|
@ -63,11 +63,10 @@ main (int argc, const char *argv[])
|
|||
{
|
||||
uint8_t abtRx[MAX_FRAME_LEN];
|
||||
int szRx;
|
||||
size_t szDeviceFound;
|
||||
uint8_t abtTx[] = "Hello Mars!";
|
||||
#define MAX_DEVICE_COUNT 2
|
||||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
nfc_list_devices (connstrings, MAX_DEVICE_COUNT, &szDeviceFound);
|
||||
size_t szDeviceFound = nfc_list_devices (connstrings, MAX_DEVICE_COUNT);
|
||||
// Little hack to allow using nfc-dep-initiator & nfc-dep-target from
|
||||
// the same machine: if there is more than one readers connected
|
||||
// nfc-dep-target will connect to the second reader
|
||||
|
|
|
|||
|
|
@ -82,7 +82,6 @@ main (int argc, char *argv[])
|
|||
{
|
||||
int arg;
|
||||
bool quiet_output = false;
|
||||
size_t szFound;
|
||||
const char *acLibnfcVersion = nfc_version ();
|
||||
|
||||
// Get commandline options
|
||||
|
|
@ -110,7 +109,7 @@ main (int argc, char *argv[])
|
|||
|
||||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
// List available devices
|
||||
nfc_list_devices (connstrings, MAX_DEVICE_COUNT, &szFound);
|
||||
size_t szFound = nfc_list_devices (connstrings, MAX_DEVICE_COUNT);
|
||||
|
||||
if (szFound < 2) {
|
||||
ERR ("%zd device found but two connected devices are needed to relay NFC.", szFound);
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@
|
|||
int
|
||||
main (int argc, const char *argv[])
|
||||
{
|
||||
size_t szFound;
|
||||
size_t i;
|
||||
nfc_device *pnd;
|
||||
const char *acLibnfcVersion;
|
||||
|
|
@ -73,7 +72,7 @@ main (int argc, const char *argv[])
|
|||
printf ("%s uses libnfc %s\n", argv[0], acLibnfcVersion);
|
||||
|
||||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
nfc_list_devices (connstrings, MAX_DEVICE_COUNT, &szFound);
|
||||
size_t szFound = nfc_list_devices (connstrings, MAX_DEVICE_COUNT);
|
||||
|
||||
if (szFound == 0) {
|
||||
printf ("No NFC device found.\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue