NFC: The core part should generate the target index
The target index can be used by userspace to uniquely identify a target
and thus should be kept unique, per NFC adapter. Moreover, some protocols
do not provide a logical index when discovering new targets, so we have to
generate one for them.
For NCI or pn533 to fetch their logical index, we added a logical_idx field
to the target structure.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index 431a6c5..45f0563 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -79,6 +79,7 @@
u8 sensf_res_len;
u8 sensf_res[NFC_SENSF_RES_MAXSIZE];
u8 hci_reader_gate;
+ u8 logical_idx;
};
struct nfc_genl_data {
@@ -88,6 +89,7 @@
struct nfc_dev {
unsigned idx;
+ unsigned target_idx;
struct nfc_target *targets;
int n_targets;
int targets_generation;