From 288e0713f469c03dbc412153b5341d6dfc2c9907 Mon Sep 17 00:00:00 2001 From: Ilan Elias Date: Thu, 22 Dec 2011 11:51:54 +0200 Subject: 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: Ilan Elias Acked-by: Samuel Ortiz Signed-off-by: John W. Linville --- net/nfc/nci/ntf.c | 6 ++++++ net/nfc/netlink.c | 3 +++ 2 files changed, 9 insertions(+) (limited to 'net/nfc') diff --git a/net/nfc/nci/ntf.c b/net/nfc/nci/ntf.c index 352f7a2321d..b16a8dc2afb 100644 --- a/net/nfc/nci/ntf.c +++ b/net/nfc/nci/ntf.c @@ -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.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)) { pr_debug("the target found does not have the desired protocol\n"); diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c index 43a1c47756a..6989dfa28ee 100644 --- a/net/nfc/netlink.c +++ b/net/nfc/netlink.c @@ -67,6 +67,9 @@ static int nfc_genl_send_target(struct sk_buff *msg, struct nfc_target *target, target->supported_protocols); NLA_PUT_U16(msg, NFC_ATTR_TARGET_SENS_RES, target->sens_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); -- cgit v1.2.3