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

Commit 0d18ac39 authored by Katish Paran's avatar Katish Paran Committed by Gerrit - the friendly Code Review server
Browse files

diag: Send error response in case for bad packet



Currently, apps diag is not sending error response, in case
packet received from tool is raw and apps diag is in hdlc
enabled mode. Tool needs a response to trigger its recovery
algorithm. This patch ensures that error response is sent in
case for bad packet.

Change-Id: I8048698e215dd72cb4fe964232c942aaa0ae2e33
Signed-off-by: default avatarKatish Paran <kparan@codeaurora.org>
parent 1779195e
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -998,7 +998,17 @@ void diag_process_hdlc_pkt(void *data, unsigned len)
		goto end;
	}

	driver->hdlc_buf_len = 0;
	mutex_unlock(&driver->diag_hdlc_mutex);
	return;

fail:
	/*
	 * Tools needs to get a response in order to start its
	 * recovery algorithm. Send an error response if the
	 * packet is not in expected format.
	 */
	diag_send_error_rsp(driver->hdlc_buf, driver->hdlc_buf_len);
	driver->hdlc_buf_len = 0;
end:
	mutex_unlock(&driver->diag_hdlc_mutex);