aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorIlan Elias <ilane@ti.com>2012-08-15 04:46:23 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-09-24 18:17:23 -0400
commitac206838403411e617dbe0e7df1891ee957f1f9a (patch)
treec71cced20fcdac75ae4d0e2f7925965f54289485 /net
parent7e0352306f6869b442a574a8e691f126c9fe930a (diff)
NFC: Parse NCI NFC-DEP activation params
Signed-off-by: Ilan Elias <ilane@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/nfc/nci/ntf.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/net/nfc/nci/ntf.c b/net/nfc/nci/ntf.c
index af7a93b0439..6e17661a41a 100644
--- a/net/nfc/nci/ntf.c
+++ b/net/nfc/nci/ntf.c
@@ -361,6 +361,33 @@ static int nci_extract_activation_params_iso_dep(struct nci_dev *ndev,
361 return NCI_STATUS_OK; 361 return NCI_STATUS_OK;
362} 362}
363 363
364static int nci_extract_activation_params_nfc_dep(struct nci_dev *ndev,
365 struct nci_rf_intf_activated_ntf *ntf, __u8 *data)
366{
367 struct activation_params_poll_nfc_dep *poll;
368 int i;
369
370 switch (ntf->activation_rf_tech_and_mode) {
371 case NCI_NFC_A_PASSIVE_POLL_MODE:
372 case NCI_NFC_F_PASSIVE_POLL_MODE:
373 poll = &ntf->activation_params.poll_nfc_dep;
374 poll->atr_res_len = min_t(__u8, *data++, 63);
375 pr_debug("atr_res_len %d\n", poll->atr_res_len);
376 if (poll->atr_res_len > 0) {
377 for (i = 0; i < poll->atr_res_len; i++)
378 poll->atr_res[poll->atr_res_len-1-i] = data[i];
379 }
380 break;
381
382 default:
383 pr_err("unsupported activation_rf_tech_and_mode 0x%x\n",
384 ntf->activation_rf_tech_and_mode);
385 return NCI_STATUS_RF_PROTOCOL_ERROR;
386 }
387
388 return NCI_STATUS_OK;
389}
390
364static void nci_target_auto_activated(struct nci_dev *ndev, 391static void nci_target_auto_activated(struct nci_dev *ndev,
365 struct nci_rf_intf_activated_ntf *ntf) 392 struct nci_rf_intf_activated_ntf *ntf)
366{ 393{
@@ -454,6 +481,11 @@ static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev,
454 &ntf, data); 481 &ntf, data);
455 break; 482 break;
456 483
484 case NCI_RF_INTERFACE_NFC_DEP:
485 err = nci_extract_activation_params_nfc_dep(ndev,
486 &ntf, data);
487 break;
488
457 case NCI_RF_INTERFACE_FRAME: 489 case NCI_RF_INTERFACE_FRAME:
458 /* no activation params */ 490 /* no activation params */
459 break; 491 break;