From patchwork Wed Jul 15 10:26:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 65503 Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1jveY1-00FxhK-Cr; Wed, 15 Jul 2020 10:21:57 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728926AbgGOK0x (ORCPT + 1 other); Wed, 15 Jul 2020 06:26:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728132AbgGOK0x (ORCPT ); Wed, 15 Jul 2020 06:26:53 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28F74C061755 for ; Wed, 15 Jul 2020 03:26:53 -0700 (PDT) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EC1AF564; Wed, 15 Jul 2020 12:26:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1594808811; bh=DWpG4S89inUMoW6sZEPPMoEKf3yYaDnkBMj3oU2qS3k=; h=From:To:Cc:Subject:Date:From; b=g4/O7JCJ/0m91WL9eAuQEmZY9YgQXAIf1UEyWQQMmS5jgfVPDuhKJtBzbcd3B43i9 EkdIgRkJ/xIJwcfXbE5e/piPrUPViBPT3UUo0TrIBffXV15KC6EX3rwDYcz4ufr+gH WWvfLgb49+Q6NuW0e2CGsHOXrl+GSYM0U6elvkpc= From: Paul Elder To: linux-media@vger.kernel.org Cc: Paul Elder , laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl Subject: [PATCH v5 1/5] v4l2-compliance: Add version command Date: Wed, 15 Jul 2020 19:26:36 +0900 Message-Id: <20200715102640.17554-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no Add a --version option to v4l2-compliance to retrieve the version of v4l2-compliance. While at it, factor out and reorder printing the SHA to after argument parsing. Signed-off-by: Paul Elder --- Changes in v5: - update manpage - move STR macros to before print_sha() Changes in v4: - add git commit count to version Changes in v3: - embed PACKAGE_VERSION instead of string concatenation --- utils/v4l2-compliance/v4l2-compliance.1.in | 3 +++ utils/v4l2-compliance/v4l2-compliance.cpp | 31 +++++++++++++++++----- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/utils/v4l2-compliance/v4l2-compliance.1.in b/utils/v4l2-compliance/v4l2-compliance.1.in index 39f0229d..89d7e482 100644 --- a/utils/v4l2-compliance/v4l2-compliance.1.in +++ b/utils/v4l2-compliance/v4l2-compliance.1.in @@ -184,6 +184,9 @@ Trace all called ioctls. \fB\-v\fR, \fB\-\-verbose\fR Turn on verbose reporting. .TP +\fB\-\-version\fR +Show version information. +.TP \fB\-w\fR, \fB\-\-wrapper\fR Use the libv4l2 wrapper library for all V4L2 device accesses. Note that doing this will cause some tests to fail because the libv4l2 library isn't fully V4L2 compliant. By diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp index 825f2aa6..92b4e995 100644 --- a/utils/v4l2-compliance/v4l2-compliance.cpp +++ b/utils/v4l2-compliance/v4l2-compliance.cpp @@ -76,6 +76,7 @@ enum Option { OptMediaBusInfo = 'z', OptStreamFrom = 128, OptStreamFromHdr, + OptVersion, OptLast = 256 }; @@ -150,9 +151,25 @@ static struct option long_options[] = { {"stream-all-formats", optional_argument, 0, OptStreamAllFormats}, {"stream-all-io", no_argument, 0, OptStreamAllIO}, {"stream-all-color", required_argument, 0, OptStreamAllColorTest}, + {"version", no_argument, 0, OptVersion}, {0, 0, 0, 0} }; +#define STR(x) #x +#define STRING(x) STR(x) + +static void print_sha() +{ + printf("v4l2-compliance SHA: %s", STRING(GIT_SHA)); + printf(", %zd bits, %zd-bit time_t\n", sizeof(void *) * 8, sizeof(time_t) * 8); + printf("\n"); +} + +static void print_version() +{ + printf("v4l2-compliance %s%s\n", PACKAGE_VERSION, STRING(GIT_COMMIT_CNT)); +} + static void usage() { printf("Usage:\n"); @@ -241,6 +258,7 @@ static void usage() printf(" -P, --no-progress Turn off progress messages.\n"); printf(" -T, --trace Trace all called ioctls.\n"); printf(" -v, --verbose Turn on verbose reporting.\n"); + printf(" --version Show version information.\n"); #ifndef NO_LIBV4L2 printf(" -w, --wrapper Use the libv4l2 wrapper library.\n"); #endif @@ -1482,12 +1500,6 @@ int main(int argc, char **argv) char *value, *subs; int idx = 0; -#define STR(x) #x -#define STRING(x) STR(x) - printf("v4l2-compliance SHA: %s", STRING(GIT_SHA)); - printf(", %zd bits, %zd-bit time_t\n", sizeof(void *) * 8, sizeof(time_t) * 8); - printf("\n"); - if (!env_media_apps_color || !strcmp(env_media_apps_color, "auto")) show_colors = isatty(STDOUT_FILENO); else if (!strcmp(env_media_apps_color, "always")) @@ -1656,6 +1668,10 @@ int main(int argc, char **argv) case OptNoProgress: no_progress = true; break; + case OptVersion: + print_version(); + print_sha(); + std::exit(EXIT_SUCCESS); case ':': fprintf(stderr, "Option `%s' requires a value\n", argv[optind]); @@ -1677,6 +1693,9 @@ int main(int argc, char **argv) usage(); std::exit(EXIT_FAILURE); } + + print_sha(); + bool direct = !options[OptUseWrapper]; int fd; From patchwork Wed Jul 15 10:26:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 65504 Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1jveY2-00FxhK-KR; Wed, 15 Jul 2020 10:21:59 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729154AbgGOK04 (ORCPT + 1 other); Wed, 15 Jul 2020 06:26:56 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:53418 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728132AbgGOK04 (ORCPT ); Wed, 15 Jul 2020 06:26:56 -0400 Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8584D595; Wed, 15 Jul 2020 12:26:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1594808814; bh=qtNY5VitZDMUUhrhbQmXzCTqX4RQXjpfC6pVBlwAu6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XqV+Y9fFpidU1N/cjKIvQ7WXS7mP3fLKgskFDGQt46Fv9v9GqQJ7VDnGO2hq8rVmj BTDHFv4WWlwAYpKs/oTJXF4HhZbFJ+ZMPtTesKzEjDThW7ofQJPeyB+pTb0NQlFZ1h p4/qP9owaOAnOMYRtZI528pQp7ojdwcaW4kXfjzM= From: Paul Elder To: linux-media@vger.kernel.org Cc: Paul Elder , laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl Subject: [PATCH v5 2/5] v4l2-ctl: Add version command Date: Wed, 15 Jul 2020 19:26:37 +0900 Message-Id: <20200715102640.17554-2-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200715102640.17554-1-paul.elder@ideasonboard.com> References: <20200715102640.17554-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 X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no Add a --version option to v4l2-ctl to retrieve the version of v4l2-ctl. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- Changes in v5: - update manpage Changes in v4: - add git commit count to version Changes in v3: - embed PACKAGE_VERSION instead of string concatenation --- utils/v4l2-ctl/Makefile.am | 2 +- utils/v4l2-ctl/v4l2-ctl-common.cpp | 1 + utils/v4l2-ctl/v4l2-ctl.1.in | 3 +++ utils/v4l2-ctl/v4l2-ctl.cpp | 11 +++++++++++ utils/v4l2-ctl/v4l2-ctl.h | 1 + 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/utils/v4l2-ctl/Makefile.am b/utils/v4l2-ctl/Makefile.am index 3ba3c96b..04d30894 100644 --- a/utils/v4l2-ctl/Makefile.am +++ b/utils/v4l2-ctl/Makefile.am @@ -14,7 +14,7 @@ v4l2_ctl_SOURCES = v4l2-ctl.cpp v4l2-ctl.h v4l2-ctl-common.cpp v4l2-ctl-tuner.cp v4l2-ctl-streaming.cpp v4l2-ctl-sdr.cpp v4l2-ctl-edid.cpp v4l2-ctl-modes.cpp \ v4l2-ctl-subdev.cpp v4l2-tpg-colors.c v4l2-tpg-core.c v4l-stream.c v4l2-ctl-meta.cpp \ media-info.cpp v4l2-info.cpp codec-fwht.c codec-v4l2-fwht.c -v4l2_ctl_CPPFLAGS = -I$(top_srcdir)/utils/common +v4l2_ctl_CPPFLAGS = -I$(top_srcdir)/utils/common $(GIT_COMMIT_CNT) media-bus-format-names.h: $(top_srcdir)/include/linux/media-bus-format.h sed -e '/#define MEDIA_BUS_FMT/ ! d; s/.*FMT_//; /FIXED/ d; s/\t.*//; s/.*/{ \"&\", MEDIA_BUS_FMT_& },/;' \ 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.1.in b/utils/v4l2-ctl/v4l2-ctl.1.in index e9fff788..b8cbe6d2 100644 --- a/utils/v4l2-ctl/v4l2-ctl.1.in +++ b/utils/v4l2-ctl/v4l2-ctl.1.in @@ -21,6 +21,9 @@ with the bus info string as specified by the \fB-z\fR option. \fB\-v\fR, \fB\-\-verbose\fR Turn on verbose reporting. .TP +\fB\-\-version\fR +Show version information. +.TP \fB\-w\fR, \fB\-\-wrapper\fR Use the libv4l2 wrapper library for all V4L2 device accesses. By default v4l2-ctl will directly access the V4L2 device, but with this option all access will go via this diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp index 4972591e..321d2d1c 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,13 @@ static void usage_all() edid_usage(); } +static void print_version() +{ +#define STR(x) #x +#define STRING(x) STR(x) + printf("v4l2-ctl %s%s\n", PACKAGE_VERSION, STRING(GIT_COMMIT_CNT)); +} + int test_ioctl(int fd, unsigned long cmd, void *arg) { return options[OptUseWrapper] ? v4l2_ioctl(fd, cmd, arg) : ioctl(fd, cmd, arg); @@ -1245,6 +1253,9 @@ int main(int argc, char **argv) case OptSleep: secs = strtoul(optarg, 0L, 0); break; + case OptVersion: + print_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 }; From patchwork Wed Jul 15 10:26:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 65507 Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1jveYF-00Fxhl-Of; Wed, 15 Jul 2020 10:22:12 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731147AbgGOK1G (ORCPT + 1 other); Wed, 15 Jul 2020 06:27:06 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:53422 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729167AbgGOK07 (ORCPT ); Wed, 15 Jul 2020 06:26:59 -0400 Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 012BD564; Wed, 15 Jul 2020 12:26:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1594808816; bh=YKf80gNJ1vPiHZZptZDpJkKBoIHqbkZgneSXs9ywNgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VnfzssQbJcUxL9zLoL6c4sKhnwnyBKV33AJrmQAJB/dt3J4AXyBDFupGX51akdFka lC/iN/QjnWvWF2EIC4c9CydUR/BUSKRD5JhPyCwzK0HeykmpabasPEyRXrhvWnzbyJ /Fk/wixDhb8nRNAF1tIq4a+cInUdYA3rK3hQDdXU= From: Paul Elder To: linux-media@vger.kernel.org Cc: Paul Elder , laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl Subject: [PATCH v5 3/5] cec-compliance: Add version command Date: Wed, 15 Jul 2020 19:26:38 +0900 Message-Id: <20200715102640.17554-3-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200715102640.17554-1-paul.elder@ideasonboard.com> References: <20200715102640.17554-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 X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no Add a --version option to cec-compliance to retrieve the version of cec-compliance. While at it, factor out printing the SHA. Signed-off-by: Paul Elder --- Changes in v5: - update manpage - move STR macros to before print_sha() Changes in v4: - add git commit count to version Changes in v3: - embed PACKAGE_VERSION instead of string concatenation --- utils/cec-compliance/Makefile.am | 2 +- utils/cec-compliance/cec-compliance.1.in | 3 +++ utils/cec-compliance/cec-compliance.cpp | 25 +++++++++++++++++++++--- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/utils/cec-compliance/Makefile.am b/utils/cec-compliance/Makefile.am index 57ed7b37..a9c59ca6 100644 --- a/utils/cec-compliance/Makefile.am +++ b/utils/cec-compliance/Makefile.am @@ -2,7 +2,7 @@ bin_PROGRAMS = cec-compliance man_MANS = cec-compliance.1 cec_compliance_SOURCES = cec-compliance.cpp cec-compliance.h cec-test.cpp cec-test-adapter.cpp cec-test-audio.cpp cec-test-power.cpp cec-test-fuzzing.cpp -cec_compliance_CPPFLAGS = -I$(top_srcdir)/utils/libcecutil $(GIT_SHA) +cec_compliance_CPPFLAGS = -I$(top_srcdir)/utils/libcecutil $(GIT_SHA) $(GIT_COMMIT_CNT) cec_compliance_LDADD = -lrt ../libcecutil/libcecutil.la EXTRA_DIST = cec-compliance.1 diff --git a/utils/cec-compliance/cec-compliance.1.in b/utils/cec-compliance/cec-compliance.1.in index 3f9c7d8b..94654858 100644 --- a/utils/cec-compliance/cec-compliance.1.in +++ b/utils/cec-compliance/cec-compliance.1.in @@ -119,6 +119,9 @@ check that the test produced no warnings. \fB\-v\fR, \fB\-\-verbose\fR Turn on verbose reporting. .TP +\fB\-\-version\fR +Show version information. +.TP \fB\-w\fR, \fB\-\-wall\-clock\fR Show timestamps as wall-clock time. This also turns on verbose reporting. .TP diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp index bfd82af7..618e3160 100644 --- a/utils/cec-compliance/cec-compliance.cpp +++ b/utils/cec-compliance/cec-compliance.cpp @@ -93,6 +93,8 @@ enum Option { OptSkipTestTunerControl, OptSkipTestVendorSpecificCommands, OptSkipTestStandbyResume, + + OptVersion, OptLast = 256 }; @@ -174,9 +176,23 @@ static struct option long_options[] = { {"skip-test-tuner-control", no_argument, 0, OptSkipTestTunerControl}, {"skip-test-vendor-specific-commands", no_argument, 0, OptSkipTestVendorSpecificCommands}, {"skip-test-standby-resume", no_argument, 0, OptSkipTestStandbyResume}, + {"version", no_argument, 0, OptVersion}, {0, 0, 0, 0} }; +#define STR(x) #x +#define STRING(x) STR(x) + +static void print_sha() +{ + printf("cec-compliance SHA : %s\n", STRING(GIT_SHA)); +} + +static void print_version() +{ + printf("cec-compliance %s%s\n", PACKAGE_VERSION, STRING(GIT_COMMIT_CNT)); +} + static void usage() { printf("Usage:\n" @@ -231,6 +247,7 @@ static void usage() " -s, --skip-info Skip Driver Info output\n" " -T, --trace Trace all called ioctls\n" " -v, --verbose Turn on verbose reporting\n" + " --version Show version information\n" " -w, --wall-clock Show timestamps as wall-clock time (implies -v)\n" " -W, --exit-on-warn Exit on the first warning.\n" ); @@ -1258,6 +1275,10 @@ int main(int argc, char **argv) case OptVerbose: show_info = true; break; + case OptVersion: + print_version(); + print_sha(); + std::exit(EXIT_SUCCESS); case ':': fprintf(stderr, "Option '%s' requires a value\n", argv[optind]); @@ -1392,9 +1413,7 @@ int main(int argc, char **argv) if (options[OptInteractive]) test_tags |= TAG_INTERACTIVE; -#define STR(x) #x -#define STRING(x) STR(x) - printf("cec-compliance SHA : %s\n", STRING(GIT_SHA)); + print_sha(); node.phys_addr = CEC_PHYS_ADDR_INVALID; doioctl(&node, CEC_ADAP_G_PHYS_ADDR, &node.phys_addr); From patchwork Wed Jul 15 10:26:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 65505 Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1jveY8-00Fxhl-NF; Wed, 15 Jul 2020 10:22:05 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731116AbgGOK1C (ORCPT + 1 other); Wed, 15 Jul 2020 06:27:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728132AbgGOK1A (ORCPT ); Wed, 15 Jul 2020 06:27:00 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80F41C061755 for ; Wed, 15 Jul 2020 03:27:00 -0700 (PDT) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6F454E06; Wed, 15 Jul 2020 12:26:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1594808819; bh=akm130KVecOIp6kBJe7Wog8H9i50UiQ6euxHTasVoRI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RHmSut8pJ3pPD6Z+MqaO9VqzN4Tmu8TweTHyUfE5fGwiXovELLKKCA2cBrHIonBFy 9a9laEwPE0oaATqPVma7d0KJ+9YxX2YF0p54gdGlR1uiWjtKIal3Uz0MX0qnJYwCb/ D+bTVj8be2PtBBhJHBg5c3hSAF2kcMsVxmWJ+ySA= From: Paul Elder To: linux-media@vger.kernel.org Cc: Paul Elder , laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl Subject: [PATCH v5 4/5] cec-ctl: Add version command Date: Wed, 15 Jul 2020 19:26:39 +0900 Message-Id: <20200715102640.17554-4-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200715102640.17554-1-paul.elder@ideasonboard.com> References: <20200715102640.17554-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 X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no Add a --version option to cec-ctl to retrieve the version of cec-ctl. Signed-off-by: Paul Elder --- Changes in v5: - update manpage Changes in v4: - add git commit count to version Changes in v3: - embed PACKAGE_VERSION instead of string concatenation --- utils/cec-ctl/Makefile.am | 2 +- utils/cec-ctl/cec-ctl.1.in | 3 +++ utils/cec-ctl/cec-ctl.cpp | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/utils/cec-ctl/Makefile.am b/utils/cec-ctl/Makefile.am index 24341ed7..278fcc47 100644 --- a/utils/cec-ctl/Makefile.am +++ b/utils/cec-ctl/Makefile.am @@ -2,7 +2,7 @@ bin_PROGRAMS = cec-ctl man_MANS = cec-ctl.1 cec_ctl_SOURCES = cec-ctl.cpp cec-pin.cpp cec-ctl.h -cec_ctl_CPPFLAGS = -I$(top_srcdir)/utils/libcecutil +cec_ctl_CPPFLAGS = -I$(top_srcdir)/utils/libcecutil $(GIT_COMMIT_CNT) cec_ctl_LDADD = -lrt ../libcecutil/libcecutil.la EXTRA_DIST = cec-ctl.1 diff --git a/utils/cec-ctl/cec-ctl.1.in b/utils/cec-ctl/cec-ctl.1.in index f767b479..fac3a92e 100644 --- a/utils/cec-ctl/cec-ctl.1.in +++ b/utils/cec-ctl/cec-ctl.1.in @@ -52,6 +52,9 @@ having to rely on the device node number. \fB\-v\fR, \fB\-\-verbose\fR Turn on verbose reporting. .TP +\fB\-\-version\fR +Show version information. +.TP \fB\-w\fR, \fB\-\-wall\-clock\fR Show timestamps as wall-clock time. This also turns on verbose reporting. .TP diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp index 455cdaeb..47867f87 100644 --- a/utils/cec-ctl/cec-ctl.cpp +++ b/utils/cec-ctl/cec-ctl.cpp @@ -133,6 +133,7 @@ enum Option { OptVendorCommandWithID, OptVendorRemoteButtonDown, OptCustomCommand, + OptVersion, }; struct node { @@ -218,6 +219,8 @@ static struct option long_options[] = { { "unregistered", no_argument, 0, OptUnregistered }, { "help-all", no_argument, 0, OptHelpAll }, + { "version", no_argument, 0, OptVersion }, + CEC_PARSE_LONG_OPTS { "vendor-remote-button-down", required_argument, 0, OptVendorRemoteButtonDown }, \ @@ -231,6 +234,13 @@ static struct option long_options[] = { { 0, 0, 0, 0 } }; +static void print_version() +{ +#define STR(x) #x +#define STRING(x) STR(x) + printf("cec-ctl %s%s\n", PACKAGE_VERSION, STRING(GIT_COMMIT_CNT)); +} + static void usage() { printf("Usage:\n" @@ -262,6 +272,7 @@ static void usage() " --help-all Show all help messages\n" " -T, --trace Trace all called ioctls\n" " -v, --verbose Turn on verbose reporting\n" + " --version Show version information\n" " -w, --wall-clock Show timestamps as wall-clock time (implies -v)\n" " -W, --wait-for-msgs Wait for messages and events for up to --monitor-time secs.\n" " --cec-version-1.4 Use CEC Version 1.4 instead of 2.0\n" @@ -2296,6 +2307,10 @@ int main(int argc, char **argv) break; } + case OptVersion: + print_version(); + std::exit(EXIT_SUCCESS); + default: if (ch >= OptHelpAll) { cec_parse_usage_options(options); From patchwork Wed Jul 15 10:26:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 65506 Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1jveYE-00Fxhl-Fy; Wed, 15 Jul 2020 10:22:11 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731145AbgGOK1F (ORCPT + 1 other); Wed, 15 Jul 2020 06:27:05 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:53434 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728132AbgGOK1D (ORCPT ); Wed, 15 Jul 2020 06:27:03 -0400 Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DEC31595; Wed, 15 Jul 2020 12:26:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1594808821; bh=IwfFMnTOV5g3vCiBWGTV5hZOAerkISWY4Tqa0L/Oie8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fQl7bYpPKkrvknFyWQ7sLK0wZg8w2JOhMokqxN6yrPDER4rK3RVp/ZSpQkrZhtQ2z ZwTxA6sMuXbJL1v/uo7n52OPGA5WkYFrxN/ExgOv4Bb3Xppjyos91oVo/dZsjfXccO fu05d1ej8QUfK5xbTdy91EZEaW8odh37S6+I8WZM= From: Paul Elder To: linux-media@vger.kernel.org Cc: Paul Elder , laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl Subject: [PATCH v5 5/5] cec-follower: Add version command Date: Wed, 15 Jul 2020 19:26:40 +0900 Message-Id: <20200715102640.17554-5-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200715102640.17554-1-paul.elder@ideasonboard.com> References: <20200715102640.17554-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 X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no Add a --version option to cec-follower to retrieve the version of cec-follower. Whilte at it, factor out printing the SHA. Signed-off-by: Paul Elder --- Changes in v5: - update manpage Changes in v4: - add git commit count to version - move printing sha into print_sha() Changes in v3: - embed PACKAGE_VERSION instead of string concatenation --- utils/cec-follower/Makefile.am | 2 +- utils/cec-follower/cec-follower.1.in | 3 +++ utils/cec-follower/cec-follower.cpp | 30 +++++++++++++++++++++------- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/utils/cec-follower/Makefile.am b/utils/cec-follower/Makefile.am index a550cd1d..96e0f890 100644 --- a/utils/cec-follower/Makefile.am +++ b/utils/cec-follower/Makefile.am @@ -2,7 +2,7 @@ bin_PROGRAMS = cec-follower man_MANS = cec-follower.1 cec_follower_SOURCES = cec-follower.cpp cec-follower.h cec-processing.cpp cec-tuner.cpp -cec_follower_CPPFLAGS = -I$(top_srcdir)/utils/libcecutil +cec_follower_CPPFLAGS = -I$(top_srcdir)/utils/libcecutil $(GIT_COMMIT_CNT) cec_follower_LDADD = -lrt ../libcecutil/libcecutil.la cec-follower.cpp: version.h diff --git a/utils/cec-follower/cec-follower.1.in b/utils/cec-follower/cec-follower.1.in index 2836d6dd..61c591b3 100644 --- a/utils/cec-follower/cec-follower.1.in +++ b/utils/cec-follower/cec-follower.1.in @@ -61,6 +61,9 @@ having to rely on the device node number. \fB\-v\fR, \fB\-\-verbose\fR Turn on verbose reporting. .TP +\fB\-\-version\fR +Show version information. +.TP \fB\-w\fR, \fB\-\-wall\-clock\fR Show timestamps as wall-clock time. This also turns on verbose reporting. .TP diff --git a/utils/cec-follower/cec-follower.cpp b/utils/cec-follower/cec-follower.cpp index 9cead57a..b3f9d615 100644 --- a/utils/cec-follower/cec-follower.cpp +++ b/utils/cec-follower/cec-follower.cpp @@ -46,6 +46,7 @@ enum Option { OptShowState = 's', OptWallClock = 'w', OptServiceByDigID = 128, + OptVersion, OptLast = 256 }; @@ -70,10 +71,27 @@ static struct option long_options[] = { { "wall-clock", no_argument, 0, OptWallClock }, { "service-by-dig-id", no_argument, 0, OptServiceByDigID }, { "ignore", required_argument, 0, OptIgnore }, + { "version", no_argument, 0, OptVersion }, { 0, 0, 0, 0 } }; +static void print_sha() +{ +#ifdef SHA +#define STR(x) #x +#define STRING(x) STR(x) + printf("cec-follower SHA : %s\n", STRING(SHA)); +#else + printf("cec-follower SHA : not available\n"); +#endif +} + +static void print_version() +{ + printf("cec-follower %s%s\n", PACKAGE_VERSION, STRING(GIT_COMMIT_CNT)); +} + static void usage() { printf("Usage:\n" @@ -93,6 +111,7 @@ static void usage() " Ignore messages from logical address and opcode\n" " . 'all' can be used for or to match\n" " all logical addresses or opcodes.\n" + " --version Show version information\n" ); } @@ -427,6 +446,9 @@ int main(int argc, char **argv) show_msgs = true; show_state = true; break; + case OptVersion: + print_version(); + std::exit(EXIT_SUCCESS); case ':': fprintf(stderr, "Option '%s' requires a value\n", argv[optind]); @@ -475,13 +497,7 @@ int main(int argc, char **argv) node.state.service_by_dig_id = options[OptServiceByDigID]; state_init(node); -#ifdef SHA -#define STR(x) #x -#define STRING(x) STR(x) - printf("cec-follower SHA : %s\n", STRING(SHA)); -#else - printf("cec-follower SHA : not available\n"); -#endif + print_sha(); doioctl(&node, CEC_ADAP_G_PHYS_ADDR, &node.phys_addr);