|
28 | 28 |
|
29 | 29 | #include "hci.h" |
30 | 30 |
|
| 31 | +static int nfc_hci_execute_cmd_async(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd, |
| 32 | + const u8 *param, size_t param_len, |
| 33 | + data_exchange_cb_t cb, void *cb_context) |
| 34 | +{ |
| 35 | + pr_debug("exec cmd async through pipe=%d, cmd=%d, plen=%zd\n", pipe, |
| 36 | + cmd, param_len); |
| 37 | + |
| 38 | + /* TODO: Define hci cmd execution delay. Should it be the same |
| 39 | + * for all commands? |
| 40 | + */ |
| 41 | + return nfc_hci_hcp_message_tx(hdev, pipe, NFC_HCI_HCP_COMMAND, cmd, |
| 42 | + param, param_len, cb, cb_context, 3000); |
| 43 | +} |
| 44 | + |
31 | 45 | /* |
32 | 46 | * HCI command execution completion callback. |
33 | 47 | * err will be a standard linux error (may be converted from HCI response) |
@@ -60,7 +74,8 @@ static int nfc_hci_execute_cmd(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd, |
60 | 74 | hcp_ew.exec_complete = false; |
61 | 75 | hcp_ew.result_skb = NULL; |
62 | 76 |
|
63 | | - pr_debug("through pipe=%d, cmd=%d, plen=%zd\n", pipe, cmd, param_len); |
| 77 | + pr_debug("exec cmd sync through pipe=%d, cmd=%d, plen=%zd\n", pipe, |
| 78 | + cmd, param_len); |
64 | 79 |
|
65 | 80 | /* TODO: Define hci cmd execution delay. Should it be the same |
66 | 81 | * for all commands? |
@@ -138,6 +153,23 @@ int nfc_hci_send_cmd(struct nfc_hci_dev *hdev, u8 gate, u8 cmd, |
138 | 153 | } |
139 | 154 | EXPORT_SYMBOL(nfc_hci_send_cmd); |
140 | 155 |
|
| 156 | +int nfc_hci_send_cmd_async(struct nfc_hci_dev *hdev, u8 gate, u8 cmd, |
| 157 | + const u8 *param, size_t param_len, |
| 158 | + data_exchange_cb_t cb, void *cb_context) |
| 159 | +{ |
| 160 | + u8 pipe; |
| 161 | + |
| 162 | + pr_debug("\n"); |
| 163 | + |
| 164 | + pipe = hdev->gate2pipe[gate]; |
| 165 | + if (pipe == NFC_HCI_INVALID_PIPE) |
| 166 | + return -EADDRNOTAVAIL; |
| 167 | + |
| 168 | + return nfc_hci_execute_cmd_async(hdev, pipe, cmd, param, param_len, |
| 169 | + cb, cb_context); |
| 170 | +} |
| 171 | +EXPORT_SYMBOL(nfc_hci_send_cmd_async); |
| 172 | + |
141 | 173 | int nfc_hci_set_param(struct nfc_hci_dev *hdev, u8 gate, u8 idx, |
142 | 174 | const u8 *param, size_t param_len) |
143 | 175 | { |
|
0 commit comments