diff options
author | Christophe Ricard <christophe.ricard@gmail.com> | 2015-02-01 16:26:20 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2015-02-02 15:50:42 -0500 |
commit | 26fc6c7f02cb26c39c4733de3dbc3c0646fc1074 (patch) | |
tree | d651a9bde40c2a44b6ff92b3895d86ed5608b0cc /drivers/nfc | |
parent | 5d1ceb7f5e56aeec0d541a76293ba3de5af78795 (diff) |
NFC: st21nfca: Add HCI transaction event support
The transaction notifies the host (DH) that an action
is required to manage a specific Secure Element application.
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc')
-rw-r--r-- | drivers/nfc/st21nfca/st21nfca_se.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/nfc/st21nfca/st21nfca_se.c b/drivers/nfc/st21nfca/st21nfca_se.c index 9b93d3904ab5..bd13cac9c66a 100644 --- a/drivers/nfc/st21nfca/st21nfca_se.c +++ b/drivers/nfc/st21nfca/st21nfca_se.c | |||
@@ -301,6 +301,8 @@ int st21nfca_connectivity_event_received(struct nfc_hci_dev *hdev, u8 host, | |||
301 | u8 event, struct sk_buff *skb) | 301 | u8 event, struct sk_buff *skb) |
302 | { | 302 | { |
303 | int r = 0; | 303 | int r = 0; |
304 | struct device *dev = &hdev->ndev->dev; | ||
305 | struct nfc_evt_transaction *transaction; | ||
304 | 306 | ||
305 | pr_debug("connectivity gate event: %x\n", event); | 307 | pr_debug("connectivity gate event: %x\n", event); |
306 | 308 | ||
@@ -308,6 +310,25 @@ int st21nfca_connectivity_event_received(struct nfc_hci_dev *hdev, u8 host, | |||
308 | case ST21NFCA_EVT_CONNECTIVITY: | 310 | case ST21NFCA_EVT_CONNECTIVITY: |
309 | break; | 311 | break; |
310 | case ST21NFCA_EVT_TRANSACTION: | 312 | case ST21NFCA_EVT_TRANSACTION: |
313 | if (skb->len < NFC_MIN_AID_LENGTH + 2 && | ||
314 | skb->data[0] != NFC_EVT_TRANSACTION_AID_TAG) | ||
315 | return -EPROTO; | ||
316 | |||
317 | transaction = (struct nfc_evt_transaction *)devm_kzalloc(dev, | ||
318 | skb->len - 2, GFP_KERNEL); | ||
319 | |||
320 | transaction->aid_len = skb->data[1]; | ||
321 | memcpy(transaction->aid, &skb->data[2], skb->data[1]); | ||
322 | |||
323 | if (skb->data[transaction->aid_len + 2] != | ||
324 | NFC_EVT_TRANSACTION_PARAMS_TAG) | ||
325 | return -EPROTO; | ||
326 | |||
327 | transaction->params_len = skb->data[transaction->aid_len + 3]; | ||
328 | memcpy(transaction->params, skb->data + | ||
329 | transaction->aid_len + 4, transaction->params_len); | ||
330 | |||
331 | r = nfc_se_transaction(hdev->ndev, host, transaction); | ||
311 | break; | 332 | break; |
312 | default: | 333 | default: |
313 | return 1; | 334 | return 1; |