diff options
author | Arron Wang <arron.wang@intel.com> | 2013-04-22 05:21:04 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-06-13 18:18:58 -0400 |
commit | 9c59844005c22700b36dcdbafeea7956b7f4b174 (patch) | |
tree | 59282befa628c8117f165f3e7ae94a200f7f21a7 /drivers/nfc/pn544 | |
parent | b70727e8a61a8e6b4d818519b03fce2937d0ef40 (diff) |
NFC: pn544: Identify Type F NFC-DEP through NFCID2
NFCID2 is defined as the first 2 manufacturer ID (IDm) bytes.
NFC DEP (NFC peer to peer) devices Type-F NFCID2 must start with
0x01fe according to the NFC Digital Specification.
By checking those first 2 bytes we send the right command either to the
reader gate when NFCID2 != 0x1fe (The NFC tag case) or to the NFCIP1 gate
when seeing an NFC DEP device (The NFC peer to peer case).
Without this fix, Felica (Type F) tags are not properly detected with this
driver.
Signed-off-by: Arron Wang <arron.wang@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc/pn544')
-rw-r--r-- | drivers/nfc/pn544/pn544.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/nfc/pn544/pn544.c b/drivers/nfc/pn544/pn544.c index 9c5f16e7baef..0963de2f6ab0 100644 --- a/drivers/nfc/pn544/pn544.c +++ b/drivers/nfc/pn544/pn544.c | |||
@@ -551,20 +551,25 @@ static int pn544_hci_complete_target_discovered(struct nfc_hci_dev *hdev, | |||
551 | return -EPROTO; | 551 | return -EPROTO; |
552 | } | 552 | } |
553 | 553 | ||
554 | r = nfc_hci_send_cmd(hdev, PN544_RF_READER_F_GATE, | 554 | /* Type F NFC-DEP IDm has prefix 0x01FE */ |
555 | PN544_RF_READER_CMD_ACTIVATE_NEXT, | 555 | if ((uid_skb->data[0] == 0x01) && (uid_skb->data[1] == 0xfe)) { |
556 | uid_skb->data, uid_skb->len, NULL); | 556 | kfree_skb(uid_skb); |
557 | kfree_skb(uid_skb); | 557 | r = nfc_hci_send_cmd(hdev, |
558 | |||
559 | r = nfc_hci_send_cmd(hdev, | ||
560 | PN544_RF_READER_NFCIP1_INITIATOR_GATE, | 558 | PN544_RF_READER_NFCIP1_INITIATOR_GATE, |
561 | PN544_HCI_CMD_CONTINUE_ACTIVATION, | 559 | PN544_HCI_CMD_CONTINUE_ACTIVATION, |
562 | NULL, 0, NULL); | 560 | NULL, 0, NULL); |
563 | if (r < 0) | 561 | if (r < 0) |
564 | return r; | 562 | return r; |
565 | 563 | ||
566 | target->hci_reader_gate = PN544_RF_READER_NFCIP1_INITIATOR_GATE; | 564 | target->supported_protocols = NFC_PROTO_NFC_DEP_MASK; |
567 | target->supported_protocols = NFC_PROTO_NFC_DEP_MASK; | 565 | target->hci_reader_gate = |
566 | PN544_RF_READER_NFCIP1_INITIATOR_GATE; | ||
567 | } else { | ||
568 | r = nfc_hci_send_cmd(hdev, PN544_RF_READER_F_GATE, | ||
569 | PN544_RF_READER_CMD_ACTIVATE_NEXT, | ||
570 | uid_skb->data, uid_skb->len, NULL); | ||
571 | kfree_skb(uid_skb); | ||
572 | } | ||
568 | } else if (target->supported_protocols & NFC_PROTO_ISO14443_MASK) { | 573 | } else if (target->supported_protocols & NFC_PROTO_ISO14443_MASK) { |
569 | /* | 574 | /* |
570 | * TODO: maybe other ISO 14443 require some kind of continue | 575 | * TODO: maybe other ISO 14443 require some kind of continue |