[OpenWrt-Devel] Patch to uqmi utility

2019-05-14 Thread Tautvydas Belgeras
Patch fixes utility returning "Unknown error" when generating a request
after a wait of a few minutes
From: Tautvydas Belgeras 

Fix utility returning status "Unknown error" when triggering qmi radio
after a wait of a few minutes

After generating a qmi request, the utility expects a response type message.
In some cases the qmi radio sends a response and an indication type message.
This fix adds a check for incoming message type and drops it if it's not
a response type, because that's what latter parts of the code expect.

Signed-off-by: Tautvydas Belgeras 
---
diff --git a/dev.c b/dev.c
index c25900b..b0c8262 100644
--- a/dev.c
+++ b/dev.c
@@ -101,6 +101,14 @@ static void qmi_process_msg(struct qmi_dev *qmi, struct qmi_msg *msg)
 	uint16_t tid;
 
 	if (msg->qmux.service == QMI_SERVICE_CTL)
+	{
+		if (msg->flags != QMI_CTL_FLAG_RESPONSE)
+			return;
+	}
+	else if (msg->flags != QMI_SERVICE_FLAG_RESPONSE)
+		return;
+
+	if (msg->qmux.service == QMI_SERVICE_CTL)
 		tid = msg->ctl.transaction;
 	else
 		tid = le16_to_cpu(msg->svc.transaction);
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2] uqmi: add explicit check for message type when expecting a response

2019-06-19 Thread Tautvydas Belgeras
When the utility sends a request it expects a response type message,
but does not explicitly check for it. When a device stays idle for
some time, it switches into a sleep mode, and notifies the utility with an
identification type message. In some configurations the device only sends
this identification message when triggered by the utility, in this case by
the request message. What the utility gets is two messages at the same time -
an identification and a response. When it tries to decode former it obviously
fails, because it is not what it expected.

Signed-off-by: Tautvydas Belgeras 
---
 dev.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/dev.c b/dev.c
index a586157..5f6967e 100644
--- a/dev.c
+++ b/dev.c
@@ -79,6 +79,12 @@ static void qmi_process_msg(struct qmi_dev *qmi, struct 
qmi_msg *msg)
struct qmi_request *req;
uint16_t tid;
 
+   if (msg->service == QMI_SERVICE_CTL && msg->flags != 
QMI_SERVICE_FLAG_RESPONSE) {
+   return;
+   } else if (msg->flags != QMI_SERVICE_FLAG_RESPONSE) {
+   return;
+   }
+
if (msg->qmux.service == QMI_SERVICE_CTL)
tid = msg->ctl.transaction;
else
-- 
2.18.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH, v3] uqmi: add explicit check for message type when expecting a response

2019-06-20 Thread Tautvydas Belgeras
When the utility sends a request it expects a response type message,
but does not explicitly check for it. When a device stays idle for
some time, it switches into a sleep mode, and notifies the utility with an
identification type message. In some configurations the device only sends
this identification message when triggered by the utility, in this case by
the request message. What the utility gets is two messages at the same time -
an identification and a response. When it tries to decode former it obviously
fails, because it is not what it expected.

Signed-off-by: Tautvydas Belgeras 
---
 dev.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/dev.c b/dev.c
index a586157..5f6967e 100644
--- a/dev.c
+++ b/dev.c
@@ -79,6 +79,12 @@ static void qmi_process_msg(struct qmi_dev *qmi, struct 
qmi_msg *msg)
struct qmi_request *req;
uint16_t tid;
 
+   if (msg->service == QMI_SERVICE_CTL && msg->flags != 
QMI_CTL_FLAG_RESPONSE) {
+   return;
+   } else if (msg->flags != QMI_SERVICE_FLAG_RESPONSE) {
+   return;
+   }
+
if (msg->qmux.service == QMI_SERVICE_CTL)
tid = msg->ctl.transaction;
else
-- 
2.18.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH, v4] uqmi: add explicit check for message type when expecting a response

2019-06-20 Thread Tautvydas Belgeras
When the utility sends a request it expects a response type message,
but does not explicitly check for it. When a device stays idle for
some time, it switches into a sleep mode, and notifies the utility with an
identification type message. In some configurations the device only sends
this identification message when triggered by the utility, in this case by
the request message. What the utility gets is two messages at the same time -
an identification and a response. When it tries to decode former it obviously
fails, because it is not what it expected.

Signed-off-by: Tautvydas Belgeras 
---
 dev.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/dev.c b/dev.c
index a586157..5f6967e 100644
--- a/dev.c
+++ b/dev.c
@@ -79,6 +79,12 @@ static void qmi_process_msg(struct qmi_dev *qmi, struct 
qmi_msg *msg)
struct qmi_request *req;
uint16_t tid;
 
+   if (msg->flags != QMI_CTL_FLAG_RESPONSE && msg->flags != 
QMI_SERVICE_FLAG_RESPONSE)
+   return;
+
if (msg->qmux.service == QMI_SERVICE_CTL)
tid = msg->ctl.transaction;
else
-- 
2.18.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH, v5] uqmi: add explicit check for message type when expecting a response

2019-06-20 Thread Tautvydas Belgeras
When the utility sends a request it expects a response type message,
but does not explicitly check for it. When a device stays idle for
some time, it switches into a sleep mode, and notifies the utility with an
identification type message. In some configurations the device only sends
this identification message when triggered by the utility, in this case by
the request message. What the utility gets is two messages at the same time -
an identification and a response. When it tries to decode former it obviously
fails, because it is not what it expected.

Signed-off-by: Tautvydas Belgeras 
---
 dev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/dev.c b/dev.c
index 4bca429..bd10207 100644
--- a/dev.c
+++ b/dev.c
@@ -96,6 +96,9 @@ static void qmi_process_msg(struct qmi_dev *qmi, struct 
qmi_msg *msg)
struct qmi_request *req;
uint16_t tid;
 
+   if (msg->flags != QMI_CTL_FLAG_RESPONSE && msg->flags != 
QMI_SERVICE_FLAG_RESPONSE)
+   return;
+
if (msg->qmux.service == QMI_SERVICE_CTL)
tid = msg->ctl.transaction;
else
-- 
2.18.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH, v5] uqmi: add explicit check for message type when expecting a response

2019-06-20 Thread Tautvydas Belgeras
When the utility sends a request it expects a response type message,
but does not explicitly check for it. When a device stays idle for
some time, it switches into a sleep mode, and notifies the utility with an
identification type message. In some configurations the device only sends
this identification message when triggered by the utility, in this case by
the request message. What the utility gets is two messages at the same time -
an identification and a response. When it tries to decode former it obviously
fails, because it is not what it expected.

Signed-off-by: Tautvydas Belgeras 
---
 dev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/dev.c b/dev.c
index 4bca429..bd10207 100644
--- a/dev.c
+++ b/dev.c
@@ -96,6 +96,9 @@ static void qmi_process_msg(struct qmi_dev *qmi, struct 
qmi_msg *msg)
struct qmi_request *req;
uint16_t tid;
 
+   if (msg->flags != QMI_CTL_FLAG_RESPONSE && msg->flags != 
QMI_SERVICE_FLAG_RESPONSE)
+   return;
+
if (msg->qmux.service == QMI_SERVICE_CTL)
tid = msg->ctl.transaction;
else
-- 
2.18.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel