From 26def72b8eea1e23db05ac439f8c0462627443a4 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Wed, 9 Mar 2022 13:03:10 +0100 Subject: qmi-firmware-update: qfu_helpers_find_peer_port() isn't udev specific --- src/qmi-firmware-update/qfu-helpers-udev.c | 16 ---------------- src/qmi-firmware-update/qfu-helpers-udev.h | 2 -- src/qmi-firmware-update/qfu-helpers.c | 18 ++++++++++++++++++ src/qmi-firmware-update/qfu-helpers.h | 8 +++++++- 4 files changed, 25 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/qmi-firmware-update/qfu-helpers-udev.c b/src/qmi-firmware-update/qfu-helpers-udev.c index 516cdd0e..c9b9fa35 100644 --- a/src/qmi-firmware-update/qfu-helpers-udev.c +++ b/src/qmi-firmware-update/qfu-helpers-udev.c @@ -214,22 +214,6 @@ qfu_helpers_udev_find_by_file_path (const gchar *path, return sysfs_path; } -gchar * -qfu_helpers_udev_find_peer_port (const gchar *sysfs_path, - GError **error) -{ - gchar *tmp, *path; - - tmp = g_build_filename (sysfs_path, "port", "peer", NULL); - path = realpath (tmp, NULL); - g_free (tmp); - if (!path) - return NULL; - - g_debug ("[qfu-udev] peer port for '%s' found: %s", sysfs_path, path); - return path; -} - /******************************************************************************/ static gboolean diff --git a/src/qmi-firmware-update/qfu-helpers-udev.h b/src/qmi-firmware-update/qfu-helpers-udev.h index 7d5a8962..9ee7d0ff 100644 --- a/src/qmi-firmware-update/qfu-helpers-udev.h +++ b/src/qmi-firmware-update/qfu-helpers-udev.h @@ -35,8 +35,6 @@ gchar *qfu_helpers_udev_find_by_file (GFile *file, GError **error); gchar *qfu_helpers_udev_find_by_file_path (const gchar *path, GError **error); -gchar *qfu_helpers_udev_find_peer_port (const gchar *sysfs_path, - GError **error); gchar *qfu_helpers_udev_find_by_device_info (guint16 vid, guint16 pid, guint busnum, diff --git a/src/qmi-firmware-update/qfu-helpers.c b/src/qmi-firmware-update/qfu-helpers.c index 770a8584..36c86811 100644 --- a/src/qmi-firmware-update/qfu-helpers.c +++ b/src/qmi-firmware-update/qfu-helpers.c @@ -37,3 +37,21 @@ qfu_helpers_device_type_to_string (QfuHelpersDeviceType type) { return device_type_str[type]; } + +/******************************************************************************/ + +gchar * +qfu_helpers_find_peer_port (const gchar *sysfs_path, + GError **error) +{ + gchar *tmp, *path; + + tmp = g_build_filename (sysfs_path, "port", "peer", NULL); + path = realpath (tmp, NULL); + g_free (tmp); + if (!path) + return NULL; + + g_debug ("[qfu-helpers] peer port for '%s' found: %s", sysfs_path, path); + return path; +} diff --git a/src/qmi-firmware-update/qfu-helpers.h b/src/qmi-firmware-update/qfu-helpers.h index 8f1e5031..b3b13642 100644 --- a/src/qmi-firmware-update/qfu-helpers.h +++ b/src/qmi-firmware-update/qfu-helpers.h @@ -36,11 +36,17 @@ typedef enum { const gchar *qfu_helpers_device_type_to_string (QfuHelpersDeviceType type); +/******************************************************************************/ + +gchar *qfu_helpers_find_peer_port (const gchar *sysfs_path, + GError **error); + +/******************************************************************************/ + #if defined WITH_UDEV # include "qfu-helpers-udev.h" # define qfu_helpers_find_by_file qfu_helpers_udev_find_by_file # define qfu_helpers_find_by_file_path qfu_helpers_udev_find_by_file_path -# define qfu_helpers_find_peer_port qfu_helpers_udev_find_peer_port # define qfu_helpers_find_by_device_info qfu_helpers_udev_find_by_device_info # define qfu_helpers_list_devices qfu_helpers_udev_list_devices # define qfu_helpers_wait_for_device qfu_helpers_udev_wait_for_device -- cgit v1.2.1