Hello community, here is the log from the commit of package libmbim for openSUSE:Factory checked in at 2019-11-11 12:58:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libmbim (Old) and /work/SRC/openSUSE:Factory/.libmbim.new.2990 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libmbim" Mon Nov 11 12:58:41 2019 rev:21 rq:746093 version:1.20.2 Changes: -------- --- /work/SRC/openSUSE:Factory/libmbim/libmbim.changes 2019-09-18 13:07:01.212745681 +0200 +++ /work/SRC/openSUSE:Factory/.libmbim.new.2990/libmbim.changes 2019-11-11 12:58:42.345583278 +0100 @@ -1,0 +2,10 @@ +Wed Nov 6 20:34:29 UTC 2019 - Martin Hauke <mar...@gmx.de> + +- Update to version 1.20.2: + + mbim-proxy: + - Fixed device control port management when using symlinks. + + libmbim-glib: + - Fixed handling of fragmented indication messages. + + Several other minor improvements and fixes. + +------------------------------------------------------------------- Old: ---- libmbim-1.20.0.tar.xz New: ---- libmbim-1.20.2.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libmbim.spec ++++++ --- /var/tmp/diff_new_pack.ZgSBGY/_old 2019-11-11 12:58:43.477584476 +0100 +++ /var/tmp/diff_new_pack.ZgSBGY/_new 2019-11-11 12:58:43.477584476 +0100 @@ -18,7 +18,7 @@ Name: libmbim -Version: 1.20.0 +Version: 1.20.2 Release: 0 Summary: Mobile Broadband Interface Model (MBIM) protocol License: GPL-2.0-or-later AND LGPL-2.0-or-later ++++++ libmbim-1.20.0.tar.xz -> libmbim-1.20.2.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmbim-1.20.0/ChangeLog new/libmbim-1.20.2/ChangeLog --- old/libmbim-1.20.0/ChangeLog 2019-09-06 14:08:43.000000000 +0200 +++ new/libmbim-1.20.2/ChangeLog 2019-11-06 12:13:37.000000000 +0100 @@ -1,3 +1,101 @@ +commit 824812a906940884a0fab909d86734a65173f46c +Author: Aleksander Morgado <aleksan...@aleksander.es> +Date: Wed Nov 6 12:10:35 2019 +0100 + + release: bump version to 1.20.2 + + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit ce41a4f3cbe7095a1ae366970d4cd9a21f4d1e20 +Author: Aleksander Morgado <aleksan...@aleksander.es> +Date: Wed Nov 6 12:10:25 2019 +0100 + + NEWS: update for 1.20.2 + + NEWS | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +commit 927beffed739af071ab68e4e91a191dde2ed51be +Author: Aleksander Morgado <aleksan...@aleksander.es> +Date: Mon Nov 4 10:36:09 2019 +0100 + + libmbim-glib,device: fix handling of fragmented indication messages + + The transactions for the fragmented indication messages were being + stored in the "host" type transaction hashtable, instead of in the + "modem" type transaction hashtable. + + Fixes https://gitlab.freedesktop.org/mobile-broadband/libmbim/issues/8 + + (cherry picked from commit eceb6b70ad74dc5c346561c382cb02795b4870f6) + + src/libmbim-glib/mbim-device.c | 20 ++++++++++++++------ + 1 file changed, 14 insertions(+), 6 deletions(-) + +commit 3f0139cf945f78d88b3147835e366078dd7d8434 +Author: Aleksander Morgado <aleksan...@aleksander.es> +Date: Sat Sep 21 14:38:28 2019 +0200 + + libmbim-glib,proxy: plug memleak + + (cherry picked from commit 0bbe65cc3b4bd1321dc6e14dfe74b963ef8ba257) + + src/libmbim-glib/mbim-proxy.c | 2 ++ + 1 file changed, 2 insertions(+) + +commit 1b24dd3dda3409ec4b186398316e9a4f47f78330 +Author: Aleksander Morgado <aleksan...@aleksander.es> +Date: Sat Sep 21 14:01:30 2019 +0200 + + libmbim-glib,proxy: always use realpath in the MbimDevice + + We don't want to create different MbimDevices for the same cdc-wdm + port when it's accessed through different symlinks. + + Fixes https://gitlab.freedesktop.org/mobile-broadband/libmbim/issues/6 + + (cherry picked from commit 40640217fb40921c787cf309d6b988f04f1af84c) + + src/libmbim-glib/mbim-proxy.c | 22 ++++++++++++++++++---- + 1 file changed, 18 insertions(+), 4 deletions(-) + +commit 54903a86e84df3b9f3d0bec2d3e95d3ef380cb5e +Author: Aleksander Morgado <aleksan...@aleksander.es> +Date: Sat Sep 21 14:00:15 2019 +0200 + + 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) + + src/libmbim-glib/mbim-device.c | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +commit 2aabb1f1831ae9aa9f3fe1325113f2ea420c5708 +Author: Aleksander Morgado <aleksan...@aleksander.es> +Date: Sat Sep 21 13:59:51 2019 +0200 + + libmbim-glib,utils: new helpers to work with symlinks + + (cherry picked from commit 4932766d8cc77430283f708385eab45cc13bbc6a) + + src/libmbim-glib/mbim-utils.c | 44 + ++++++++++++++++++++++++++++++++++++++++++- + src/libmbim-glib/mbim-utils.h | 8 ++++++-- + 2 files changed, 49 insertions(+), 3 deletions(-) + +commit e0103fb8856e8657a9ea2635b5828863a851e7b3 +Author: Aleksander Morgado <aleksan...@aleksander.es> +Date: Fri Sep 6 14:27:23 2019 +0200 + + build: post-release version bump to 1.20.1 + + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + commit 376824c586fbf72ea0aeda3c8fb0df38c213a99e Author: Aleksander Morgado <aleksan...@aleksander.es> Date: Fri Sep 6 14:03:13 2019 +0200 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmbim-1.20.0/Makefile.in new/libmbim-1.20.2/Makefile.in --- old/libmbim-1.20.0/Makefile.in 2019-09-06 14:05:24.000000000 +0200 +++ new/libmbim-1.20.2/Makefile.in 2019-11-06 12:11:11.000000000 +0100 @@ -163,7 +163,7 @@ DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in AUTHORS \ COPYING COPYING.LIB ChangeLog INSTALL NEWS README compile \ - config.guess config.sub depcomp install-sh ltmain.sh missing + config.guess config.sub install-sh ltmain.sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmbim-1.20.0/NEWS new/libmbim-1.20.2/NEWS --- old/libmbim-1.20.0/NEWS 2019-09-06 14:02:06.000000000 +0200 +++ new/libmbim-1.20.2/NEWS 2019-11-06 12:09:31.000000000 +0100 @@ -1,4 +1,15 @@ +Overview of changes in libmbim 1.20.2 +---------------------------------------- + + * mbim-proxy: + ** Fixed device control port management when using symlinks. + + * libmbim-glib: + ** Fixed handling of fragmented indication messages. + + * Several other minor improvements and fixes. + Overview of changes in libmbim 1.20 ---------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmbim-1.20.0/configure new/libmbim-1.20.2/configure --- old/libmbim-1.20.0/configure 2019-09-06 14:05:24.000000000 +0200 +++ new/libmbim-1.20.2/configure 2019-11-06 12:11:10.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libmbim 1.20.0. +# Generated by GNU Autoconf 2.69 for libmbim 1.20.2. # # Report bugs to <libmbim-de...@lists.freedesktop.org>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='libmbim' PACKAGE_TARNAME='libmbim' -PACKAGE_VERSION='1.20.0' -PACKAGE_STRING='libmbim 1.20.0' +PACKAGE_VERSION='1.20.2' +PACKAGE_STRING='libmbim 1.20.2' PACKAGE_BUGREPORT='libmbim-de...@lists.freedesktop.org' PACKAGE_URL='' @@ -1397,7 +1397,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libmbim 1.20.0 to adapt to many kinds of systems. +\`configure' configures libmbim 1.20.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1467,7 +1467,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libmbim 1.20.0:";; + short | recursive ) echo "Configuration of libmbim 1.20.2:";; esac cat <<\_ACEOF @@ -1619,7 +1619,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libmbim configure 1.20.0 +libmbim configure 1.20.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1897,7 +1897,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libmbim $as_me 1.20.0, which was +It was created by libmbim $as_me 1.20.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2765,7 +2765,7 @@ # Define the identity of the package. PACKAGE='libmbim' - VERSION='1.20.0' + VERSION='1.20.2' # Some tools Automake needs. @@ -12235,8 +12235,8 @@ MBIM_MAJOR_VERSION=1 MBIM_MINOR_VERSION=20 -MBIM_MICRO_VERSION=0 -MBIM_VERSION=1.20.0 +MBIM_MICRO_VERSION=2 +MBIM_VERSION=1.20.2 @@ -14177,7 +14177,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libmbim $as_me 1.20.0, which was +This file was extended by libmbim $as_me 1.20.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14243,7 +14243,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libmbim config.status 1.20.0 +libmbim config.status 1.20.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmbim-1.20.0/configure.ac new/libmbim-1.20.2/configure.ac --- old/libmbim-1.20.0/configure.ac 2019-09-06 14:04:50.000000000 +0200 +++ new/libmbim-1.20.2/configure.ac 2019-11-06 12:06:57.000000000 +0100 @@ -4,7 +4,7 @@ dnl The libmbim version number m4_define([mbim_major_version], [1]) m4_define([mbim_minor_version], [20]) -m4_define([mbim_micro_version], [0]) +m4_define([mbim_micro_version], [2]) m4_define([mbim_version], [mbim_major_version.mbim_minor_version.mbim_micro_version]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmbim-1.20.0/docs/man/mbim-network.1 new/libmbim-1.20.2/docs/man/mbim-network.1 --- old/libmbim-1.20.0/docs/man/mbim-network.1 2019-07-02 13:57:33.000000000 +0200 +++ new/libmbim-1.20.2/docs/man/mbim-network.1 2019-11-06 12:11:32.000000000 +0100 @@ -1,5 +1,5 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10. -.TH MBIM-NETWORK "1" "July 2019" "mbim-network 1.19.0" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.11. +.TH MBIM-NETWORK "1" "November 2019" "mbim-network 1.20.2" "User Commands" .SH NAME mbim-network \- Simple network management of MBIM devices .SH SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmbim-1.20.0/docs/man/mbimcli.1 new/libmbim-1.20.2/docs/man/mbimcli.1 --- old/libmbim-1.20.0/docs/man/mbimcli.1 2019-07-02 13:57:34.000000000 +0200 +++ new/libmbim-1.20.2/docs/man/mbimcli.1 2019-11-06 12:11:32.000000000 +0100 @@ -1,5 +1,5 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10. -.TH MBIMCLI "1" "July 2019" "mbimcli " "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.11. +.TH MBIMCLI "1" "November 2019" "mbimcli " "User Commands" .SH NAME mbimcli \- Control MBIM devices .SH DESCRIPTION @@ -208,7 +208,7 @@ \fB\-V\fR, \fB\-\-version\fR Print version .PP -mbimcli 1.19.0 +mbimcli 1.20.2 Copyright \(co 2013\-2019 Aleksander Morgado License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl\-2.0.html> This is free software: you are free to change and redistribute it. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmbim-1.20.0/docs/reference/libmbim-glib/html/index.html new/libmbim-1.20.2/docs/reference/libmbim-glib/html/index.html --- old/libmbim-1.20.0/docs/reference/libmbim-glib/html/index.html 2019-09-06 14:08:46.000000000 +0200 +++ new/libmbim-1.20.2/docs/reference/libmbim-glib/html/index.html 2019-11-06 12:13:40.000000000 +0100 @@ -14,7 +14,7 @@ <div class="titlepage"> <div> <div><table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="0"><tr><th valign="middle"><p class="title">libmbim-glib Reference Manual</p></th></tr></table></div> -<div><p class="releaseinfo">for libmbim-glib 1.20.0 +<div><p class="releaseinfo">for libmbim-glib 1.20.2 </p></div> <div><p class="copyright">Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 The libmbim-glib authors</p></div> <div><div class="legalnotice"> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmbim-1.20.0/docs/reference/libmbim-glib/html/libmbim-glib-Version-checks.html new/libmbim-1.20.2/docs/reference/libmbim-glib/html/libmbim-glib-Version-checks.html --- old/libmbim-1.20.0/docs/reference/libmbim-glib/html/libmbim-glib-Version-checks.html 2019-09-06 14:08:46.000000000 +0200 +++ new/libmbim-1.20.2/docs/reference/libmbim-glib/html/libmbim-glib-Version-checks.html 2019-11-06 12:13:40.000000000 +0100 @@ -132,7 +132,7 @@ <hr> <div class="refsect2"> <a name="MBIM-MICRO-VERSION:CAPS"></a><h3>MBIM_MICRO_VERSION</h3> -<pre class="programlisting">#define MBIM_MICRO_VERSION (0) +<pre class="programlisting">#define MBIM_MICRO_VERSION (2) </pre> <p>Evaluates to the micro version number of libmbim-glib which this source compiled against.</p> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmbim-1.20.0/docs/reference/libmbim-glib/version.xml new/libmbim-1.20.2/docs/reference/libmbim-glib/version.xml --- old/libmbim-1.20.0/docs/reference/libmbim-glib/version.xml 2019-09-06 14:05:27.000000000 +0200 +++ new/libmbim-1.20.2/docs/reference/libmbim-glib/version.xml 2019-11-06 12:11:17.000000000 +0100 @@ -1 +1 @@ -1.20.0 +1.20.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmbim-1.20.0/src/libmbim-glib/mbim-device.c new/libmbim-1.20.2/src/libmbim-glib/mbim-device.c --- old/libmbim-1.20.0/src/libmbim-glib/mbim-device.c 2019-02-26 11:17:31.000000000 +0100 +++ new/libmbim-1.20.2/src/libmbim-glib/mbim-device.c 2019-11-06 12:05:53.000000000 +0100 @@ -91,9 +91,10 @@ static guint signals[SIGNAL_LAST] = { 0 }; typedef enum { - TRANSACTION_TYPE_HOST = 0, - TRANSACTION_TYPE_MODEM = 1, - TRANSACTION_TYPE_LAST = 2 + TRANSACTION_TYPE_UNKNOWN = -1, + TRANSACTION_TYPE_HOST = 0, + TRANSACTION_TYPE_MODEM = 1, + TRANSACTION_TYPE_LAST = 2 } TransactionType; typedef enum { @@ -258,6 +259,8 @@ GTask *task; TransactionContext *ctx; + g_assert ((type != TRANSACTION_TYPE_UNKNOWN) && (type < TRANSACTION_TYPE_LAST)); + /* Only return transaction if it was released from the HT */ if (!self->priv->transactions[type]) return NULL; @@ -356,6 +359,8 @@ { TransactionContext *ctx; + g_assert ((type != TRANSACTION_TYPE_UNKNOWN) && (type < TRANSACTION_TYPE_LAST)); + transaction_task_trace (task, "store"); if (G_UNLIKELY (!self->priv->transactions[type])) @@ -579,11 +584,13 @@ GError *error = NULL; GTask *task; TransactionContext *ctx; + TransactionType transaction_type = TRANSACTION_TYPE_UNKNOWN; if (MBIM_MESSAGE_GET_MESSAGE_TYPE (message) == MBIM_MESSAGE_TYPE_INDICATE_STATUS) { /* Grab transaction */ + transaction_type = TRANSACTION_TYPE_MODEM; task = device_release_transaction (self, - TRANSACTION_TYPE_MODEM, + transaction_type, MBIM_MESSAGE_TYPE_INDICATE_STATUS, mbim_message_get_transaction_id (message)); @@ -598,8 +605,9 @@ } else { /* Grab transaction. This is a _DONE message, so look for the request * that generated the _DONE */ + transaction_type = TRANSACTION_TYPE_HOST; task = device_release_transaction (self, - TRANSACTION_TYPE_HOST, + transaction_type, (MBIM_MESSAGE_GET_MESSAGE_TYPE (message) - 0x80000000), mbim_message_get_transaction_id (message)); if (!task) { @@ -669,7 +677,7 @@ /* Need more fragments, store transaction */ g_assert (device_store_transaction (self, - TRANSACTION_TYPE_HOST, + transaction_type, task, MAX_TIME_BETWEEN_FRAGMENTS_MS, NULL)); @@ -862,8 +870,9 @@ 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 +893,14 @@ * 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); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmbim-1.20.0/src/libmbim-glib/mbim-proxy.c new/libmbim-1.20.2/src/libmbim-glib/mbim-proxy.c --- old/libmbim-1.20.0/src/libmbim-glib/mbim-proxy.c 2019-09-06 09:29:09.000000000 +0200 +++ new/libmbim-1.20.2/src/libmbim-glib/mbim-proxy.c 2019-11-06 12:05:34.000000000 +0100 @@ -744,10 +744,12 @@ Client *client, MbimMessage *message) { - Request *request; + Request *request; MbimDevice *device; - gchar *path; - GFile *file; + gchar *incoming_path; + gchar *path; + GFile *file; + GError *error = NULL; /* create request holder */ request = request_new (self, client, message); @@ -767,12 +769,26 @@ } /* Retrieve path from request */ - path = _mbim_message_read_string (message, 0, 0); + incoming_path = _mbim_message_read_string (message, 0, 0); + if (!incoming_path) { + request->response = build_proxy_control_command_done (message, MBIM_STATUS_ERROR_INVALID_PARAMETERS); + request_complete_and_free (request); + return TRUE; + } + + /* The incoming path may be a symlink. In the proxy, we always use the real path of the + * device, so that clients using different symlinks for the same file don't collide with + * each other. */ + path = __mbim_utils_get_devpath (incoming_path, &error); if (!path) { + g_warning ("Error looking up real device path: %s", error->message); + g_error_free (error); request->response = build_proxy_control_command_done (message, MBIM_STATUS_ERROR_INVALID_PARAMETERS); request_complete_and_free (request); + g_free (incoming_path); return TRUE; } + g_free (incoming_path); /* Only allow subsequent requests with the same path */ if (client->device) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmbim-1.20.0/src/libmbim-glib/mbim-utils.c new/libmbim-1.20.2/src/libmbim-glib/mbim-utils.c --- old/libmbim-1.20.0/src/libmbim-glib/mbim-utils.c 2019-02-26 11:17:31.000000000 +0100 +++ new/libmbim-1.20.2/src/libmbim-glib/mbim-utils.c 2019-11-06 12:05:34.000000000 +0100 @@ -18,13 +18,16 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * Copyright (C) 2013 - 2014 Aleksander Morgado <aleksan...@aleksander.es> + * Copyright (C) 2013 - 2019 Aleksander Morgado <aleksan...@aleksander.es> */ #include <config.h> #include <string.h> #include <stdint.h> #include <stdio.h> +#include <limits.h> +#include <stdlib.h> +#include <errno.h> #include <pwd.h> #include "mbim-utils.h" @@ -78,6 +81,45 @@ } /*****************************************************************************/ + +gchar * +__mbim_utils_get_devpath (const gchar *cdc_wdm_path, + GError **error) +{ + gchar *aux; + + if (!g_file_test (cdc_wdm_path, G_FILE_TEST_IS_SYMLINK)) + return g_strdup (cdc_wdm_path); + + aux = realpath (cdc_wdm_path, NULL); + if (!aux) { + int saved_errno = errno; + + g_set_error (error, MBIM_CORE_ERROR, MBIM_CORE_ERROR_FAILED, + "Couldn't get realpath: %s", g_strerror (saved_errno)); + return NULL; + } + + return aux; +} + +gchar * +__mbim_utils_get_devname (const gchar *cdc_wdm_path, + GError **error) +{ + gchar *aux; + gchar *devname = NULL; + + aux = __mbim_utils_get_devpath (cdc_wdm_path, error); + if (aux) { + devname = g_path_get_basename (aux); + g_free (aux); + } + + return devname; +} + +/*****************************************************************************/ static volatile gint __traces_enabled = FALSE; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmbim-1.20.0/src/libmbim-glib/mbim-utils.h new/libmbim-1.20.2/src/libmbim-glib/mbim-utils.h --- old/libmbim-1.20.0/src/libmbim-glib/mbim-utils.h 2019-02-26 11:17:31.000000000 +0100 +++ new/libmbim-1.20.2/src/libmbim-glib/mbim-utils.h 2019-11-06 12:05:34.000000000 +0100 @@ -39,8 +39,12 @@ /* Other private methods */ #if defined (LIBMBIM_GLIB_COMPILATION) -gboolean __mbim_user_allowed (uid_t uid, - GError **error); +gboolean __mbim_user_allowed (uid_t uid, + GError **error); +gchar *__mbim_utils_get_devpath (const gchar *cdc_wdm_path, + GError **error); +gchar *__mbim_utils_get_devname (const gchar *cdc_wdm_path, + GError **error); #endif G_END_DECLS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmbim-1.20.0/src/libmbim-glib/mbim-version.h new/libmbim-1.20.2/src/libmbim-glib/mbim-version.h --- old/libmbim-1.20.0/src/libmbim-glib/mbim-version.h 2019-09-06 14:05:27.000000000 +0200 +++ new/libmbim-1.20.2/src/libmbim-glib/mbim-version.h 2019-11-06 12:11:17.000000000 +0100 @@ -51,7 +51,7 @@ * Evaluates to the micro version number of libmbim-glib which this source * compiled against. */ -#define MBIM_MICRO_VERSION (0) +#define MBIM_MICRO_VERSION (2) /** * MBIM_CHECK_VERSION: