diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2008-09-05 08:27:28 +0200 |
---|---|---|
committer | Hans Verkuil <hverkuil@xs4all.nl> | 2008-09-05 08:27:28 +0200 |
commit | 89bf8cd11f914eff585c23797fd88a641b9cb3dd (patch) | |
tree | 078304e5092981bf7cfd5d29553336a525d80fe9 /v4l2-apps/util | |
parent | 9b4cd8c0a62769d3c668e00f4202dfd57b66f765 (diff) | |
download | mediapointer-dvb-s2-89bf8cd11f914eff585c23797fd88a641b9cb3dd.tar.gz mediapointer-dvb-s2-89bf8cd11f914eff585c23797fd88a641b9cb3dd.tar.bz2 |
v4l2-ctl: improve error reporting
From: Hans Verkuil <hverkuil@xs4all.nl>
Based on a similar patch from Jean Delvare.
By default errors are shown. --verbose also reports successful calls and
--silent suppresses the output altogether, only returning an application
error code.
Priority: normal
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'v4l2-apps/util')
-rw-r--r-- | v4l2-apps/util/v4l2-ctl.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/v4l2-apps/util/v4l2-ctl.cpp b/v4l2-apps/util/v4l2-ctl.cpp index ae9293414..1c765cf96 100644 --- a/v4l2-apps/util/v4l2-ctl.cpp +++ b/v4l2-apps/util/v4l2-ctl.cpp @@ -93,6 +93,7 @@ enum Option { OptListFormats, OptLogStatus, OptVerbose, + OptSilent, OptGetVideoOutFormat, OptSetVideoOutFormat, OptGetSlicedVbiCap, @@ -291,15 +292,15 @@ static void usage(void) " set the video capture format [VIDIOC_S_FMT]\n" " pixelformat is either the format index as reported by\n" " --list-formats, or the fourcc value as a string\n" - " --verbose turn on verbose ioctl error reporting.\n" + " --silent only set the result code, do not print any messages\n" + " --verbose turn on verbose ioctl status reporting\n" "\n"); printf("Uncommon options:\n" " --get-fmt-video-out\n" " query the video output format [VIDIOC_G_FMT]\n" " --set-fmt-video-out=width=<w>,height=<h>\n" " set the video output format [VIDIOC_S_FMT]\n" - " --get-fmt-overlay\n" - " query the video overlay format [VIDIOC_G_FMT]\n" + " --get-fmt-overlay query the video overlay format [VIDIOC_G_FMT]\n" " --get-fmt-output-overlay\n" " query the video output overlay format [VIDIOC_G_FMT]\n" " --set-fmt-output-overlay=chromakey=<key>,global_alpha=<alpha>\n" @@ -1017,12 +1018,11 @@ static int doioctl(int fd, int request, void *parm, const char *name) if (retVal < 0) { app_result = -1; } - if (!options[OptVerbose]) return retVal; - printf("%s: ", name); + if (options[OptSilent]) return retVal; if (retVal < 0) - printf("failed: %s\n", strerror(errno)); - else - printf("ok\n"); + printf("%s: failed: %s\n", name, strerror(errno)); + else if (options[OptVerbose]) + printf("%s: ok\n", name); return retVal; } |