Debian Codegraph @

src/qmi-firmware-update/qfu-utils.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_UTILS_H
24 #define QFU_UTILS_H
25
26 #include "config.h"
27
28 #include <glib.h>
29 #include <gio/gio.h>
30 #include <libqmi-glib.h>
31
32 G_BEGIN_DECLS
33
34 gchar *qfu_utils_str_hex (gconstpointer mem,
35 gsize size,
36 gchar delimiter);
37
38 gchar *qfu_utils_get_firmware_image_unique_id_printable (const GArray *unique_id);
39
40 guint16 qfu_utils_crc16 (const guint8 *buffer,
41 gsize len);
42
43 gboolean qfu_utils_parse_cwe_version_string (const gchar *version,
44 gchar **firmware_version,
45 gchar **config_version,
46 gchar **carrier,
47 GError **error);
48
49 void qfu_utils_new_client_dms (GFile *cdc_wdm_file,
50 guint retries,
51 QmiDeviceOpenFlags device_open_flags,
52 gboolean load_capabilities,
53 GCancellable *cancellable,
54 GAsyncReadyCallback callback,
55 gpointer user_data);
56 gboolean qfu_utils_new_client_dms_finish (GAsyncResult *res,
57 QmiDevice **qmi_device,
58 QmiClientDms **qmi_client,
59 gchar **revision,
60 gboolean *supports_stored_image_management,
61 guint8 *max_storage_index,
62 gboolean *supports_firmware_preference_management,
63 QmiMessageDmsGetFirmwarePreferenceOutput **firmware_preference,
64 QmiMessageDmsSwiGetCurrentFirmwareOutput **current_firmware,
65 GError **error);
66
67 void qfu_utils_power_cycle (QmiClientDms *qmi_client,
68 GCancellable *cancellable,
69 GAsyncReadyCallback callback,
70 gpointer user_data);
71 gboolean qfu_utils_power_cycle_finish (QmiClientDms *qmi_client,
72 GAsyncResult *res,
73 GError **error);
74
75 #if defined MM_RUNTIME_CHECK_ENABLED
76
77 gboolean qfu_utils_modemmanager_running (gboolean *mm_running,
78 GError **error);
79
80 #endif
81
82 G_END_DECLS
83
84 #endif /* QFU_UTILS_H */