aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc/nci/rsp.c
diff options
context:
space:
mode:
authorIlan Elias <ilane@ti.com>2012-01-18 06:16:14 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-01-24 14:32:29 -0500
commit019c4fbaa790e2b3f11dab0c8b7d9896d77db3e5 (patch)
tree593fc051bc96a40e48406f6cba883b1f95822422 /net/nfc/nci/rsp.c
parent25a1d9dc850b1bdcc4760eb625f0a67057f54d26 (diff)
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)
142 nci_req_complete(ndev, status); 142 nci_req_complete(ndev, status);
143} 143}
144 144
145static void nci_rf_disc_select_rsp_packet(struct nci_dev *ndev,
146 struct sk_buff *skb)
147{
148 __u8 status = skb->data[0];
149
150 pr_debug("status 0x%x\n", status);
151
152 /* Complete the request on intf_activated_ntf or generic_error_ntf */
153 if (status != NCI_STATUS_OK)
154 nci_req_complete(ndev, status);
155}
156
145static void nci_rf_deactivate_rsp_packet(struct nci_dev *ndev, 157static void nci_rf_deactivate_rsp_packet(struct nci_dev *ndev,
146 struct sk_buff *skb) 158 struct sk_buff *skb)
147{ 159{
@@ -152,6 +164,7 @@ static void nci_rf_deactivate_rsp_packet(struct nci_dev *ndev,
152 /* If target was active, complete the request only in deactivate_ntf */ 164 /* If target was active, complete the request only in deactivate_ntf */
153 if ((status != NCI_STATUS_OK) || 165 if ((status != NCI_STATUS_OK) ||
154 (atomic_read(&ndev->state) != NCI_POLL_ACTIVE)) { 166 (atomic_read(&ndev->state) != NCI_POLL_ACTIVE)) {
167 nci_clear_target_list(ndev);
155 atomic_set(&ndev->state, NCI_IDLE); 168 atomic_set(&ndev->state, NCI_IDLE);
156 nci_req_complete(ndev, status); 169 nci_req_complete(ndev, status);
157 } 170 }
@@ -190,6 +203,10 @@ void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
190 nci_rf_disc_rsp_packet(ndev, skb); 203 nci_rf_disc_rsp_packet(ndev, skb);
191 break; 204 break;
192 205
206 case NCI_OP_RF_DISCOVER_SELECT_RSP:
207 nci_rf_disc_select_rsp_packet(ndev, skb);
208 break;
209
193 case NCI_OP_RF_DEACTIVATE_RSP: 210 case NCI_OP_RF_DEACTIVATE_RSP:
194 nci_rf_deactivate_rsp_packet(ndev, skb); 211 nci_rf_deactivate_rsp_packet(ndev, skb);
195 break; 212 break;