Commit 288e0713 authored by Ilan Elias's avatar Ilan Elias Committed by John W. Linville

NFC: Export a new attribute nfcid1 in target info

The nfcid1 is the NFC-A identifier.
It is exported as an attribute of the target info
(returned as a response to NFC_CMD_GET_TARGET).
Signed-off-by: default avatarIlan Elias <ilane@ti.com>
Acked-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 9931df26
...@@ -88,6 +88,7 @@ enum nfc_commands { ...@@ -88,6 +88,7 @@ enum nfc_commands {
* @NFC_ATTR_TARGET_SENS_RES: NFC-A targets extra information such as NFCID * @NFC_ATTR_TARGET_SENS_RES: NFC-A targets extra information such as NFCID
* @NFC_ATTR_TARGET_SEL_RES: NFC-A targets extra information (useful if the * @NFC_ATTR_TARGET_SEL_RES: NFC-A targets extra information (useful if the
* target is not NFC-Forum compliant) * target is not NFC-Forum compliant)
* @NFC_ATTR_TARGET_NFCID1: NFC-A targets identifier, max 10 bytes
* @NFC_ATTR_COMM_MODE: Passive or active mode * @NFC_ATTR_COMM_MODE: Passive or active mode
* @NFC_ATTR_RF_MODE: Initiator or target * @NFC_ATTR_RF_MODE: Initiator or target
*/ */
...@@ -99,6 +100,7 @@ enum nfc_attrs { ...@@ -99,6 +100,7 @@ enum nfc_attrs {
NFC_ATTR_TARGET_INDEX, NFC_ATTR_TARGET_INDEX,
NFC_ATTR_TARGET_SENS_RES, NFC_ATTR_TARGET_SENS_RES,
NFC_ATTR_TARGET_SEL_RES, NFC_ATTR_TARGET_SEL_RES,
NFC_ATTR_TARGET_NFCID1,
NFC_ATTR_COMM_MODE, NFC_ATTR_COMM_MODE,
NFC_ATTR_RF_MODE, NFC_ATTR_RF_MODE,
/* private: internal use only */ /* private: internal use only */
......
...@@ -65,12 +65,15 @@ struct nfc_ops { ...@@ -65,12 +65,15 @@ struct nfc_ops {
#define NFC_TARGET_IDX_ANY -1 #define NFC_TARGET_IDX_ANY -1
#define NFC_MAX_GT_LEN 48 #define NFC_MAX_GT_LEN 48
#define NFC_MAX_NFCID1_LEN 10
struct nfc_target { struct nfc_target {
u32 idx; u32 idx;
u32 supported_protocols; u32 supported_protocols;
u16 sens_res; u16 sens_res;
u8 sel_res; u8 sel_res;
u8 nfcid1_len;
u8 nfcid1[NFC_MAX_NFCID1_LEN];
}; };
struct nfc_genl_data { struct nfc_genl_data {
......
...@@ -154,6 +154,12 @@ static void nci_target_found(struct nci_dev *ndev, ...@@ -154,6 +154,12 @@ static void nci_target_found(struct nci_dev *ndev,
nfc_tgt.sens_res = ntf->rf_tech_specific_params.nfca_poll.sens_res; nfc_tgt.sens_res = ntf->rf_tech_specific_params.nfca_poll.sens_res;
nfc_tgt.sel_res = ntf->rf_tech_specific_params.nfca_poll.sel_res; nfc_tgt.sel_res = ntf->rf_tech_specific_params.nfca_poll.sel_res;
nfc_tgt.nfcid1_len = ntf->rf_tech_specific_params.nfca_poll.nfcid1_len;
if (nfc_tgt.nfcid1_len > 0) {
memcpy(nfc_tgt.nfcid1,
ntf->rf_tech_specific_params.nfca_poll.nfcid1,
nfc_tgt.nfcid1_len);
}
if (!(nfc_tgt.supported_protocols & ndev->poll_prots)) { if (!(nfc_tgt.supported_protocols & ndev->poll_prots)) {
pr_debug("the target found does not have the desired protocol\n"); pr_debug("the target found does not have the desired protocol\n");
......
...@@ -67,6 +67,9 @@ static int nfc_genl_send_target(struct sk_buff *msg, struct nfc_target *target, ...@@ -67,6 +67,9 @@ static int nfc_genl_send_target(struct sk_buff *msg, struct nfc_target *target,
target->supported_protocols); target->supported_protocols);
NLA_PUT_U16(msg, NFC_ATTR_TARGET_SENS_RES, target->sens_res); NLA_PUT_U16(msg, NFC_ATTR_TARGET_SENS_RES, target->sens_res);
NLA_PUT_U8(msg, NFC_ATTR_TARGET_SEL_RES, target->sel_res); NLA_PUT_U8(msg, NFC_ATTR_TARGET_SEL_RES, target->sel_res);
if (target->nfcid1_len > 0)
NLA_PUT(msg, NFC_ATTR_TARGET_NFCID1, target->nfcid1_len,
target->nfcid1);
return genlmsg_end(msg, hdr); return genlmsg_end(msg, hdr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment