Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 328264
b: refs/heads/master
c: ac20683
h: refs/heads/master
v: v3
  • Loading branch information
Ilan Elias authored and Samuel Ortiz committed Sep 24, 2012
1 parent 41c083f commit 470d544
Show file tree
Hide file tree
Showing 3 changed files with 39 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: 7e0352306f6869b442a574a8e691f126c9fe930a
refs/heads/master: ac206838403411e617dbe0e7df1891ee957f1f9a
6 changes: 6 additions & 0 deletions trunk/include/net/nfc/nci.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,11 @@ struct activation_params_nfcb_poll_iso_dep {
__u8 attrib_res[50];
};

struct activation_params_poll_nfc_dep {
__u8 atr_res_len;
__u8 atr_res[63];
};

struct nci_rf_intf_activated_ntf {
__u8 rf_discovery_id;
__u8 rf_interface;
Expand All @@ -374,6 +379,7 @@ struct nci_rf_intf_activated_ntf {
union {
struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep;
struct activation_params_nfcb_poll_iso_dep nfcb_poll_iso_dep;
struct activation_params_poll_nfc_dep poll_nfc_dep;
} activation_params;

} __packed;
Expand Down
32 changes: 32 additions & 0 deletions trunk/net/nfc/nci/ntf.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,33 @@ static int nci_extract_activation_params_iso_dep(struct nci_dev *ndev,
return NCI_STATUS_OK;
}

static int nci_extract_activation_params_nfc_dep(struct nci_dev *ndev,
struct nci_rf_intf_activated_ntf *ntf, __u8 *data)
{
struct activation_params_poll_nfc_dep *poll;
int i;

switch (ntf->activation_rf_tech_and_mode) {
case NCI_NFC_A_PASSIVE_POLL_MODE:
case NCI_NFC_F_PASSIVE_POLL_MODE:
poll = &ntf->activation_params.poll_nfc_dep;
poll->atr_res_len = min_t(__u8, *data++, 63);
pr_debug("atr_res_len %d\n", poll->atr_res_len);
if (poll->atr_res_len > 0) {
for (i = 0; i < poll->atr_res_len; i++)
poll->atr_res[poll->atr_res_len-1-i] = data[i];
}
break;

default:
pr_err("unsupported activation_rf_tech_and_mode 0x%x\n",
ntf->activation_rf_tech_and_mode);
return NCI_STATUS_RF_PROTOCOL_ERROR;
}

return NCI_STATUS_OK;
}

static void nci_target_auto_activated(struct nci_dev *ndev,
struct nci_rf_intf_activated_ntf *ntf)
{
Expand Down Expand Up @@ -454,6 +481,11 @@ static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev,
&ntf, data);
break;

case NCI_RF_INTERFACE_NFC_DEP:
err = nci_extract_activation_params_nfc_dep(ndev,
&ntf, data);
break;

case NCI_RF_INTERFACE_FRAME:
/* no activation params */
break;
Expand Down

0 comments on commit 470d544

Please sign in to comment.