forked from openwrt-set/uqmi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mbim.h
56 lines (48 loc) · 1.63 KB
/
mbim.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* Copyright (C) 2014 John Crispin <[email protected]>
* Copyright (C) 2016 Bjørn Mork <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*/
#ifndef _MBIM_H__
#define _MBIM_H__
#include <libubox/utils.h>
#include <stdbool.h>
#include <stdint.h>
#define MBIM_MESSAGE_TYPE_COMMAND 0x00000003
#define MBIM_MESSAGE_TYPE_COMMAND_DONE 0x80000003
#define MBIM_MESSAGE_COMMAND_TYPE_SET 1
#define MBIM_CID_QMI_MSG 1
struct mbim_message_header {
uint32_t type;
uint32_t length;
uint32_t transaction_id;
} __packed;
struct mbim_fragment_header {
uint32_t total;
uint32_t current;
} __packed;
struct mbim_command_message {
struct mbim_message_header header;
struct mbim_fragment_header fragment_header;
uint8_t service_id[16];
uint32_t command_id;
uint32_t command_type;
uint32_t buffer_length;
} __packed;
bool is_mbim_qmi(struct mbim_command_message *msg);
void mbim_qmi_cmd(struct mbim_command_message *msg, int len, uint16_t tid);
#endif