Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8409e428 authored by Christophe Ricard's avatar Christophe Ricard Committed by Samuel Ortiz
Browse files

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: default avatarChristophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 615b524a
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -53,6 +53,8 @@ struct nfc_hci_ops {
			      struct nfc_target *target);
			      struct nfc_target *target);
	int (*event_received)(struct nfc_hci_dev *hdev, u8 pipe, u8 event,
	int (*event_received)(struct nfc_hci_dev *hdev, u8 pipe, u8 event,
			      struct sk_buff *skb);
			      struct sk_buff *skb);
	void (*cmd_received)(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd,
			    struct sk_buff *skb);
	int (*fw_download)(struct nfc_hci_dev *hdev, const char *firmware_name);
	int (*fw_download)(struct nfc_hci_dev *hdev, const char *firmware_name);
	int (*discover_se)(struct nfc_hci_dev *dev);
	int (*discover_se)(struct nfc_hci_dev *dev);
	int (*enable_se)(struct nfc_hci_dev *dev, u32 se_idx);
	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);
#define NFC_HCI_EVT_POST_DATA			0x02
#define NFC_HCI_EVT_POST_DATA			0x02
#define NFC_HCI_EVT_HOT_PLUG			0x03
#define NFC_HCI_EVT_HOT_PLUG			0x03


/* Generic commands */
#define NFC_HCI_ANY_SET_PARAMETER	0x01
#define NFC_HCI_ANY_GET_PARAMETER	0x02
#define NFC_HCI_ANY_OPEN_PIPE		0x03
#define NFC_HCI_ANY_CLOSE_PIPE		0x04

/* Reader RF gates events */
/* Reader RF gates events */
#define NFC_HCI_EVT_READER_REQUESTED	0x10
#define NFC_HCI_EVT_READER_REQUESTED	0x10
#define NFC_HCI_EVT_END_OPERATION	0x11
#define NFC_HCI_EVT_END_OPERATION	0x11
+3 −0
Original line number Original line Diff line number Diff line
@@ -249,6 +249,9 @@ void nfc_hci_cmd_received(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd,
		break;
		break;
	}
	}


	if (hdev->ops->cmd_received)
		hdev->ops->cmd_received(hdev, pipe, cmd, skb);

exit:
exit:
	nfc_hci_hcp_message_tx(hdev, pipe, NFC_HCI_HCP_RESPONSE,
	nfc_hci_hcp_message_tx(hdev, pipe, NFC_HCI_HCP_RESPONSE,
			       status, NULL, 0, NULL, NULL, 0);
			       status, NULL, 0, NULL, NULL, 0);