Debian Codegraph @

src/qmi-firmware-update/qfu-helpers.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 Zodiac Inflight Innovations
19 * Copyright (C) 2016-2017 Aleksander Morgado <[email protected]>
20 */
21
22 #ifndef QFU_HELPERS_H
23 #define QFU_HELPERS_H
24
25 #include "config.h"
26
27 #include <gio/gio.h>
28
29 G_BEGIN_DECLS
30
31 /******************************************************************************/
32
33 typedef enum {
34 QFU_HELPERS_DEVICE_TYPE_TTY,
35 QFU_HELPERS_DEVICE_TYPE_CDC_WDM,
36 QFU_HELPERS_DEVICE_TYPE_LAST
37 } QfuHelpersDeviceType;
38
39 const gchar *qfu_helpers_device_type_to_string (QfuHelpersDeviceType type);
40
41 /******************************************************************************/
42
43 typedef enum {
44 QFU_HELPERS_DEVICE_MODE_UNKNOWN,
45 QFU_HELPERS_DEVICE_MODE_MODEM,
46 QFU_HELPERS_DEVICE_MODE_DOWNLOAD,
47 QFU_HELPERS_DEVICE_MODE_LAST
48 } QfuHelpersDeviceMode;
49
50 const gchar *qfu_helpers_device_mode_to_string (QfuHelpersDeviceMode mode);
51
52 /******************************************************************************/
53
54 gchar *qfu_helpers_find_by_file_path (const gchar *path,
55 GError **error);
56 gchar *qfu_helpers_find_peer_port (const gchar *sysfs_path,
57 GError **error);
58
59 /******************************************************************************/
60
61 #if defined WITH_UDEV
62 # include "qfu-helpers-udev.h"
63 # define qfu_helpers_find_by_file qfu_helpers_udev_find_by_file
64 # define qfu_helpers_find_by_device_info qfu_helpers_udev_find_by_device_info
65 # define qfu_helpers_list_devices qfu_helpers_udev_list_devices
66 # define qfu_helpers_wait_for_device qfu_helpers_udev_wait_for_device
67 # define qfu_helpers_wait_for_device_finish qfu_helpers_udev_wait_for_device_finish
68 #else
69 # include "qfu-helpers-sysfs.h"
70 # define qfu_helpers_find_by_file qfu_helpers_sysfs_find_by_file
71 # define qfu_helpers_find_by_device_info qfu_helpers_sysfs_find_by_device_info
72 # define qfu_helpers_list_devices qfu_helpers_sysfs_list_devices
73 # define qfu_helpers_wait_for_device qfu_helpers_sysfs_wait_for_device
74 # define qfu_helpers_wait_for_device_finish qfu_helpers_sysfs_wait_for_device_finish
75 #endif
76
77 G_END_DECLS
78
79 #endif /* QFU_HELPERS_H */