NFC: hci: Add se_io HCI operand
authorChristophe Ricard <christophe.ricard@gmail.com>
Wed, 12 Nov 2014 23:30:34 +0000 (00:30 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Tue, 2 Dec 2014 00:49:58 +0000 (01:49 +0100)
se_io allows to send apdu over the CLF to the embedded Secure Element.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
include/net/nfc/hci.h
net/nfc/hci/core.c

index 7ee8f4cc610bebecb119ce28566604e1cd6c3f3c..50bc66f0121f3feb838e5293c2611f2736fa426b 100644 (file)
@@ -57,6 +57,9 @@ struct nfc_hci_ops {
        int (*discover_se)(struct nfc_hci_dev *dev);
        int (*enable_se)(struct nfc_hci_dev *dev, u32 se_idx);
        int (*disable_se)(struct nfc_hci_dev *dev, u32 se_idx);
+       int (*se_io)(struct nfc_hci_dev *dev, u32 se_idx,
+                     u8 *apdu, size_t apdu_length,
+                     se_io_cb_t cb, void *cb_context);
 };
 
 /* Pipes */
index 117708263ced38dfa690e1d49a6c19d661751289..58b1610ca545319777b3891025343fbc18cc7f98 100644 (file)
@@ -717,6 +717,19 @@ static int hci_disable_se(struct nfc_dev *nfc_dev, u32 se_idx)
        return 0;
 }
 
+static int hci_se_io(struct nfc_dev *nfc_dev, u32 se_idx,
+                    u8 *apdu, size_t apdu_length,
+                    se_io_cb_t cb, void *cb_context)
+{
+       struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev);
+
+       if (hdev->ops->se_io)
+               return hdev->ops->se_io(hdev, se_idx, apdu,
+                                       apdu_length, cb, cb_context);
+
+       return 0;
+}
+
 static void nfc_hci_failure(struct nfc_hci_dev *hdev, int err)
 {
        mutex_lock(&hdev->msg_tx_mutex);
@@ -830,6 +843,7 @@ static struct nfc_ops hci_nfc_ops = {
        .discover_se = hci_discover_se,
        .enable_se = hci_enable_se,
        .disable_se = hci_disable_se,
+       .se_io = hci_se_io,
 };
 
 struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops,