base-bearer: setup common default for unknown multiplex fallback

If the user doesn't provide a specific multiplex setting, we'll
fallback to a predefined default.

For now, the default is REQUESTED.
This commit is contained in:
Aleksander Morgado
2021-07-13 15:47:38 +02:00
parent c4b5879e45
commit daf72fe169
4 changed files with 17 additions and 6 deletions
+5
View File
@@ -67,6 +67,11 @@ gint mm_bearer_connect_result_get_profile_id (MMBearerConnec
/*****************************************************************************/
/* Default multiplex support setting to use when none explicitly given */
#define MM_BASE_BEARER_MULTIPLEX_SUPPORT_DEFAULT MM_BEARER_MULTIPLEX_SUPPORT_REQUESTED
/*****************************************************************************/
#define MM_TYPE_BASE_BEARER (mm_base_bearer_get_type ())
#define MM_BASE_BEARER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BASE_BEARER, MMBaseBearer))
#define MM_BASE_BEARER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BASE_BEARER, MMBaseBearerClass))
+5 -3
View File
@@ -1172,11 +1172,13 @@ load_settings_from_bearer (MMBearerMbim *self,
if (!g_strcmp0 (data_port_driver, "mhi_net"))
multiplex_supported = FALSE;
/* If no multiplex setting given by the user, assume requested */
/* If no multiplex setting given by the user, assume default */
multiplex = mm_bearer_properties_get_multiplex (properties);
if (multiplex == MM_BEARER_MULTIPLEX_SUPPORT_UNKNOWN)
multiplex = MM_BASE_BEARER_MULTIPLEX_SUPPORT_DEFAULT;
if (multiplex_supported &&
(multiplex == MM_BEARER_MULTIPLEX_SUPPORT_UNKNOWN ||
multiplex == MM_BEARER_MULTIPLEX_SUPPORT_REQUESTED ||
(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 (ctx->modem)));
+2 -2
View File
@@ -2141,10 +2141,10 @@ load_settings_from_bearer (MMBearerQmi *self,
GError *inner_error = NULL;
const gchar *str;
/* If no multiplex setting given by the user, assume requested */
/* If no multiplex setting given by the user, assume default */
ctx->multiplex = mm_bearer_properties_get_multiplex (properties);
if (ctx->multiplex == MM_BEARER_MULTIPLEX_SUPPORT_UNKNOWN)
ctx->multiplex = MM_BEARER_MULTIPLEX_SUPPORT_REQUESTED;
ctx->multiplex = MM_BASE_BEARER_MULTIPLEX_SUPPORT_DEFAULT;
/* The link prefix hint given must be modem-specific */
if (ctx->multiplex == MM_BEARER_MULTIPLEX_SUPPORT_REQUESTED ||
+5 -1
View File
@@ -1011,8 +1011,12 @@ connect (MMBaseBearer *self,
return;
}
/* The generic broadband bearer doesn't support multiplexing */
/* If no multiplex setting given by the user, assume default */
multiplex = mm_bearer_properties_get_multiplex (mm_base_bearer_peek_config (MM_BASE_BEARER (self)));
if (multiplex == MM_BEARER_MULTIPLEX_SUPPORT_UNKNOWN)
multiplex = MM_BASE_BEARER_MULTIPLEX_SUPPORT_DEFAULT;
/* The generic broadband bearer doesn't support multiplexing */
if (multiplex == MM_BEARER_MULTIPLEX_SUPPORT_REQUIRED) {
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
"Multiplexing required but not supported");