Commit a3929d66 authored by Zhang Mingjie's avatar Zhang Mingjie
Browse files

ms-basic-connect-extensions: implement 'Sys caps'

Update data/mbim-service-ms-basic-connect-extensions.json,
       src/mbimcli/mbimcli-ms-basic-connect-extensions.c

We query the system capalibities and we can see
the following information.

mbimcli -d /dev/cdc-wdm0 -p --ms-query-sys-caps
[/dev/cdc-wdm0] System capabilities retrieved:
      Number of executors: 'x'
          Number of slots: 'x'
              Concurrency: 'x'
                 Modem ID: 'xxx'
parent 764d9115
Pipeline #324695 passed with stages
in 3 minutes and 3 seconds
......@@ -128,5 +128,21 @@
"public-format" : "MbimCompression" },
{ "name" : "AuthProtocol",
"format" : "guint32",
"public-format" : "MbimAuthProtocol" } ] }
"public-format" : "MbimAuthProtocol" } ] },
//**********************************************************************************
{ "name" : "Sys Caps",
"service" : "Ms Basic Connect Extensions",
"type" : "Command",
"since" : "1.26",
"query" : [],
"response" : [ { "name" : "NumberOfExecutors",
"format" : "guint32" },
{ "name" : "NumberOfSlots",
"format" : "guint32" },
{ "name" : "Concurrency",
"format" : "guint32" },
{ "name" : "ModemId",
"format" : "guint64" } ] }
]
......@@ -47,6 +47,7 @@ static gchar *query_pco_str;
static gboolean query_lte_attach_configuration_flag;
static gboolean query_lte_attach_status_flag; /* support for the deprecated name */
static gboolean query_lte_attach_info_flag;
static gboolean query_sys_caps_flag;
static gboolean query_pco_arg_parse (const gchar *option_name,
const gchar *value,
......@@ -70,6 +71,10 @@ static GOptionEntry entries[] = {
"Query LTE attach status information",
NULL
},
{ "ms-query-sys-caps", 0, 0, G_OPTION_ARG_NONE, &query_sys_caps_flag,
"Query system capabilities",
NULL
},
{ NULL }
};
......@@ -313,6 +318,53 @@ query_lte_attach_info_ready (MbimDevice *device,
shutdown (TRUE);
}
static void
query_sys_caps_ready (MbimDevice *device,
GAsyncResult *res)
{
g_autoptr(MbimMessage) response = NULL;
g_autoptr(GError) error = NULL;
guint32 number_executors;
guint32 number_slots;
guint32 concurrency;
guint64 modem_id;
response = mbim_device_command_finish (device, res, &error);
if (!response || !mbim_message_response_get_result (response, MBIM_MESSAGE_TYPE_COMMAND_DONE, &error)) {
g_printerr ("error: operation failed: %s\n", error->message);
shutdown (FALSE);
return;
}
g_print ("[%s] Successfully queried sys caps\n",
mbim_device_get_path_display (device));
if (!mbim_message_ms_basic_connect_extensions_sys_caps_response_parse (
response,
&number_executors,
&number_slots,
&concurrency,
&modem_id,
&error)) {
g_printerr ("error: couldn't parse response messages: %s\n", error->message);
shutdown (FALSE);
return;
}
g_print ("[%s] System capabilities retrieved:\n"
"\t Number of executors: '%u'\n"
"\t Number of slots: '%u'\n"
"\t Concurrency: '%u'\n"
"\t Modem ID: '%" G_GUINT64_FORMAT "'\n",
mbim_device_get_path_display (device),
number_executors,
number_slots,
concurrency,
modem_id);
shutdown (TRUE);
}
void
mbimcli_ms_basic_connect_extensions_run (MbimDevice *device,
GCancellable *cancellable)
......@@ -376,5 +428,17 @@ mbimcli_ms_basic_connect_extensions_run (MbimDevice *device,
return;
}
if (query_sys_caps_flag) {
g_debug ("Asynchronously querying system capabilities...");
request = mbim_message_ms_basic_connect_extensions_sys_caps_query_new (NULL);
mbim_device_command (ctx->device,
request,
10,
ctx->cancellable,
(GAsyncReadyCallback)query_sys_caps_ready,
NULL);
return;
}
g_warn_if_reached ();
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment