Commit 9c598440 authored by Arron Wang's avatar Arron Wang Committed by Samuel Ortiz

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: default avatarArron Wang <arron.wang@intel.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent b70727e8
...@@ -551,20 +551,25 @@ static int pn544_hci_complete_target_discovered(struct nfc_hci_dev *hdev, ...@@ -551,20 +551,25 @@ static int pn544_hci_complete_target_discovered(struct nfc_hci_dev *hdev,
return -EPROTO; return -EPROTO;
} }
r = nfc_hci_send_cmd(hdev, PN544_RF_READER_F_GATE, /* Type F NFC-DEP IDm has prefix 0x01FE */
PN544_RF_READER_CMD_ACTIVATE_NEXT, if ((uid_skb->data[0] == 0x01) && (uid_skb->data[1] == 0xfe)) {
uid_skb->data, uid_skb->len, NULL); kfree_skb(uid_skb);
kfree_skb(uid_skb); r = nfc_hci_send_cmd(hdev,
r = nfc_hci_send_cmd(hdev,
PN544_RF_READER_NFCIP1_INITIATOR_GATE, PN544_RF_READER_NFCIP1_INITIATOR_GATE,
PN544_HCI_CMD_CONTINUE_ACTIVATION, PN544_HCI_CMD_CONTINUE_ACTIVATION,
NULL, 0, NULL); NULL, 0, NULL);
if (r < 0) if (r < 0)
return r; return r;
target->hci_reader_gate = PN544_RF_READER_NFCIP1_INITIATOR_GATE; target->supported_protocols = NFC_PROTO_NFC_DEP_MASK;
target->supported_protocols = NFC_PROTO_NFC_DEP_MASK; target->hci_reader_gate =
PN544_RF_READER_NFCIP1_INITIATOR_GATE;
} else {
r = nfc_hci_send_cmd(hdev, PN544_RF_READER_F_GATE,
PN544_RF_READER_CMD_ACTIVATE_NEXT,
uid_skb->data, uid_skb->len, NULL);
kfree_skb(uid_skb);
}
} else if (target->supported_protocols & NFC_PROTO_ISO14443_MASK) { } else if (target->supported_protocols & NFC_PROTO_ISO14443_MASK) {
/* /*
* TODO: maybe other ISO 14443 require some kind of continue * TODO: maybe other ISO 14443 require some kind of continue
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment