Op 19 jun. 2019, om 11:41 heeft Tautvydas Belgeras <tautvyda...@8devices.com> 
het volgende geschreven:
> 
> 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 <tautvyda...@8devices.com>
> ---
> 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;
> +     }
> +
After return no use exists for the else clause, so this is the same:
+       if (msg->service == QMI_SERVICE_CTL && msg->flags != 
QMI_SERVICE_FLAG_RESPONSE) {
+               return;
+       }
+       if (msg->flags != QMI_SERVICE_FLAG_RESPONSE) {
+               return;
+       }

As the test on msg->service is also superfluous, the above can again be 
simplified to:
+       if (msg->flags != QMI_SERVICE_FLAG_RESPONSE) {
+               return;
+       }

If that's not correct, then the original cannot be either.


>       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 mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to