From 9808f46ef07dbac0ce69c21c68e34fdab40da4c2 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Mon, 27 Sep 2021 16:27:31 +0200 Subject: mbimcli,basic-connect: support 'context-type' in --connect --- src/mbimcli/mbimcli-basic-connect.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mbimcli/mbimcli-basic-connect.c b/src/mbimcli/mbimcli-basic-connect.c index 8aeadd8..d746e3f 100644 --- a/src/mbimcli/mbimcli-basic-connect.c +++ b/src/mbimcli/mbimcli-basic-connect.c @@ -172,7 +172,7 @@ static GOptionEntry entries[] = { "[SessionID]" }, { "connect", 0, 0, G_OPTION_ARG_STRING, &set_connect_activate_str, - "Connect (allowed keys: session-id, access-string, ip-type, auth, username, password, compression)", + "Connect (allowed keys: session-id, access-string, ip-type, auth, username, password, compression, context-type)", "[\"key=value,...\"]" }, { "query-ip-configuration", 0, G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, G_CALLBACK (query_ip_configuration_arg_parse), @@ -1009,6 +1009,7 @@ typedef struct { gchar *password; MbimContextIpType ip_type; MbimCompression compression; + MbimContextType context_type; } ConnectActivateProperties; static void @@ -1072,6 +1073,12 @@ connect_activate_properties_handle (const gchar *key, "unknown compression: '%s'", value); return FALSE; } + } else if (g_ascii_strcasecmp (key, "context-type") == 0) { + if (!mbimcli_read_context_type_from_string (value, &props->context_type)) { + g_set_error (error, MBIM_CORE_ERROR, MBIM_CORE_ERROR_INVALID_ARGS, + "unknown context-type: '%s'", value); + return FALSE; + } } else { g_set_error (error, MBIM_CORE_ERROR, MBIM_CORE_ERROR_FAILED, "unrecognized option '%s'", key); @@ -2089,6 +2096,7 @@ mbimcli_basic_connect_run (MbimDevice *device, .password = NULL, .ip_type = MBIM_CONTEXT_IP_TYPE_DEFAULT, .compression = MBIM_COMPRESSION_NONE, + .context_type = MBIM_CONTEXT_TYPE_INTERNET, }; if (!set_connect_activate_parse (set_connect_activate_str, &props)) { @@ -2104,7 +2112,7 @@ mbimcli_basic_connect_run (MbimDevice *device, props.compression, props.auth_protocol, props.ip_type, - mbim_uuid_from_context_type (MBIM_CONTEXT_TYPE_INTERNET), + mbim_uuid_from_context_type (props.context_type), &error); if (!request) { -- cgit v1.2.1