summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Mork <bjorn.no>2015-04-08 13:13:52 +0200
committerBjørn Mork <bjorn@mork.no>2015-04-08 13:13:52 +0200
commit26176214edcc4e7c4002e1f6dbdcc6a9de86de28 (patch)
tree74e015873e53541b1f4745b06a7b65a86431b4b9
parent121f4fa7d2edafb00782540d995a34c27a5e2db8 (diff)
foo
The MBIM specification requires that the InformationBuffer is empty unless the status field is MBIM_STATUS_SUCCESS, except for 4 explicit combinations of status code and command id. Avoid calling the reply handler if the status code is non-zero and the information buffer is empty. Signed-off-by: Bjørn Mork <<A HREF="https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel">bjorn at mork.no</A>>
-rw-r--r--mbim-dev.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mbim-dev.c b/mbim-dev.c
index f4b26eb..c795666 100644
--- a/mbim-dev.c
+++ b/mbim-dev.c
@@ -107,7 +107,10 @@ mbim_recv(struct uloop_fd *u, unsigned int events)
case MBIM_MESSAGE_TYPE_COMMAND_DONE:
if (verbose)
printf(" status_code: %04X\n", le32toh(msg->status_code));
- return_code = current_handler->response(msg->buffer, le32toh(msg->buffer_length));
+ if (msg->status_code && !msg->buffer_length)
+ return_code = -le32toh(msg->status_code);
+ else
+ return_code = current_handler->response(msg->buffer, le32toh(msg->buffer_length));
if (return_code < 0)
no_close = 0;
mbim_send_close_msg();