/* TODO: Define hci cmd execution delay. Should it be the same * for all commands?
*/ return nfc_hci_hcp_message_tx(hdev, pipe, NFC_HCI_HCP_COMMAND, cmd,
param, param_len, cb, cb_context, MAX_FWI);
}
/* * HCI command execution completion callback. * err will be a standard linux error (may be converted from HCI response) * skb contains the response data and must be disposed, or may be NULL if * an error occurred
*/ staticvoid nfc_hci_execute_cb(void *context, struct sk_buff *skb, int err)
{ struct hcp_exec_waiter *hcp_ew = (struct hcp_exec_waiter *)context;
pr_debug("HCI Cmd completed with result=%d\n", err);
pr_debug("exec cmd sync through pipe=%d, cmd=%d, plen=%zd\n", pipe,
cmd, param_len);
/* TODO: Define hci cmd execution delay. Should it be the same * for all commands?
*/
hcp_ew.exec_result = nfc_hci_hcp_message_tx(hdev, pipe,
NFC_HCI_HCP_COMMAND, cmd,
param, param_len,
nfc_hci_execute_cb, &hcp_ew,
MAX_FWI); if (hcp_ew.exec_result < 0) return hcp_ew.exec_result;
wait_event(ew_wq, hcp_ew.exec_complete == true);
if (hcp_ew.exec_result == 0) { if (skb)
*skb = hcp_ew.result_skb; else
kfree_skb(hcp_ew.result_skb);
}
/* * Execute an hci command sent to gate. * skb will contain response data if success. skb can be NULL if you are not * interested by the response.
*/ int nfc_hci_send_cmd(struct nfc_hci_dev *hdev, u8 gate, u8 cmd, const u8 *param, size_t param_len, struct sk_buff **skb)
{
u8 pipe;
pipe = hdev->gate2pipe[gate]; if (pipe == NFC_HCI_INVALID_PIPE) return -EADDRNOTAVAIL;
int nfc_hci_set_param(struct nfc_hci_dev *hdev, u8 gate, u8 idx, const u8 *param, size_t param_len)
{ int r;
u8 *tmp;
/* TODO ELa: reg idx must be inserted before param, but we don't want * to ask the caller to do it to keep a simpler API. * For now, just create a new temporary param buffer. This is far from * optimal though, and the plan is to modify APIs to pass idx down to * nfc_hci_hcp_message_tx where the frame is actually built, thereby * eliminating the need for the temp allocation-copy here.
*/
r = nfc_hci_execute_cmd(hdev, pipe, NFC_HCI_ANY_OPEN_PIPE,
NULL, 0, &skb); if (r == 0) { /* dest host other than host controller will send * number of pipes already open on this gate before * execution. The number can be found in skb->data[0]
*/
kfree_skb(skb);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.