summaryrefslogtreecommitdiffstats
path: root/net/nfc
diff options
context:
space:
mode:
authorChristophe Ricard2015-06-06 13:16:41 +0200
committerSamuel Ortiz2015-06-09 00:34:21 +0200
commit759afb8d288ffbe9a1cdb20af037b5c072dc38b2 (patch)
treedbe0ef72823dab2803d8968068f7757160d734a4 /net/nfc
parentNFC: nci: Add nci init ops for early device initialization (diff)
downloadkernel-qcow2-linux-759afb8d288ffbe9a1cdb20af037b5c072dc38b2.tar.gz
kernel-qcow2-linux-759afb8d288ffbe9a1cdb20af037b5c072dc38b2.tar.xz
kernel-qcow2-linux-759afb8d288ffbe9a1cdb20af037b5c072dc38b2.zip
NFC: nci: Add nci_prop_cmd allowing to send proprietary nci cmd
Handle allowing to send proprietary nci commands anywhere in the nci state machine. Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/nci/core.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index 458e58bb9cb1..b5dc15044466 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -324,6 +324,32 @@ static void nci_rf_deactivate_req(struct nci_dev *ndev, unsigned long opt)
sizeof(struct nci_rf_deactivate_cmd), &cmd);
}
+struct nci_prop_cmd_param {
+ __u16 opcode;
+ size_t len;
+ __u8 *payload;
+};
+
+static void nci_prop_cmd_req(struct nci_dev *ndev, unsigned long opt)
+{
+ struct nci_prop_cmd_param *param = (struct nci_prop_cmd_param *)opt;
+
+ nci_send_cmd(ndev, param->opcode, param->len, param->payload);
+}
+
+int nci_prop_cmd(struct nci_dev *ndev, __u8 oid, size_t len, __u8 *payload)
+{
+ struct nci_prop_cmd_param param;
+
+ param.opcode = nci_opcode_pack(NCI_GID_PROPRIETARY, oid);
+ param.len = len;
+ param.payload = payload;
+
+ return __nci_request(ndev, nci_prop_cmd_req, (unsigned long)&param,
+ msecs_to_jiffies(NCI_CMD_TIMEOUT));
+}
+EXPORT_SYMBOL(nci_prop_cmd);
+
static int nci_open_device(struct nci_dev *ndev)
{
int rc = 0;