summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-07-03 14:05:52 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-07-03 16:08:58 +0200
commit2ee78ed50331e3885ee2b28a2a89a291fd7d1e3b (patch)
treee4da971db401c36cb81d2dd8f3d1a015afc40e5f
parentec222517eef73cfe1b1b6367935638073036be55 (diff)
ctl: use the new `sequence' type for struct TLVs
-rw-r--r--data/qmi-service-ctl.json6
-rw-r--r--src/qmi-device.c26
2 files changed, 17 insertions, 15 deletions
diff --git a/data/qmi-service-ctl.json b/data/qmi-service-ctl.json
index 46b0355..644f462 100644
--- a/data/qmi-service-ctl.json
+++ b/data/qmi-service-ctl.json
@@ -50,7 +50,7 @@
"id" : "0x01",
"mandatory" : "yes",
"type" : "TLV",
- "format" : "struct",
+ "format" : "sequence",
"contents" : [ { "name" : "Service",
"format" : "guint8",
"public-format" : "QmiService" },
@@ -67,7 +67,7 @@
"id" : "0x01",
"mandatory" : "yes",
"type" : "TLV",
- "format" : "struct",
+ "format" : "sequence",
"contents" : [ { "name" : "Service",
"format" : "guint8",
"public-format" : "QmiService" },
@@ -78,7 +78,7 @@
"id" : "0x01",
"mandatory" : "yes",
"type" : "TLV",
- "format" : "struct",
+ "format" : "sequence",
"contents" : [ { "name" : "Service",
"format" : "guint8",
"public-format" : "QmiService" },
diff --git a/src/qmi-device.c b/src/qmi-device.c
index 1158880..170795d 100644
--- a/src/qmi-device.c
+++ b/src/qmi-device.c
@@ -464,7 +464,8 @@ allocate_cid_ready (QmiClientCtl *client_ctl,
AllocateClientContext *ctx)
{
QmiMessageCtlAllocateCidOutput *output;
- QmiMessageCtlAllocateCidOutputAllocationInfo info;
+ QmiService service;
+ guint8 cid;
GError *error = NULL;
/* Check result of the async operation */
@@ -485,9 +486,9 @@ allocate_cid_ready (QmiClientCtl *client_ctl,
}
/* Allocation info is mandatory when result is success */
- g_assert (qmi_message_ctl_allocate_cid_output_get_allocation_info (output, &info, NULL));
+ g_assert (qmi_message_ctl_allocate_cid_output_get_allocation_info (output, &service, &cid, NULL));
- if (info.service != ctx->service) {
+ if (service != ctx->service) {
g_simple_async_result_set_error (
ctx->result,
QMI_CORE_ERROR,
@@ -495,13 +496,13 @@ allocate_cid_ready (QmiClientCtl *client_ctl,
"CID allocation failed in the CTL client: "
"Service mismatch (requested '%s', got '%s')",
qmi_service_get_string (ctx->service),
- qmi_service_get_string (info.service));
+ qmi_service_get_string (service));
allocate_client_context_complete_and_free (ctx);
qmi_message_ctl_allocate_cid_output_unref (output);
return;
}
- ctx->cid = info.cid;
+ ctx->cid = cid;
build_client_object (ctx);
qmi_message_ctl_allocate_cid_output_unref (output);
}
@@ -738,7 +739,8 @@ qmi_device_release_client (QmiDevice *self,
gpointer user_data)
{
ReleaseClientContext *ctx;
- QmiMessageCtlReleaseCidInputReleaseInfo info;
+ QmiService service;
+ guint8 cid;
g_return_if_fail (QMI_IS_DEVICE (self));
g_return_if_fail (QMI_IS_CLIENT (client));
@@ -756,11 +758,11 @@ qmi_device_release_client (QmiDevice *self,
user_data,
qmi_device_release_client);
- info.cid = qmi_client_get_cid (client);
- info.service = (guint8)qmi_client_get_service (client);
+ cid = qmi_client_get_cid (client);
+ service = (guint8)qmi_client_get_service (client);
/* Do not try to release an already released client */
- if (info.cid == QMI_CID_NONE) {
+ if (cid == QMI_CID_NONE) {
g_simple_async_result_set_error (ctx->result,
QMI_CORE_ERROR,
QMI_CORE_ERROR_INVALID_ARGS,
@@ -773,8 +775,8 @@ qmi_device_release_client (QmiDevice *self,
unregister_client (self, client);
g_debug ("Unregistered '%s' client with ID '%u'",
- qmi_service_get_string (info.service),
- info.cid);
+ qmi_service_get_string (service),
+ cid);
/* Reset the contents of the client object, making it unusable */
g_object_set (client,
@@ -788,7 +790,7 @@ qmi_device_release_client (QmiDevice *self,
/* And now, really try to release the CID */
input = qmi_message_ctl_release_cid_input_new ();
- qmi_message_ctl_release_cid_input_set_release_info (input, &info, NULL);
+ qmi_message_ctl_release_cid_input_set_release_info (input, service,cid, NULL);
/* And now, really try to release the CID */
qmi_client_ctl_release_cid (self->priv->client_ctl,