diff options
author | Arron Wang <arron.wang@intel.com> | 2012-09-27 05:32:59 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-10-26 12:26:46 -0400 |
commit | da052850b911dfd0fcd5c8d6308917ebe2edbacf (patch) | |
tree | 39b3262facb3644dbdeb7cf4f3cdebb02f4b6b08 /drivers/nfc | |
parent | e81076235b46189a776362ec5e4c6626bf1599ff (diff) |
NFC: Add pn544 presence check for different targets
Signed-off-by: Arron Wang <arron.wang@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc')
-rw-r--r-- | drivers/nfc/pn544_hci.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/drivers/nfc/pn544_hci.c b/drivers/nfc/pn544_hci.c index 554faf0a92d7..b66d4681a577 100644 --- a/drivers/nfc/pn544_hci.c +++ b/drivers/nfc/pn544_hci.c | |||
@@ -118,6 +118,7 @@ enum pn544_state { | |||
118 | #define PN544_HCI_EVT_RCV_DATA 0x04 | 118 | #define PN544_HCI_EVT_RCV_DATA 0x04 |
119 | #define PN544_HCI_EVT_CONTINUE_MI 0x05 | 119 | #define PN544_HCI_EVT_CONTINUE_MI 0x05 |
120 | 120 | ||
121 | #define PN544_HCI_CMD_ATTREQUEST 0x12 | ||
121 | #define PN544_HCI_CMD_CONTINUE_ACTIVATION 0x13 | 122 | #define PN544_HCI_CMD_CONTINUE_ACTIVATION 0x13 |
122 | 123 | ||
123 | static struct nfc_hci_gate pn544_gates[] = { | 124 | static struct nfc_hci_gate pn544_gates[] = { |
@@ -976,9 +977,33 @@ static int pn544_hci_tm_send(struct nfc_hci_dev *hdev, struct sk_buff *skb) | |||
976 | static int pn544_hci_check_presence(struct nfc_hci_dev *hdev, | 977 | static int pn544_hci_check_presence(struct nfc_hci_dev *hdev, |
977 | struct nfc_target *target) | 978 | struct nfc_target *target) |
978 | { | 979 | { |
979 | return nfc_hci_send_cmd(hdev, target->hci_reader_gate, | 980 | pr_debug("supported protocol %d", target->supported_protocols); |
980 | PN544_RF_READER_CMD_PRESENCE_CHECK, | 981 | if (target->supported_protocols & (NFC_PROTO_ISO14443_MASK | |
981 | NULL, 0, NULL); | 982 | NFC_PROTO_ISO14443_B_MASK)) { |
983 | return nfc_hci_send_cmd(hdev, target->hci_reader_gate, | ||
984 | PN544_RF_READER_CMD_PRESENCE_CHECK, | ||
985 | NULL, 0, NULL); | ||
986 | } else if (target->supported_protocols & NFC_PROTO_MIFARE_MASK) { | ||
987 | if (target->nfcid1_len != 4 && target->nfcid1_len != 7 && | ||
988 | target->nfcid1_len != 10) | ||
989 | return -EPROTO; | ||
990 | |||
991 | return nfc_hci_send_cmd(hdev, NFC_HCI_RF_READER_A_GATE, | ||
992 | PN544_RF_READER_CMD_ACTIVATE_NEXT, | ||
993 | target->nfcid1, target->nfcid1_len, NULL); | ||
994 | } else if (target->supported_protocols & NFC_PROTO_JEWEL_MASK) { | ||
995 | return nfc_hci_send_cmd(hdev, target->hci_reader_gate, | ||
996 | PN544_JEWEL_RAW_CMD, NULL, 0, NULL); | ||
997 | } else if (target->supported_protocols & NFC_PROTO_FELICA_MASK) { | ||
998 | return nfc_hci_send_cmd(hdev, PN544_RF_READER_F_GATE, | ||
999 | PN544_FELICA_RAW, NULL, 0, NULL); | ||
1000 | } else if (target->supported_protocols & NFC_PROTO_NFC_DEP_MASK) { | ||
1001 | return nfc_hci_send_cmd(hdev, target->hci_reader_gate, | ||
1002 | PN544_HCI_CMD_ATTREQUEST, | ||
1003 | NULL, 0, NULL); | ||
1004 | } | ||
1005 | |||
1006 | return 0; | ||
982 | } | 1007 | } |
983 | 1008 | ||
984 | void pn544_hci_event_received(struct nfc_hci_dev *hdev, u8 gate, u8 event, | 1009 | void pn544_hci_event_received(struct nfc_hci_dev *hdev, u8 gate, u8 event, |