Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 340930
b: refs/heads/master
c: 928326f
h: refs/heads/master
v: v3
  • Loading branch information
Arron Wang authored and Samuel Ortiz committed Oct 26, 2012
1 parent 57acf66 commit 4a50829
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 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: f7a5f6c532f33ba66a7ca19e81ed447a83dab2db
refs/heads/master: 928326f2237d2dd62b2fb9374c655cd906549868
28 changes: 27 additions & 1 deletion trunk/drivers/nfc/pn544_hci.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ enum pn544_state {
#define PN544_HCI_EVT_RCV_DATA 0x04
#define PN544_HCI_EVT_CONTINUE_MI 0x05

#define PN544_HCI_CMD_CONTINUE_ACTIVATION 0x13

static struct nfc_hci_gate pn544_gates[] = {
{NFC_HCI_ADMIN_GATE, NFC_HCI_INVALID_PIPE},
{NFC_HCI_LOOPBACK_GATE, NFC_HCI_INVALID_PIPE},
Expand Down Expand Up @@ -755,6 +757,9 @@ static int pn544_hci_target_from_gate(struct nfc_hci_dev *hdev, u8 gate,
target->supported_protocols = NFC_PROTO_JEWEL_MASK;
target->sens_res = 0x0c00;
break;
case PN544_RF_READER_NFCIP1_INITIATOR_GATE:
target->supported_protocols = NFC_PROTO_NFC_DEP_MASK;
break;
default:
return -EPROTO;
}
Expand All @@ -769,7 +774,18 @@ static int pn544_hci_complete_target_discovered(struct nfc_hci_dev *hdev,
struct sk_buff *uid_skb;
int r = 0;

if (target->supported_protocols & NFC_PROTO_MIFARE_MASK) {
if (gate == PN544_RF_READER_NFCIP1_INITIATOR_GATE)
return r;

if (target->supported_protocols & NFC_PROTO_NFC_DEP_MASK) {
r = nfc_hci_send_cmd(hdev,
PN544_RF_READER_NFCIP1_INITIATOR_GATE,
PN544_HCI_CMD_CONTINUE_ACTIVATION, NULL, 0, NULL);
if (r < 0)
return r;

target->hci_reader_gate = PN544_RF_READER_NFCIP1_INITIATOR_GATE;
} else if (target->supported_protocols & NFC_PROTO_MIFARE_MASK) {
if (target->nfcid1_len != 4 && target->nfcid1_len != 7 &&
target->nfcid1_len != 10)
return -EPROTO;
Expand All @@ -792,6 +808,16 @@ static int pn544_hci_complete_target_discovered(struct nfc_hci_dev *hdev,
PN544_RF_READER_CMD_ACTIVATE_NEXT,
uid_skb->data, uid_skb->len, NULL);
kfree_skb(uid_skb);

r = nfc_hci_send_cmd(hdev,
PN544_RF_READER_NFCIP1_INITIATOR_GATE,
PN544_HCI_CMD_CONTINUE_ACTIVATION,
NULL, 0, NULL);
if (r < 0)
return r;

target->hci_reader_gate = PN544_RF_READER_NFCIP1_INITIATOR_GATE;
target->supported_protocols = NFC_PROTO_NFC_DEP_MASK;
} else if (target->supported_protocols & NFC_PROTO_ISO14443_MASK) {
/*
* TODO: maybe other ISO 14443 require some kind of continue
Expand Down
4 changes: 3 additions & 1 deletion trunk/net/nfc/hci/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ int nfc_hci_target_discovered(struct nfc_hci_dev *hdev, u8 gate)
break;
}

targets->hci_reader_gate = gate;
/* if driver set the new gate, we will skip the old one */
if (targets->hci_reader_gate == 0x00)
targets->hci_reader_gate = gate;

r = nfc_targets_found(hdev->ndev, targets, 1);

Expand Down

0 comments on commit 4a50829

Please sign in to comment.