nfcip-target: add an hack to allow to use two devices on the same machine. (Thanks to Phil)
This commit is contained in:
parent
7a7687b3b8
commit
15f3609eaf
1 changed files with 15 additions and 1 deletions
|
@ -38,8 +38,22 @@ main (int argc, const char *argv[])
|
|||
{
|
||||
byte_t abtRecv[MAX_FRAME_LEN];
|
||||
size_t szRecvBits;
|
||||
size_t szDeviceFound;
|
||||
byte_t send[] = "Hello Mars!";
|
||||
nfc_device_t *pnd = nfc_connect (NULL);
|
||||
nfc_device_t *pnd;
|
||||
#define MAX_DEVICE_COUNT 2
|
||||
nfc_device_desc_t pnddDevices[MAX_DEVICE_COUNT];
|
||||
nfc_list_devices (pnddDevices, MAX_DEVICE_COUNT, &szDeviceFound);
|
||||
# Little hack to allow using nfcip-initiator & nfcip-target from
|
||||
# the same machine: if there is more than one readers connected
|
||||
# nfcip-target will connect to the second reader
|
||||
# (we hope they're always detected in the same order)
|
||||
if (szDeviceFound == 1) {
|
||||
pnd = nfc_connect (&(pnddDevices[0]));
|
||||
}
|
||||
else if (szDeviceFound > 1) {
|
||||
pnd = nfc_connect (&(pnddDevices[1]));
|
||||
}
|
||||
|
||||
if (argc > 1) {
|
||||
errx (1, "usage: %s", argv[0]);
|
||||
|
|
Loading…
Reference in a new issue