diff options
author | Aleksander Morgado <aleksandermj@chromium.org> | 2023-06-15 08:27:13 +0000 |
---|---|---|
committer | Aleksander Morgado <aleksandermj@chromium.org> | 2023-06-16 20:58:04 +0000 |
commit | 3004a3e53263625da0b26e50c9107f1bad5b371e (patch) | |
tree | e9377da944a3ec31e6b297d407716a998f8928fd /src/mm-broadband-modem.c | |
parent | 547d40009c665d523e15cabfee028fc2604660dd (diff) |
broadband-modem-qmi|mbim: allow limiting multiplexed links with udev tags
Certain QMI or MBIM devices may not be able to support multiplexing at
all, or they may support a limited amount of links.
The new ID_MM_MAX_MULTIPLEXED_LINKS udev tag allows specifying the
maximum number of supported multiplexed links; e.g. 0 to report none
supported or 1 to report that one single multiplexed link is
supported.
Diffstat (limited to 'src/mm-broadband-modem.c')
-rw-r--r-- | src/mm-broadband-modem.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index c733d938..d3892456 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -12860,6 +12860,52 @@ mm_broadband_modem_get_current_charset (MMBroadbandModem *self) /*****************************************************************************/ +static void +bearer_count_multiplexed_connected (MMBaseBearer *bearer, + guint *count) +{ + /* The Multiplexed property is only set if connected, so it's enough to check + * that one to see if we're connected and multiplexed */ + if (mm_gdbus_bearer_get_multiplexed (MM_GDBUS_BEARER (bearer))) + *count += 1; +} + +gboolean +mm_broadband_modem_get_active_multiplexed_bearers (MMBroadbandModem *self, + guint *out_current, + guint *out_max, + GError **error) +{ + g_autoptr(MMBearerList) list = NULL; + guint max; + guint count = 0; + + g_object_get (self, + MM_IFACE_MODEM_BEARER_LIST, &list, + NULL); + + if (!list) { + g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, "Bearer list unavailable"); + return FALSE; + } + + max = mm_bearer_list_get_max_active_multiplexed (list); + + mm_bearer_list_foreach (list, + (MMBearerListForeachFunc)bearer_count_multiplexed_connected, + &count); + g_assert (!(!max && count)); + + if (out_max) + *out_max = max; + if (out_current) + *out_current = count; + + return TRUE; +} + +/*****************************************************************************/ + gchar * mm_broadband_modem_create_device_identifier (MMBroadbandModem *self, const gchar *ati, |