diff options
author | Christophe Ricard <christophe.ricard@gmail.com> | 2015-01-26 19:18:15 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2015-01-27 18:03:34 -0500 |
commit | 8409e4283c1ca62ce107564de7ff93b4dd476d41 (patch) | |
tree | cd9df96187e7a60fa79838fd1fa79cc4027edd11 | |
parent | 615b524aca0bff52ce6654ddf26546546eb02e93 (diff) |
NFC: hci: Add cmd_received handler
When a command is received, it is sometime needed to let the CLF driver do
some additional operations. (ex: count remaining pipe notification...)
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r-- | include/net/nfc/hci.h | 8 | ||||
-rw-r--r-- | net/nfc/hci/core.c | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h index 1d1fd2b98f1e..ab672b537dd4 100644 --- a/include/net/nfc/hci.h +++ b/include/net/nfc/hci.h | |||
@@ -53,6 +53,8 @@ struct nfc_hci_ops { | |||
53 | struct nfc_target *target); | 53 | struct nfc_target *target); |
54 | int (*event_received)(struct nfc_hci_dev *hdev, u8 pipe, u8 event, | 54 | int (*event_received)(struct nfc_hci_dev *hdev, u8 pipe, u8 event, |
55 | struct sk_buff *skb); | 55 | struct sk_buff *skb); |
56 | void (*cmd_received)(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd, | ||
57 | struct sk_buff *skb); | ||
56 | int (*fw_download)(struct nfc_hci_dev *hdev, const char *firmware_name); | 58 | int (*fw_download)(struct nfc_hci_dev *hdev, const char *firmware_name); |
57 | int (*discover_se)(struct nfc_hci_dev *dev); | 59 | int (*discover_se)(struct nfc_hci_dev *dev); |
58 | int (*enable_se)(struct nfc_hci_dev *dev, u32 se_idx); | 60 | int (*enable_se)(struct nfc_hci_dev *dev, u32 se_idx); |
@@ -230,6 +232,12 @@ void nfc_hci_reset_pipes_per_host(struct nfc_hci_dev *hdev, u8 host); | |||
230 | #define NFC_HCI_EVT_POST_DATA 0x02 | 232 | #define NFC_HCI_EVT_POST_DATA 0x02 |
231 | #define NFC_HCI_EVT_HOT_PLUG 0x03 | 233 | #define NFC_HCI_EVT_HOT_PLUG 0x03 |
232 | 234 | ||
235 | /* Generic commands */ | ||
236 | #define NFC_HCI_ANY_SET_PARAMETER 0x01 | ||
237 | #define NFC_HCI_ANY_GET_PARAMETER 0x02 | ||
238 | #define NFC_HCI_ANY_OPEN_PIPE 0x03 | ||
239 | #define NFC_HCI_ANY_CLOSE_PIPE 0x04 | ||
240 | |||
233 | /* Reader RF gates events */ | 241 | /* Reader RF gates events */ |
234 | #define NFC_HCI_EVT_READER_REQUESTED 0x10 | 242 | #define NFC_HCI_EVT_READER_REQUESTED 0x10 |
235 | #define NFC_HCI_EVT_END_OPERATION 0x11 | 243 | #define NFC_HCI_EVT_END_OPERATION 0x11 |
diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c index a664a67dff1c..6e061da2258a 100644 --- a/net/nfc/hci/core.c +++ b/net/nfc/hci/core.c | |||
@@ -249,6 +249,9 @@ void nfc_hci_cmd_received(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd, | |||
249 | break; | 249 | break; |
250 | } | 250 | } |
251 | 251 | ||
252 | if (hdev->ops->cmd_received) | ||
253 | hdev->ops->cmd_received(hdev, pipe, cmd, skb); | ||
254 | |||
252 | exit: | 255 | exit: |
253 | nfc_hci_hcp_message_tx(hdev, pipe, NFC_HCI_HCP_RESPONSE, | 256 | nfc_hci_hcp_message_tx(hdev, pipe, NFC_HCI_HCP_RESPONSE, |
254 | status, NULL, 0, NULL, NULL, 0); | 257 | status, NULL, 0, NULL, NULL, 0); |