diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2022-03-09 13:20:23 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2022-03-09 13:20:23 +0100 |
commit | 3bb86bc2e49a00bbec2e95298cfe21cfc9bf2299 (patch) | |
tree | 6dfdfb1d128976b0f4475e38086473ecf03fcf64 /src | |
parent | 4c49071f4b39f7b88b2ed91b29d9080edb16967a (diff) | |
download | libqmi-3bb86bc2e49a00bbec2e95298cfe21cfc9bf2299.tar.gz |
qmi-firmware-update: make qfu_helpers_find_by_file_path() generic
It doesn't really depend on the udev backend, as it just calls
qfu_helpers_find_by_file().
Diffstat (limited to 'src')
-rw-r--r-- | src/qmi-firmware-update/qfu-helpers-sysfs.c | 8 | ||||
-rw-r--r-- | src/qmi-firmware-update/qfu-helpers-udev.c | 13 | ||||
-rw-r--r-- | src/qmi-firmware-update/qfu-helpers.c | 13 | ||||
-rw-r--r-- | src/qmi-firmware-update/qfu-helpers.h | 8 |
4 files changed, 17 insertions, 25 deletions
diff --git a/src/qmi-firmware-update/qfu-helpers-sysfs.c b/src/qmi-firmware-update/qfu-helpers-sysfs.c index a8426e9c..ecfd12ca 100644 --- a/src/qmi-firmware-update/qfu-helpers-sysfs.c +++ b/src/qmi-firmware-update/qfu-helpers-sysfs.c @@ -39,14 +39,6 @@ qfu_helpers_sysfs_find_by_file (GFile *file, } gchar * -qfu_helpers_sysfs_find_by_file_path (const gchar *path, - GError **error) -{ - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "not implemented"); - return NULL; -} - -gchar * qfu_helpers_sysfs_find_by_device_info (guint16 vid, guint16 pid, guint busnum, diff --git a/src/qmi-firmware-update/qfu-helpers-udev.c b/src/qmi-firmware-update/qfu-helpers-udev.c index c8a030c2..667ce038 100644 --- a/src/qmi-firmware-update/qfu-helpers-udev.c +++ b/src/qmi-firmware-update/qfu-helpers-udev.c @@ -200,19 +200,6 @@ out: return sysfs_path; } -gchar * -qfu_helpers_udev_find_by_file_path (const gchar *path, - GError **error) -{ - GFile *file; - gchar *sysfs_path; - - file = g_file_new_for_path (path); - sysfs_path = qfu_helpers_udev_find_by_file (file, error); - g_object_unref (file); - return sysfs_path; -} - /******************************************************************************/ static gboolean diff --git a/src/qmi-firmware-update/qfu-helpers.c b/src/qmi-firmware-update/qfu-helpers.c index 36c86811..2ed15dca 100644 --- a/src/qmi-firmware-update/qfu-helpers.c +++ b/src/qmi-firmware-update/qfu-helpers.c @@ -41,6 +41,19 @@ qfu_helpers_device_type_to_string (QfuHelpersDeviceType type) /******************************************************************************/ gchar * +qfu_helpers_find_by_file_path (const gchar *path, + GError **error) +{ + GFile *file; + gchar *sysfs_path; + + file = g_file_new_for_path (path); + sysfs_path = qfu_helpers_find_by_file (file, error); + g_object_unref (file); + return sysfs_path; +} + +gchar * qfu_helpers_find_peer_port (const gchar *sysfs_path, GError **error) { diff --git a/src/qmi-firmware-update/qfu-helpers.h b/src/qmi-firmware-update/qfu-helpers.h index f2202fe9..5a25a37c 100644 --- a/src/qmi-firmware-update/qfu-helpers.h +++ b/src/qmi-firmware-update/qfu-helpers.h @@ -38,15 +38,16 @@ const gchar *qfu_helpers_device_type_to_string (QfuHelpersDeviceType type); /******************************************************************************/ -gchar *qfu_helpers_find_peer_port (const gchar *sysfs_path, - GError **error); +gchar *qfu_helpers_find_by_file_path (const gchar *path, + GError **error); +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_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 @@ -54,7 +55,6 @@ gchar *qfu_helpers_find_peer_port (const gchar *sysfs_path, #else # include "qfu-helpers-sysfs.h" # define qfu_helpers_find_by_file qfu_helpers_sysfs_find_by_file -# define qfu_helpers_find_by_file_path qfu_helpers_sysfs_find_by_file_path # define qfu_helpers_find_by_device_info qfu_helpers_sysfs_find_by_device_info # define qfu_helpers_list_devices qfu_helpers_sysfs_list_devices # define qfu_helpers_wait_for_device qfu_helpers_sysfs_wait_for_device |