Debian Codegraph @

src/qmi-firmware-update/qfu-dload-message.h

raw
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * qmi-firmware-update -- Command line tool to update firmware in QMI devices
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * Copyright (C) 2016 Bjørn Mork <[email protected]>
19 * Copyright (C) 2016 Zodiac Inflight Innovations
20 * Copyright (C) 2016-2017 Aleksander Morgado <[email protected]>
21 */
22
23 #ifndef QFU_DLOAD_MESSAGE_H
24 #define QFU_DLOAD_MESSAGE_H
25
26 #include <glib-object.h>
27 #include <gio/gio.h>
28
29 #include "qfu-image.h"
30
31 G_BEGIN_DECLS
32
33 /* Maximum DLOAD message size */
34 #define QFU_DLOAD_MESSAGE_MAX_SIZE 3
35
36 /*
37 * Most of this is from Josuah Hill's DLOAD tool for iPhone
38 * Some spec is also available in document 80-39912-1 Rev. E DMSS Download Protocol Interface Specification and Operational Description
39 * https://github.com/posixninja/DLOADTool/blob/master/dloadtool/dload.h
40 *
41 * The 0x70 switching command was found by snooping on firmware updates
42 */
43 typedef enum {
44 QFU_DLOAD_CMD_ACK = 0x02,
45 QFU_DLOAD_CMD_NOP = 0x06,
46 QFU_DLOAD_CMD_SDP = 0x70,
47 } QfuDloadCmd;
48
49 /* Request builders */
50
51 gsize qfu_dload_request_sdp_build (guint8 *buffer,
52 gsize buffer_len);
53
54 /* Response parsers */
55
56 gboolean qfu_dload_response_ack_parse (const guint8 *buffer,
57 gsize buffer_len,
58 GError **error);
59
60 G_END_DECLS
61
62 #endif /* QFU_DLOAD_MESSAGE_H */