Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 340931
b: refs/heads/master
c: c40d174
h: refs/heads/master
i:
  340929: 57acf66
  340927: 6a2e4a1
v: v3
  • Loading branch information
Arron Wang authored and Samuel Ortiz committed Oct 26, 2012
1 parent 4a50829 commit 4713eec
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 928326f2237d2dd62b2fb9374c655cd906549868
refs/heads/master: c40d17401f89f575a6ff5774abaa0838398b820c
39 changes: 39 additions & 0 deletions trunk/drivers/nfc/pn544_hci.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,43 @@ static int pn544_hci_start_poll(struct nfc_hci_dev *hdev,
return r;
}

static int pn544_hci_dep_link_up(struct nfc_hci_dev *hdev,
struct nfc_target *target, u8 comm_mode,
u8 *gb, size_t gb_len)
{
struct sk_buff *rgb_skb = NULL;
int r;

r = nfc_hci_get_param(hdev, target->hci_reader_gate,
PN544_DEP_ATR_RES, &rgb_skb);
if (r < 0)
return r;

if (rgb_skb->len == 0 || rgb_skb->len > NFC_GB_MAXSIZE) {
r = -EPROTO;
goto exit;
}
print_hex_dump(KERN_DEBUG, "remote gb: ", DUMP_PREFIX_OFFSET,
16, 1, rgb_skb->data, rgb_skb->len, true);

r = nfc_set_remote_general_bytes(hdev->ndev, rgb_skb->data,
rgb_skb->len);

if (r == 0)
r = nfc_dep_link_is_up(hdev->ndev, target->idx, comm_mode,
NFC_RF_INITIATOR);
exit:
kfree_skb(rgb_skb);
return r;
}

static int pn544_hci_dep_link_down(struct nfc_hci_dev *hdev)
{

return nfc_hci_send_event(hdev, PN544_RF_READER_NFCIP1_INITIATOR_GATE,
NFC_HCI_EVT_END_OPERATION, NULL, 0);
}

static int pn544_hci_target_from_gate(struct nfc_hci_dev *hdev, u8 gate,
struct nfc_target *target)
{
Expand Down Expand Up @@ -973,6 +1010,8 @@ static struct nfc_hci_ops pn544_hci_ops = {
.hci_ready = pn544_hci_ready,
.xmit = pn544_hci_xmit,
.start_poll = pn544_hci_start_poll,
.dep_link_up = pn544_hci_dep_link_up,
.dep_link_down = pn544_hci_dep_link_down,
.target_from_gate = pn544_hci_target_from_gate,
.complete_target_discovered = pn544_hci_complete_target_discovered,
.data_exchange = pn544_hci_data_exchange,
Expand Down
3 changes: 3 additions & 0 deletions trunk/include/net/nfc/hci.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ struct nfc_hci_ops {
int (*xmit) (struct nfc_hci_dev *hdev, struct sk_buff *skb);
int (*start_poll) (struct nfc_hci_dev *hdev,
u32 im_protocols, u32 tm_protocols);
int (*dep_link_up)(struct nfc_hci_dev *hdev, struct nfc_target *target,
u8 comm_mode, u8 *gb, size_t gb_len);
int (*dep_link_down)(struct nfc_hci_dev *hdev);
int (*target_from_gate) (struct nfc_hci_dev *hdev, u8 gate,
struct nfc_target *target);
int (*complete_target_discovered) (struct nfc_hci_dev *hdev, u8 gate,
Expand Down
24 changes: 24 additions & 0 deletions trunk/net/nfc/hci/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,28 @@ static void hci_stop_poll(struct nfc_dev *nfc_dev)
NFC_HCI_EVT_END_OPERATION, NULL, 0);
}

static int hci_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target,
__u8 comm_mode, __u8 *gb, size_t gb_len)
{
struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev);

if (hdev->ops->dep_link_up)
return hdev->ops->dep_link_up(hdev, target, comm_mode,
gb, gb_len);

return 0;
}

static int hci_dep_link_down(struct nfc_dev *nfc_dev)
{
struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev);

if (hdev->ops->dep_link_down)
return hdev->ops->dep_link_down(hdev);

return 0;
}

static int hci_activate_target(struct nfc_dev *nfc_dev,
struct nfc_target *target, u32 protocol)
{
Expand Down Expand Up @@ -731,6 +753,8 @@ static struct nfc_ops hci_nfc_ops = {
.dev_down = hci_dev_down,
.start_poll = hci_start_poll,
.stop_poll = hci_stop_poll,
.dep_link_up = hci_dep_link_up,
.dep_link_down = hci_dep_link_down,
.activate_target = hci_activate_target,
.deactivate_target = hci_deactivate_target,
.im_transceive = hci_transceive,
Expand Down

0 comments on commit 4713eec

Please sign in to comment.