summaryrefslogtreecommitdiff
path: root/cleopatre/application/managerd
diff options
context:
space:
mode:
authorCeline Buret2011-08-04 11:12:00 +0200
committerCeline Buret2011-08-05 16:03:00 +0200
commitacceef214051109c1854bd3ed6cfdf4644570856 (patch)
tree7c39fbb2d342d4d245d9eab0114c07748be66eb9 /cleopatre/application/managerd
parentb5a86f9c277c3600e47d0d5b01ab3357f0bde14b (diff)
cleo/{app,devkit/tests}: implement current index of vs_get_version.cnf, closes #976
Changes in libspid: * implement a new function to get the image position of the given MTD path, * update unitary tests: * test the new function, * solve a memory leak in setup() function, * remove dead code, * correctly rename the test suite as "image" instead of "system", * comment tests leading to following error that made the test not runnable: "check_pack.c:269: Error in call to write: Bad file descriptor". Changes in managerd: * call the new libspid function to fill vs_mme_get_version.cnf field returning the index of the current image, * solve 2 compilation warnings in vs_mme_get_version() function.
Diffstat (limited to 'cleopatre/application/managerd')
-rw-r--r--cleopatre/application/managerd/src/vs_mme.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/cleopatre/application/managerd/src/vs_mme.c b/cleopatre/application/managerd/src/vs_mme.c
index 71ded24256..45070d8be1 100644
--- a/cleopatre/application/managerd/src/vs_mme.c
+++ b/cleopatre/application/managerd/src/vs_mme.c
@@ -57,6 +57,7 @@ enum bridge_status vs_mme_get_version (struct managerd_ctx *ctx, MME_t *request,
FILE *fp;
char tmp_buffer[256];
char label[64], version[64];
+ int index;
assert (NULL != ctx);
assert (NULL != request);
@@ -77,8 +78,6 @@ enum bridge_status vs_mme_get_version (struct managerd_ctx *ctx, MME_t *request,
memcpy (get_version_cnf->oui, OUI_SPIDCOM, 3);
get_version_cnf->result = 0;
get_version_cnf->device_id = SPC300_ID;
- // TODO: find the right index value
- get_version_cnf->current_image_index = 0;
/* get current image version */
memset (&desc, '\0', sizeof (desc));
@@ -90,6 +89,10 @@ enum bridge_status vs_mme_get_version (struct managerd_ctx *ctx, MME_t *request,
sizeof (desc.version));
}
+ /* Retrieve index of current image from MTD path */
+ libspid_image_get_index ((const char *) mtd_name, &index);
+ get_version_cnf->current_image_index = (unsigned char) index;
+
if ((fp = fopen (PLC_VERSION_PATH, "r")) != NULL)
{
while (fgets (tmp_buffer, 256, fp))
@@ -116,9 +119,9 @@ enum bridge_status vs_mme_get_version (struct managerd_ctx *ctx, MME_t *request,
memcpy (get_version_cnf->applicative_alternate, desc.version,
sizeof (desc.version));
}
- if (strlen (get_version_cnf->applicative_alternate) == 0)
+ if (strlen ((char *) get_version_cnf->applicative_alternate) == 0)
{
- strcpy (get_version_cnf->applicative_alternate, "none");
+ strcpy ((char *) get_version_cnf->applicative_alternate, "none");
}
/* send confirm MME */