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

Commit 98ff416f authored by Christophe Ricard's avatar Christophe Ricard Committed by Samuel Ortiz
Browse files

NFC: nci: Add status byte management in case of error.



The nci status byte was ignored. In case of tag reading for example,
if the tag is removed from the antenna there is no way for the upper
layers (aka: stack) to get inform about such event.

Signed-off-by: default avatarChristophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent aceb32d0
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -185,11 +185,16 @@ int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb)

static void nci_add_rx_data_frag(struct nci_dev *ndev,
				 struct sk_buff *skb,
				 __u8 pbf)
				 __u8 pbf, __u8 status)
{
	int reassembly_len;
	int err = 0;

	if (status) {
		err = status;
		goto exit;
	}

	if (ndev->rx_data_reassembly) {
		reassembly_len = ndev->rx_data_reassembly->len;

@@ -241,6 +246,7 @@ static void nci_add_rx_data_frag(struct nci_dev *ndev,
void nci_rx_data_packet(struct nci_dev *ndev, struct sk_buff *skb)
{
	__u8 pbf = nci_pbf(skb->data);
	__u8 status = 0;

	pr_debug("len %d\n", skb->len);

@@ -258,8 +264,9 @@ void nci_rx_data_packet(struct nci_dev *ndev, struct sk_buff *skb)
	    ndev->target_active_prot == NFC_PROTO_ISO15693) {
		/* frame I/F => remove the status byte */
		pr_debug("frame I/F => remove the status byte\n");
		status = skb->data[skb->len - 1];
		skb_trim(skb, (skb->len - 1));
	}

	nci_add_rx_data_frag(ndev, skb, pbf);
	nci_add_rx_data_frag(ndev, skb, pbf, nci_to_errno(status));
}