summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2022-03-09 12:38:54 +0100
committerAleksander Morgado <aleksander@aleksander.es>2022-03-09 12:48:31 +0100
commit7ee33758b11e5d2ccde18bf34338e2a168eae5fd (patch)
tree302759e21e56278b7faf7fd4c45690808ba64bba /src
parent39a5fb6b0fff0cbce42921784a127496e9cad6b0 (diff)
downloadlibqmi-7ee33758b11e5d2ccde18bf34338e2a168eae5fd.tar.gz
qmi-firmware-update: new 'qfu-helpers.c' with the common code
Diffstat (limited to 'src')
-rw-r--r--src/qmi-firmware-update/meson.build1
-rw-r--r--src/qmi-firmware-update/qfu-helpers.c39
-rw-r--r--src/qmi-firmware-update/qfu-udev-helpers.c15
3 files changed, 40 insertions, 15 deletions
diff --git a/src/qmi-firmware-update/meson.build b/src/qmi-firmware-update/meson.build
index 707217b1..11adf179 100644
--- a/src/qmi-firmware-update/meson.build
+++ b/src/qmi-firmware-update/meson.build
@@ -37,6 +37,7 @@ sources = files(
'qfu-at-device.c',
'qfu-device-selection.c',
'qfu-dload-message.c',
+ 'qfu-helpers.c',
'qfu-image.c',
'qfu-image-cwe.c',
'qfu-image-factory.c',
diff --git a/src/qmi-firmware-update/qfu-helpers.c b/src/qmi-firmware-update/qfu-helpers.c
new file mode 100644
index 00000000..770a8584
--- /dev/null
+++ b/src/qmi-firmware-update/qfu-helpers.c
@@ -0,0 +1,39 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * qmi-firmware-update -- Command line tool to update firmware in QMI devices
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright (C) 2016 Zodiac Inflight Innovations
+ * Copyright (C) 2016-2022 Aleksander Morgado <aleksander@aleksander.es>
+ */
+
+#include "config.h"
+#include <stdlib.h>
+#include "qfu-helpers.h"
+
+/******************************************************************************/
+
+static const gchar *device_type_str[] = {
+ [QFU_HELPERS_DEVICE_TYPE_TTY] = "tty",
+ [QFU_HELPERS_DEVICE_TYPE_CDC_WDM] = "cdc-wdm",
+};
+
+G_STATIC_ASSERT (G_N_ELEMENTS (device_type_str) == QFU_HELPERS_DEVICE_TYPE_LAST);
+
+const gchar *
+qfu_helpers_device_type_to_string (QfuHelpersDeviceType type)
+{
+ return device_type_str[type];
+}
diff --git a/src/qmi-firmware-update/qfu-udev-helpers.c b/src/qmi-firmware-update/qfu-udev-helpers.c
index 7faf26cc..6d98052c 100644
--- a/src/qmi-firmware-update/qfu-udev-helpers.c
+++ b/src/qmi-firmware-update/qfu-udev-helpers.c
@@ -33,21 +33,6 @@
/******************************************************************************/
-static const gchar *device_type_str[] = {
- [QFU_HELPERS_DEVICE_TYPE_TTY] = "tty",
- [QFU_HELPERS_DEVICE_TYPE_CDC_WDM] = "cdc-wdm",
-};
-
-G_STATIC_ASSERT (G_N_ELEMENTS (device_type_str) == QFU_HELPERS_DEVICE_TYPE_LAST);
-
-const gchar *
-qfu_helpers_device_type_to_string (QfuHelpersDeviceType type)
-{
- return device_type_str[type];
-}
-
-/******************************************************************************/
-
#if defined WITH_UDEV
static const gchar *tty_subsys_list[] = { "tty", NULL };