NFC: st21nfcb: 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>
This commit is contained in:
parent
6095b0f07d
commit
5d1ceb7f5e
1 changed files with 22 additions and 1 deletions
|
@ -311,14 +311,35 @@ static int st21nfcb_hci_connectivity_event_received(struct nci_dev *ndev,
|
||||||
struct sk_buff *skb)
|
struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
struct device *dev = &ndev->nfc_dev->dev;
|
||||||
|
struct nfc_evt_transaction *transaction;
|
||||||
|
|
||||||
pr_debug("connectivity gate event: %x\n", event);
|
pr_debug("connectivity gate event: %x\n", event);
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case ST21NFCB_EVT_CONNECTIVITY:
|
case ST21NFCB_EVT_CONNECTIVITY:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ST21NFCB_EVT_TRANSACTION:
|
case ST21NFCB_EVT_TRANSACTION:
|
||||||
break;
|
if (skb->len < NFC_MIN_AID_LENGTH + 2 &&
|
||||||
|
skb->data[0] != NFC_EVT_TRANSACTION_AID_TAG)
|
||||||
|
return -EPROTO;
|
||||||
|
|
||||||
|
transaction = (struct nfc_evt_transaction *)devm_kzalloc(dev,
|
||||||
|
skb->len - 2, GFP_KERNEL);
|
||||||
|
|
||||||
|
transaction->aid_len = skb->data[1];
|
||||||
|
memcpy(transaction->aid, &skb->data[2], skb->data[1]);
|
||||||
|
|
||||||
|
if (skb->data[transaction->aid_len + 2] !=
|
||||||
|
NFC_EVT_TRANSACTION_PARAMS_TAG)
|
||||||
|
return -EPROTO;
|
||||||
|
|
||||||
|
transaction->params_len = skb->data[transaction->aid_len + 3];
|
||||||
|
memcpy(transaction->params, skb->data +
|
||||||
|
transaction->aid_len + 4, transaction->params_len);
|
||||||
|
|
||||||
|
r = nfc_se_transaction(ndev->nfc_dev, host, transaction);
|
||||||
default:
|
default:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue