From 9f67f70debaaf69d26117c7aa1b9bdcb6b6a82b0 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Mon, 12 Jul 2021 13:16:56 +0100 Subject: [PATCH] Put library version in XML string The context's library version is something that is not going to change over time, and therefore it should be present in the XML representation of the context. Signed-off-by: Paul Cercueil --- context.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/context.c b/context.c index 34fe5ee08..27219db14 100644 --- a/context.c +++ b/context.c @@ -24,7 +24,8 @@ static const char xml_header[] = "" "" "" "" -"" +"" "" "" "" @@ -100,10 +101,17 @@ static ssize_t iio_snprintf_context_xml(char *ptr, ssize_t len, const struct iio_context *ctx) { ssize_t ret, alen = 0; - unsigned int i; + unsigned int i, major, minor; + char git_tag[64]; + + ret = iio_context_get_version(ctx, &major, &minor, git_tag); + if (ret < 0) + return ret; - ret = iio_snprintf(ptr, len, "%sname); + ret = iio_snprintf(ptr, len, + "%sname, major, minor, git_tag); if (ret < 0) return ret;