summaryrefslogtreecommitdiff
path: root/net/nfc/nci/rsp.c
diff options
context:
space:
mode:
authorIlan Elias <ilane@ti.com>2012-01-18 15:16:14 +0400
committerJohn W. Linville <linville@tuxdriver.com>2012-01-24 23:32:29 +0400
commit019c4fbaa790e2b3f11dab0c8b7d9896d77db3e5 (patch)
tree593fc051bc96a40e48406f6cba883b1f95822422 /net/nfc/nci/rsp.c
parent25a1d9dc850b1bdcc4760eb625f0a67057f54d26 (diff)
downloadlinux-019c4fbaa790e2b3f11dab0c8b7d9896d77db3e5.tar.xz
NFC: Add NCI multiple targets support
Add the ability to select between multiple targets in NCI. If only one target is found, it will be auto-activated. If more than one target is found, then DISCOVER_NTF will be generated for each target, and the host should select one by calling DISCOVER_SELECT_CMD. Then, the target will be activated. If the activation fails, GENERIC_ERROR_NTF is generated. Signed-off-by: Ilan Elias <ilane@ti.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/nfc/nci/rsp.c')
-rw-r--r--net/nfc/nci/rsp.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/net/nfc/nci/rsp.c b/net/nfc/nci/rsp.c
index cb8bce6899cf..aa63b1e99188 100644
--- a/net/nfc/nci/rsp.c
+++ b/net/nfc/nci/rsp.c
@@ -142,6 +142,18 @@ static void nci_rf_disc_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
nci_req_complete(ndev, status);
}
+static void nci_rf_disc_select_rsp_packet(struct nci_dev *ndev,
+ struct sk_buff *skb)
+{
+ __u8 status = skb->data[0];
+
+ pr_debug("status 0x%x\n", status);
+
+ /* Complete the request on intf_activated_ntf or generic_error_ntf */
+ if (status != NCI_STATUS_OK)
+ nci_req_complete(ndev, status);
+}
+
static void nci_rf_deactivate_rsp_packet(struct nci_dev *ndev,
struct sk_buff *skb)
{
@@ -152,6 +164,7 @@ static void nci_rf_deactivate_rsp_packet(struct nci_dev *ndev,
/* If target was active, complete the request only in deactivate_ntf */
if ((status != NCI_STATUS_OK) ||
(atomic_read(&ndev->state) != NCI_POLL_ACTIVE)) {
+ nci_clear_target_list(ndev);
atomic_set(&ndev->state, NCI_IDLE);
nci_req_complete(ndev, status);
}
@@ -190,6 +203,10 @@ void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
nci_rf_disc_rsp_packet(ndev, skb);
break;
+ case NCI_OP_RF_DISCOVER_SELECT_RSP:
+ nci_rf_disc_select_rsp_packet(ndev, skb);
+ break;
+
case NCI_OP_RF_DEACTIVATE_RSP:
nci_rf_deactivate_rsp_packet(ndev, skb);
break;