From patchwork Tue Jul 14 05:59:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 65441 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1jvDtv-00EO8T-N9; Tue, 14 Jul 2020 05:55:01 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725884AbgGNF7k (ORCPT + 1 other); Tue, 14 Jul 2020 01:59:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725306AbgGNF7j (ORCPT ); Tue, 14 Jul 2020 01:59:39 -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 77745C061755 for ; Mon, 13 Jul 2020 22:59:39 -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 879F8564; Tue, 14 Jul 2020 07:59:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1594706377; bh=WDoRO9NPR4MOKJ4HxQQ9ebMJzu2nlO4yiSFWk8VgQgo=; h=From:To:Cc:Subject:Date:From; b=v7fgZ4jziq42OLOHzqHfJB5HMdiqDbqKum6DS0uqMXivH+D6wOUnoaccrlgNDydy0 Gc9NRbpKSvEA0LRggJseafIVtxoCPctPvMqPV/pkCurQ8pt+XUEV492nAk1yJVFhER wHekxDJcirkwhQnXBofxVQ5B3LSRPerHbC32fRqo= From: Paul Elder To: linux-media@vger.kernel.org Cc: Paul Elder , laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl Subject: [PATCH v4 1/7] configure.ac: Export git commit count Date: Tue, 14 Jul 2020 14:59:09 +0900 Message-Id: <20200714055915.640438-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 Export the git commit count from configure.ac to append to version numbers in the various utils. Signed-off-by: Paul Elder --- New in v4 --- configure.ac | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure.ac b/configure.ac index 36fa6ec8..b3b090f2 100644 --- a/configure.ac +++ b/configure.ac @@ -574,6 +574,9 @@ CPPFLAGS="-I\$(top_srcdir)/lib/include -Wall -Wpointer-arith -D_GNU_SOURCE $CPPF # Obtain git SHA of HEAD AC_SUBST(GIT_SHA, ["-DGIT_SHA=\$(shell if test -d \$(top_srcdir)/.git ; then git -C \$(top_srcdir) rev-parse HEAD ; else printf '\"not available\"'; fi)"]) +# Obtain git commit count of HEAD +AC_SUBST(GIT_COMMIT_CNT, ["-DGIT_COMMIT_CNT=\$(shell if test -d \$(top_srcdir)/.git ; then printf '-'; git -C \$(top_srcdir) rev-list --count HEAD ; fi)"]) + AM_COND_IF([WITH_LIBDVBV5], [USE_LIBDVBV5="yes"], [USE_LIBDVBV5="no"]) AM_COND_IF([WITH_DVBV5_REMOTE], [USE_DVBV5_REMOTE="yes" AC_DEFINE([HAVE_DVBV5_REMOTE], [1], [Usage of DVBv5 remote enabled])], From patchwork Tue Jul 14 05:59:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 65442 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1jvDuA-00EO8T-8z; Tue, 14 Jul 2020 05:55:02 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726375AbgGNF7m (ORCPT + 1 other); Tue, 14 Jul 2020 01:59:42 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:60702 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725306AbgGNF7l (ORCPT ); Tue, 14 Jul 2020 01:59:41 -0400 Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 14EB271D; Tue, 14 Jul 2020 07:59:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1594706379; bh=Ew+SsarMu06l/V7xcnho8PBeFWv4Nh4eKcverwPsXYQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mxaHboOe4OSI17Q9Ru5hiI659GJDdSNUYkEN2w7hUjRvZrxY0yTSpkH2zNwfxRq35 /JnW84c9b+NzWQGH87oetv7f08/wOi5DGSumufvgawFNVKb3fo8/QhpolcMNplH2Mf l1uECsoCDfcmp1beo4VD15+xlOOiZaJXzx9Ix0/I= From: Paul Elder To: linux-media@vger.kernel.org Cc: Paul Elder , laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl Subject: [PATCH v4 2/7] v4l2-compliance: Add version command Date: Tue, 14 Jul 2020 14:59:10 +0900 Message-Id: <20200714055915.640438-2-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200714055915.640438-1-paul.elder@ideasonboard.com> References: <20200714055915.640438-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-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 v4: - add git commit count to version Changes in v3: - embed PACKAGE_VERSION instead of string concatenation --- utils/v4l2-compliance/v4l2-compliance.cpp | 30 ++++++++++++++++++----- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp index 825f2aa6..97c79e40 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,24 @@ 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} }; +static void print_sha() +{ +#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"); +} + +static void print_version() +{ + printf("v4l2-compliance %s%s\n", PACKAGE_VERSION, STRING(GIT_COMMIT_CNT)); +} + static void usage() { printf("Usage:\n"); @@ -241,6 +257,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 +1499,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 +1667,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 +1692,9 @@ int main(int argc, char **argv) usage(); std::exit(EXIT_FAILURE); } + + print_sha(); + bool direct = !options[OptUseWrapper]; int fd; From patchwork Tue Jul 14 05:59:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 65443 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1jvDuB-00EO8T-Aq; Tue, 14 Jul 2020 05:55:07 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726534AbgGNF7o (ORCPT + 1 other); Tue, 14 Jul 2020 01:59:44 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:60712 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725306AbgGNF7o (ORCPT ); Tue, 14 Jul 2020 01:59:44 -0400 Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9DCB2A4F; Tue, 14 Jul 2020 07:59:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1594706382; bh=2kfshqtIjbsJ4rDoA+mfI3AsdJvjTGc1ptuh239GqQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MoDgTEZXz/11Hbp+yOAd9aZq06Zr3bTFn2f4Ux87Bik3UH9qjXklDJESEmRmNoamQ 6DGdWQ8KgzrSkKPMv9sjeXAXWmK/CxWsEDz3/u50WZxmsTWbXheuiAtaEgDyubMlY7 zi95FC1NC4BziqTXWPMdY8IkInoBapxqbmcybbaU= From: Paul Elder To: linux-media@vger.kernel.org Cc: Paul Elder , laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl Subject: [PATCH v4 3/7] v4l2-ctl: Add version command Date: Tue, 14 Jul 2020 14:59:11 +0900 Message-Id: <20200714055915.640438-3-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200714055915.640438-1-paul.elder@ideasonboard.com> References: <20200714055915.640438-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 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.cpp | 11 +++++++++++ utils/v4l2-ctl/v4l2-ctl.h | 1 + 4 files changed, 14 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.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 Tue Jul 14 05:59:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 65444 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1jvDuG-00EO8T-FU; Tue, 14 Jul 2020 05:55:08 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726600AbgGNF7r (ORCPT + 1 other); Tue, 14 Jul 2020 01:59:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725306AbgGNF7q (ORCPT ); Tue, 14 Jul 2020 01:59:46 -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 811A0C061755 for ; Mon, 13 Jul 2020 22:59:46 -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 32A5610F6; Tue, 14 Jul 2020 07:59:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1594706385; bh=RsVzL03OgvwHmPd/jTtzggaVpAKmI5kdjbxzqEjUDl8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SJ0Y7HBZtb2L5//mJ2yYAh9v3izHI+rlh1+3cDybOdQVp23AsnoqgdKAMRoBFXXuE LUQGfTvbNWr7/nqESewLde2TeMWMdg4ir/oCFag8HbAcUtkfqgqBy4g7g5vJiyQ9el MTKLkarXqLJJyM6OwkFHb4SPcUCKeRJe4HAM4mRY= From: Paul Elder To: linux-media@vger.kernel.org Cc: Paul Elder , laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl Subject: [PATCH v4 4/7] cec-compliance: Add version command Date: Tue, 14 Jul 2020 14:59:12 +0900 Message-Id: <20200714055915.640438-4-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200714055915.640438-1-paul.elder@ideasonboard.com> References: <20200714055915.640438-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 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.cpp | 24 +++++++++++++++++++++--- 2 files changed, 22 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.cpp b/utils/cec-compliance/cec-compliance.cpp index bfd82af7..9be86510 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,22 @@ 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} }; +static void print_sha() +{ +#define STR(x) #x +#define STRING(x) STR(x) + 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 +246,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 +1274,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 +1412,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 Tue Jul 14 05:59: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: 65445 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1jvDuH-00EO8T-Ie; Tue, 14 Jul 2020 05:55:10 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726630AbgGNF7t (ORCPT + 1 other); Tue, 14 Jul 2020 01:59:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726624AbgGNF7t (ORCPT ); Tue, 14 Jul 2020 01:59:49 -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 32E11C061755 for ; Mon, 13 Jul 2020 22:59:49 -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 ED222564; Tue, 14 Jul 2020 07:59:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1594706387; bh=VDyPv0rI43O2UPAM58wXMz3fERL1nW/ES3b7rZ8qS0w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sqvqypdj+S3MG2syB/zB4t9FY7RKX+5px6CKwhkNcJiKLMYjnlWpObS153hbLNKHF FhnH3M4D2YD/scvphWCcr2VUnVhICedrB5roIsQUMnRxafeqrnksWkhyrln8UJrlKe qtAsVlFeOnWviS5gGLHYfwCDzGoHOpTNpQ1woaO4= From: Paul Elder To: linux-media@vger.kernel.org Cc: Paul Elder , laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl Subject: [PATCH v4 5/7] cec-ctl: Add version command Date: Tue, 14 Jul 2020 14:59:13 +0900 Message-Id: <20200714055915.640438-5-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200714055915.640438-1-paul.elder@ideasonboard.com> References: <20200714055915.640438-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 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.cpp | 15 +++++++++++++++ 2 files changed, 16 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.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 Tue Jul 14 05:59:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 65446 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1jvDuI-00EO8T-RM; Tue, 14 Jul 2020 05:55:11 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726720AbgGNF7x (ORCPT + 1 other); Tue, 14 Jul 2020 01:59:53 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:60724 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726660AbgGNF7w (ORCPT ); Tue, 14 Jul 2020 01:59:52 -0400 Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9BD7C71D; Tue, 14 Jul 2020 07:59:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1594706390; bh=WVoyuNxYcQAIY1RC6HRI/CXzlU+bsZNkVU//gh6FCzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dQwt0UGiqkKRLhdsJVsjoSvZcFUNHhXVcxWH53BLyoevcGiLQ0mxNKWnaHZw14fCe D/gv53jd0AZbbrvgtrXj5/HpUKIOCjb1VlbgLnLypJOrxFTG8JMPeubx6dvDkBxh3S YLZDxpyG7l70wY6JfNb8X0IvFCOsN3/KWiP9+9ek= From: Paul Elder To: linux-media@vger.kernel.org Cc: Paul Elder , laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl Subject: [PATCH v4 6/7] cec-follower: Add version command Date: Tue, 14 Jul 2020 14:59:14 +0900 Message-Id: <20200714055915.640438-6-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200714055915.640438-1-paul.elder@ideasonboard.com> References: <20200714055915.640438-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 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.cpp | 30 ++++++++++++++++++++++------- 2 files changed, 24 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.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); From patchwork Tue Jul 14 05:59:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 65447 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1jvDuJ-00EO8T-VO; Tue, 14 Jul 2020 05:55:12 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726722AbgGNF7z (ORCPT + 1 other); Tue, 14 Jul 2020 01:59:55 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:60728 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726660AbgGNF7z (ORCPT ); Tue, 14 Jul 2020 01:59:55 -0400 Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4868B564; Tue, 14 Jul 2020 07:59:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1594706393; bh=leaVOcVC0KbhrxAshuXz6qhHxu+s6tSVrZ9onCPA+CU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M7DtmvbGnBhPE+NZX2kZcjJ3zKZeKtARUFFqEmxsrtYqPhbU59e+h7KvoawT12x/P aoJkzb8rv7BJ4NouDy2Re1R8wmiE8Q9lYmftA2xFkkZ6JdHfIIuv4jXhTrIInwi8rh /SoDuFdWMPDEwc/UfkhnAIEYHvxcIwlWgOADmgfs= From: Paul Elder To: linux-media@vger.kernel.org Cc: Paul Elder , laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl Subject: [PATCH v4 7/7] media-ctl: Add version command Date: Tue, 14 Jul 2020 14:59:15 +0900 Message-Id: <20200714055915.640438-7-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200714055915.640438-1-paul.elder@ideasonboard.com> References: <20200714055915.640438-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 media-ctl to retrieve the version of media-ctl. Signed-off-by: Paul Elder --- Changes in v4: - add git commit count to version Changes in v3: - embed PACKAGE_VERSION instead of string concatenation --- utils/media-ctl/Makefile.am | 1 + utils/media-ctl/options.c | 14 ++++++++++++++ utils/media-ctl/options.h | 2 ++ 3 files changed, 17 insertions(+) diff --git a/utils/media-ctl/Makefile.am b/utils/media-ctl/Makefile.am index ee7dcc96..860e6f5a 100644 --- a/utils/media-ctl/Makefile.am +++ b/utils/media-ctl/Makefile.am @@ -27,3 +27,4 @@ noinst_HEADERS = mediactl.h v4l2subdev.h bin_PROGRAMS = media-ctl media_ctl_SOURCES = media-ctl.c options.c options.h tools.h media_ctl_LDADD = libmediactl.la libv4l2subdev.la +media_ctl_CFLAGS = $(GIT_COMMIT_CNT) diff --git a/utils/media-ctl/options.c b/utils/media-ctl/options.c index fb923775..55376323 100644 --- a/utils/media-ctl/options.c +++ b/utils/media-ctl/options.c @@ -42,6 +42,13 @@ struct media_options media_opts = { .devname = MEDIA_DEVNAME_DEFAULT, }; +static void print_version() +{ +#define STR(x) #x +#define STRING(x) STR(x) + printf("media-ctl %s%s\n", PACKAGE_VERSION, STRING(GIT_COMMIT_CNT)); +} + static void usage(const char *argv0) { unsigned int i; @@ -66,6 +73,7 @@ static void usage(const char *argv0) printf(" --print-dot Print the device topology as a dot graph\n"); printf("-r, --reset Reset all links to inactive\n"); printf("-v, --verbose Be verbose\n"); + printf(" --version Show version information\n"); printf("\n"); printf("Links and formats are defined as\n"); printf("\tlinks = link { ',' link } ;\n"); @@ -127,6 +135,7 @@ static void usage(const char *argv0) #define OPT_SET_DV 258 #define OPT_LIST_KNOWN_MBUS_FMTS 259 #define OPT_GET_DV 260 +#define OPT_VERSION 261 static struct option opts[] = { {"device", 1, 0, 'd'}, @@ -145,6 +154,7 @@ static struct option opts[] = { {"print-topology", 0, 0, 'p'}, {"reset", 0, 0, 'r'}, {"verbose", 0, 0, 'v'}, + {"version", 0, 0, OPT_VERSION}, { }, }; @@ -287,6 +297,10 @@ int parse_cmdline(int argc, char **argv) list_known_mbus_formats(); exit(0); + case OPT_VERSION: + print_version(); + exit(0); + default: printf("Invalid option -%c\n", opt); printf("Run %s -h for help.\n", argv[0]); diff --git a/utils/media-ctl/options.h b/utils/media-ctl/options.h index 7e0556fc..b1751f56 100644 --- a/utils/media-ctl/options.h +++ b/utils/media-ctl/options.h @@ -22,6 +22,8 @@ #ifndef __OPTIONS_H #define __OPTIONS_H +#include + struct media_options { const char *devname;