From patchwork Fri Jul 10 13:18:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 11656623 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A8788618 for ; Fri, 10 Jul 2020 13:18:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 870032077D for ; Fri, 10 Jul 2020 13:18:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="IvTGhKac" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726965AbgGJNSa (ORCPT ); Fri, 10 Jul 2020 09:18:30 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:49662 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726774AbgGJNS3 (ORCPT ); Fri, 10 Jul 2020 09:18:29 -0400 Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2D32C9B1; Fri, 10 Jul 2020 15:18:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1594387108; bh=9A/atXH1YXfDrfH9zej5/expJA3ciqGtIoKfltEw+e4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IvTGhKacBZensezkockENzqM0+ifrKV9dioqSsDdzZdP6RgeMeyST30w87y+Tuxh8 tOd9hJdcRpAE7nB/P0yqJb2F5rbeX231xXzF4vuYbw0Ku+Q54m03WeuQwASrvr0jdG Z2P0vandboXMQl4y2waJwZiksFuiPwcmM03iI6zw= From: Paul Elder To: linux-media@vger.kernel.org Cc: Paul Elder , laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl Subject: [PATCH 2/2] v4l2-ctl: Add version command Date: Fri, 10 Jul 2020 22:18:13 +0900 Message-Id: <20200710131813.452513-2-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200710131813.452513-1-paul.elder@ideasonboard.com> References: <20200710131813.452513-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add a --version option to v4l2-ctl to retrieve the version of v4l2-ctl. Signed-off-by: Paul Elder --- utils/v4l2-ctl/v4l2-ctl-common.cpp | 1 + utils/v4l2-ctl/v4l2-ctl.cpp | 9 +++++++++ utils/v4l2-ctl/v4l2-ctl.h | 1 + 3 files changed, 11 insertions(+) diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp index 47f5da1a..9b785cbf 100644 --- a/utils/v4l2-ctl/v4l2-ctl-common.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp @@ -121,6 +121,7 @@ void common_usage() " --silent only set the result code, do not print any messages\n" " --sleep sleep , call QUERYCAP and close the file handle\n" " --verbose turn on verbose ioctl status reporting\n" + " --version show version information\n" ); } diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp index 4972591e..bc7330c4 100644 --- a/utils/v4l2-ctl/v4l2-ctl.cpp +++ b/utils/v4l2-ctl/v4l2-ctl.cpp @@ -284,6 +284,7 @@ static struct option long_options[] = { {"stream-out-user", optional_argument, 0, OptStreamOutUser}, {"stream-out-dmabuf", no_argument, 0, OptStreamOutDmaBuf}, {"list-patterns", no_argument, 0, OptListPatterns}, + {"version", no_argument, 0, OptVersion}, {0, 0, 0, 0} }; @@ -306,6 +307,11 @@ static void usage_all() edid_usage(); } +static void version() +{ + printf("v4l2-ctl " PACKAGE_VERSION "\n"); +} + int test_ioctl(int fd, unsigned long cmd, void *arg) { return options[OptUseWrapper] ? v4l2_ioctl(fd, cmd, arg) : ioctl(fd, cmd, arg); @@ -1245,6 +1251,9 @@ int main(int argc, char **argv) case OptSleep: secs = strtoul(optarg, 0L, 0); break; + case OptVersion: + version(); + return 0; case ':': fprintf(stderr, "Option '%s' requires a value\n", argv[optind]); diff --git a/utils/v4l2-ctl/v4l2-ctl.h b/utils/v4l2-ctl/v4l2-ctl.h index 28e50471..27a3ca35 100644 --- a/utils/v4l2-ctl/v4l2-ctl.h +++ b/utils/v4l2-ctl/v4l2-ctl.h @@ -263,6 +263,7 @@ enum Option { OptHelpStreaming, OptHelpEdid, OptHelpAll, + OptVersion, OptLast = 512 };