When passing -v/--version to gpiocli or gpio-manager, it's useful to
also know the version of the GPIO D-Bus API the program implements.
Define the version in the gpiodbus.h header and print it together with
the library version.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
// SPDX-FileCopyrightText: 2022-2023 Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
#include <glib/gstdio.h>
+#include <gpiodbus.h>
#include "common.h"
static void show_version_and_exit(void)
{
- g_print("gpiocli v%s\n", GPIOD_VERSION_STR);
+ g_print("gpiocli (libgpiod) v%s\nD-Bus API version: %d\n",
+ GPIOD_VERSION_STR, GPIODBUS_API_VERSION);
exit(EXIT_SUCCESS);
}
#ifndef __GPIODBUS_H__
#define __GPIODBUS_H__
+#define GPIODBUS_API_VERSION 1
+
#include "generated-gpiodbus.h"
#endif /* __GPIODBUS_H__ */
#include <glib.h>
#include <glib-unix.h>
#include <gpiod-glib.h>
+#include <gpiodbus.h>
#include <stdlib.h>
#include "daemon.h"
static void print_version_and_exit(void)
{
- g_print("%s (libgpiod) v%s\n", g_get_prgname(), gpiodglib_api_version());
+ g_print("%s (libgpiod) v%s\nD-Bus API version: %d\n",
+ g_get_prgname(), gpiodglib_api_version(), GPIODBUS_API_VERSION);
exit(EXIT_SUCCESS);
}