summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2021-09-27 16:27:31 +0200
committerAleksander Morgado <aleksander@aleksander.es>2021-09-27 20:53:39 +0200
commit9808f46ef07dbac0ce69c21c68e34fdab40da4c2 (patch)
treec6cdb216d81f7aed0a097db08ff8c351fc4681b5
parent804f07cb959246e3ba44a9202ee34d1f7a5d065b (diff)
downloadlibmbim-9808f46ef07dbac0ce69c21c68e34fdab40da4c2.tar.gz
mbimcli,basic-connect: support 'context-type' in --connect
-rw-r--r--src/mbimcli/mbimcli-basic-connect.c12
1 files 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) {