aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc/hci
diff options
context:
space:
mode:
authorEric Lapuyade <eric.lapuyade@intel.com>2012-07-12 14:27:54 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-07-12 14:48:41 -0400
commit81b3039557faf1359f40494003aaade745de6c24 (patch)
tree7eaccb11fcdb6ea7ff0c1ecb7de58dc8a5a3cdf8 /net/nfc/hci
parentfe020120cb863ba918c6d603345342a880272c4d (diff)
NFC: Set target nfcid1 for all HCI reader A targets
Without the discovered target nfcid1 and its length set properly, type 2 tags detection fails with the pn544 as it checks for them from pn544_hci_complete_target_discovered(). Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Reported-by: Mathias Jeppsson <mathias.jeppsson@sonymobile.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/nfc/hci')
-rw-r--r--net/nfc/hci/core.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c
index da6e039c8606..4896ef13f83d 100644
--- a/net/nfc/hci/core.c
+++ b/net/nfc/hci/core.c
@@ -170,6 +170,7 @@ static int nfc_hci_target_discovered(struct nfc_hci_dev *hdev, u8 gate)
170 struct nfc_target *targets; 170 struct nfc_target *targets;
171 struct sk_buff *atqa_skb = NULL; 171 struct sk_buff *atqa_skb = NULL;
172 struct sk_buff *sak_skb = NULL; 172 struct sk_buff *sak_skb = NULL;
173 struct sk_buff *uid_skb = NULL;
173 int r; 174 int r;
174 175
175 pr_debug("from gate %d\n", gate); 176 pr_debug("from gate %d\n", gate);
@@ -205,6 +206,19 @@ static int nfc_hci_target_discovered(struct nfc_hci_dev *hdev, u8 gate)
205 targets->sens_res = be16_to_cpu(*(u16 *)atqa_skb->data); 206 targets->sens_res = be16_to_cpu(*(u16 *)atqa_skb->data);
206 targets->sel_res = sak_skb->data[0]; 207 targets->sel_res = sak_skb->data[0];
207 208
209 r = nfc_hci_get_param(hdev, NFC_HCI_RF_READER_A_GATE,
210 NFC_HCI_RF_READER_A_UID, &uid_skb);
211 if (r < 0)
212 goto exit;
213
214 if (uid_skb->len == 0 || uid_skb->len > NFC_NFCID1_MAXSIZE) {
215 r = -EPROTO;
216 goto exit;
217 }
218
219 memcpy(targets->nfcid1, uid_skb->data, uid_skb->len);
220 targets->nfcid1_len = uid_skb->len;
221
208 if (hdev->ops->complete_target_discovered) { 222 if (hdev->ops->complete_target_discovered) {
209 r = hdev->ops->complete_target_discovered(hdev, gate, 223 r = hdev->ops->complete_target_discovered(hdev, gate,
210 targets); 224 targets);
@@ -240,6 +254,7 @@ exit:
240 kfree(targets); 254 kfree(targets);
241 kfree_skb(atqa_skb); 255 kfree_skb(atqa_skb);
242 kfree_skb(sak_skb); 256 kfree_skb(sak_skb);
257 kfree_skb(uid_skb);
243 258
244 return r; 259 return r;
245} 260}