Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 340933
b: refs/heads/master
c: da05285
h: refs/heads/master
i:
  340931: 4713eec
v: v3
  • Loading branch information
Arron Wang authored and Samuel Ortiz committed Oct 26, 2012
1 parent 6a1c0cb commit 36670d5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e81076235b46189a776362ec5e4c6626bf1599ff
refs/heads/master: da052850b911dfd0fcd5c8d6308917ebe2edbacf
31 changes: 28 additions & 3 deletions trunk/drivers/nfc/pn544_hci.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ enum pn544_state {
#define PN544_HCI_EVT_RCV_DATA 0x04
#define PN544_HCI_EVT_CONTINUE_MI 0x05

#define PN544_HCI_CMD_ATTREQUEST 0x12
#define PN544_HCI_CMD_CONTINUE_ACTIVATION 0x13

static struct nfc_hci_gate pn544_gates[] = {
Expand Down Expand Up @@ -976,9 +977,33 @@ static int pn544_hci_tm_send(struct nfc_hci_dev *hdev, struct sk_buff *skb)
static int pn544_hci_check_presence(struct nfc_hci_dev *hdev,
struct nfc_target *target)
{
return nfc_hci_send_cmd(hdev, target->hci_reader_gate,
PN544_RF_READER_CMD_PRESENCE_CHECK,
NULL, 0, NULL);
pr_debug("supported protocol %d", target->supported_protocols);
if (target->supported_protocols & (NFC_PROTO_ISO14443_MASK |
NFC_PROTO_ISO14443_B_MASK)) {
return nfc_hci_send_cmd(hdev, target->hci_reader_gate,
PN544_RF_READER_CMD_PRESENCE_CHECK,
NULL, 0, NULL);
} else if (target->supported_protocols & NFC_PROTO_MIFARE_MASK) {
if (target->nfcid1_len != 4 && target->nfcid1_len != 7 &&
target->nfcid1_len != 10)
return -EPROTO;

return nfc_hci_send_cmd(hdev, NFC_HCI_RF_READER_A_GATE,
PN544_RF_READER_CMD_ACTIVATE_NEXT,
target->nfcid1, target->nfcid1_len, NULL);
} else if (target->supported_protocols & NFC_PROTO_JEWEL_MASK) {
return nfc_hci_send_cmd(hdev, target->hci_reader_gate,
PN544_JEWEL_RAW_CMD, NULL, 0, NULL);
} else if (target->supported_protocols & NFC_PROTO_FELICA_MASK) {
return nfc_hci_send_cmd(hdev, PN544_RF_READER_F_GATE,
PN544_FELICA_RAW, NULL, 0, NULL);
} else if (target->supported_protocols & NFC_PROTO_NFC_DEP_MASK) {
return nfc_hci_send_cmd(hdev, target->hci_reader_gate,
PN544_HCI_CMD_ATTREQUEST,
NULL, 0, NULL);
}

return 0;
}

void pn544_hci_event_received(struct nfc_hci_dev *hdev, u8 gate, u8 event,
Expand Down

0 comments on commit 36670d5

Please sign in to comment.