summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2019-09-21 14:00:15 +0200
committerAleksander Morgado <aleksander@aleksander.es>2019-09-21 14:20:33 +0200
commit54903a86e84df3b9f3d0bec2d3e95d3ef380cb5e (patch)
treec78e1b0ba8384365deddb403a3eca6169d8315fa
parent2aabb1f1831ae9aa9f3fe1325113f2ea420c5708 (diff)
libmbim-glib,device: use realpath basename to look for descriptors file
Fixes https://gitlab.freedesktop.org/mobile-broadband/libmbim/issues/6 (cherry picked from commit b0ede0ce4626353e89387f8bb3ab05b608f2e38d)
-rw-r--r--src/libmbim-glib/mbim-device.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/libmbim-glib/mbim-device.c b/src/libmbim-glib/mbim-device.c
index 113fd36..6d38a39 100644
--- a/src/libmbim-glib/mbim-device.c
+++ b/src/libmbim-glib/mbim-device.c
@@ -862,8 +862,9 @@ get_descriptors_filepath (MbimDevice *self)
GUdevDevice *device = NULL;
GUdevDevice *parent_device = NULL;
GUdevDevice *grandparent_device = NULL;
- gchar *descriptors_path = NULL;
- gchar *device_basename = NULL;
+ gchar *descriptors_path = NULL;
+ gchar *device_basename = NULL;
+ GError *error = NULL;
client = g_udev_client_new (NULL);
if (!G_UDEV_IS_CLIENT (client)) {
@@ -884,7 +885,14 @@ get_descriptors_filepath (MbimDevice *self)
* Which is the one with the descriptors file.
*/
- device_basename = g_path_get_basename (self->priv->path);
+ device_basename = __mbim_utils_get_devname (self->priv->path, &error);
+ if (!device_basename) {
+ g_warning ("[%s] Invalid path for cdc-wdm control port: %s",
+ self->priv->path_display, error->message);
+ g_clear_error (&error);
+ goto out;
+ }
+
device = g_udev_client_query_by_subsystem_and_name (client, "usb", device_basename);
if (!device) {
device = g_udev_client_query_by_subsystem_and_name (client, "usbmisc", device_basename);