aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Poulain <loic.poulain@linaro.org>2021-04-20 12:04:24 +0200
committerLoic Poulain <loic.poulain@linaro.org>2021-04-21 12:53:16 +0200
commit05b005951710c8810538ec448e89e32f28c3d592 (patch)
treed7c2a55b2bed841973dd9144812eb7f52a380c98
parentfefbf4d3029ce8e1f2ed9db2bc8288e13989b05a (diff)
bearer: mbim: Check for multiplex support
If multiplexing is not supported by the network driver, do not enable it by default and fail in case it is required. This is the case for mhi_net driver, that do no implement multi MBIM session (only session 0 is supported). Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
-rw-r--r--src/mm-bearer-mbim.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/mm-bearer-mbim.c b/src/mm-bearer-mbim.c
index f2c16704..efe90ef1 100644
--- a/src/mm-bearer-mbim.c
+++ b/src/mm-bearer-mbim.c
@@ -1156,6 +1156,8 @@ _connect (MMBaseBearer *self,
GTask *task;
MMBearerMultiplexSupport multiplex;
g_autoptr(MMBaseModem) modem = NULL;
+ const gchar *data_port_driver;
+ gboolean multiplex_supported = TRUE;
if (!peek_ports (self, &mbim, &data, callback, user_data))
return;
@@ -1192,16 +1194,26 @@ _connect (MMBaseBearer *self,
MM_BASE_BEARER_CONFIG, &ctx->properties,
NULL);
+ data_port_driver = mm_kernel_device_get_driver (mm_port_peek_kernel_device (data));
+ if (!g_strcmp0 (data_port_driver, "mhi_net"))
+ multiplex_supported = FALSE;
+
multiplex = mm_bearer_properties_get_multiplex (ctx->properties);
/* If no multiplex setting given by the user, assume requested */
- if (multiplex == MM_BEARER_MULTIPLEX_SUPPORT_UNKNOWN ||
- multiplex == MM_BEARER_MULTIPLEX_SUPPORT_REQUESTED ||
- multiplex == MM_BEARER_MULTIPLEX_SUPPORT_REQUIRED) {
+ if (multiplex_supported &&
+ (multiplex == MM_BEARER_MULTIPLEX_SUPPORT_UNKNOWN ||
+ multiplex == MM_BEARER_MULTIPLEX_SUPPORT_REQUESTED ||
+ multiplex == MM_BEARER_MULTIPLEX_SUPPORT_REQUIRED)) {
/* the link prefix hint given must be modem-specific */
ctx->link_prefix_hint = g_strdup_printf ("mbimmux%u.", mm_base_modem_get_dbus_id (MM_BASE_MODEM (modem)));
}
+ if (!multiplex_supported && multiplex == MM_BEARER_MULTIPLEX_SUPPORT_REQUIRED) {
+ mm_obj_err (self, "Multiplexing required but not supported by %s", data_port_driver);
+ return;
+ }
+
mm_obj_dbg (self, "launching %sconnection with data port (%s/%s)",
ctx->link_prefix_hint ? "multiplexed " : "",
mm_port_subsys_get_string (mm_port_get_subsys (data)),