From 9cd507ed5b661f64ddea9d8c85fd67bd4db1e952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 18 Aug 2026 20:46:05 +0200 Subject: [PATCH] udev/v4l_id: convert to VERB_COMMAND and add --introspect-cli The custom help() is replaced by a COMMAND() description, and --introspect-cli is added. The abstract is changed to the imperative. There is no man page for this udev helper, so none is referenced. --- src/udev/v4l_id/v4l_id.c | 30 ++++++++----------- .../units/TEST-74-AUX-UTILS.introspect-cli.sh | 1 + 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/udev/v4l_id/v4l_id.c b/src/udev/v4l_id/v4l_id.c index f1f40324de..45a1f52bd2 100644 --- a/src/udev/v4l_id/v4l_id.c +++ b/src/udev/v4l_id/v4l_id.c @@ -8,34 +8,25 @@ #include #include +#include "sd-json.h" + #include "build.h" #include "errno-util.h" #include "fd-util.h" -#include "format-table.h" -#include "help-util.h" #include "log.h" #include "main-func.h" -#include "options.h" #include "string-util.h" #include "strv.h" #include "utf8.h" +#include "verbs.h" static const char *arg_device = NULL; -static int help(void) { - _cleanup_(table_unrefp) Table *options = NULL; - int r; - - r = option_parser_get_help_table(&options); - if (r < 0) - return r; - - help_cmdline("[OPTIONS...] DEVICE"); - help_abstract("Video4Linux device identification."); - help_section("Options"); - - return table_print_or_warn(options); -} +COMMAND( + "v4l_id\0", + "Identify Video4Linux devices.", + .argspec = "DEVICE\0", +); static int parse_argv(int argc, char *argv[]) { assert(argc >= 0); @@ -47,10 +38,13 @@ static int parse_argv(int argc, char *argv[]) { switch (c) { OPTION_COMMON_HELP: - return help(); + return command_print_help("v4l_id"); OPTION_COMMON_VERSION: return version(); + + OPTION_COMMON_INTROSPECT_CLI: + return introspect_cli(SD_JSON_FORMAT_OFF); } char **args = option_parser_get_args(&opts); diff --git a/test/units/TEST-74-AUX-UTILS.introspect-cli.sh b/test/units/TEST-74-AUX-UTILS.introspect-cli.sh index 34cc54269d..2ca370c8a1 100755 --- a/test/units/TEST-74-AUX-UTILS.introspect-cli.sh +++ b/test/units/TEST-74-AUX-UTILS.introspect-cli.sh @@ -109,6 +109,7 @@ INTROSPECTABLE=( timedatectl updatectl userdbctl + v4l_id varlinkctl )