From: Bjørn Mork Date: Tue, 23 Aug 2016 12:31:05 +0000 (+0200) Subject: uqmi: fix big endian bugs in MBIM code X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=eb1dec7d0dc283a7f61aa574a443a0ab61f8793f;p=oweals%2Fuqmi.git uqmi: fix big endian bugs in MBIM code All MBIM integer fields are 32bit little endian. So we need to convert then all on big endian systems. Fixes: e69bf24b00d8 ("uqmi: add support for MBIM devices with QMI service") Signed-off-by: Bjørn Mork --- diff --git a/mbim.c b/mbim.c index 33ce19d..f5336b1 100644 --- a/mbim.c +++ b/mbim.c @@ -39,12 +39,12 @@ bool is_mbim_qmi(struct mbim_command_message *msg) void mbim_qmi_cmd(struct mbim_command_message *msg, int len, uint16_t tid) { msg->header.type = cpu_to_le32(MBIM_MESSAGE_TYPE_COMMAND); - msg->header.length = sizeof(*msg) + len; + msg->header.length = cpu_to_le32(sizeof(*msg) + len); msg->header.transaction_id = cpu_to_le32(tid); - msg->fragment_header.total = 1; + msg->fragment_header.total = cpu_to_le32(1); msg->fragment_header.current = 0; memcpy(msg->service_id, qmiuuid, 16); msg->command_id = cpu_to_le32(MBIM_CID_QMI_MSG); msg->command_type = cpu_to_le32(MBIM_MESSAGE_COMMAND_TYPE_SET); - msg->buffer_length = len; + msg->buffer_length = cpu_to_le32(len); }