This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/v4l-utils.git tree:
Subject: v4l2-ctl: only show common options by default. Author: Hans Verkuil <[email protected]> Date: Mon Jul 23 11:01:13 2012 +0200 And add new help options to see the various help categories. This should simplify the use of v4l2-ctl. Signed-off-by: Hans Verkuil <[email protected]> (cherry picked from commit 776d563cc3eca9db9c9b101d0cf822ec9364c32d) Signed-off-by: Gregor Jasny <[email protected]> utils/v4l2-ctl/v4l2-ctl.cpp | 117 ++++++++++++++++++++++++++++++------------- 1 files changed, 82 insertions(+), 35 deletions(-) --- http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=4302d166a013f3306e31abbf128b607139bbc72a diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp index 682a7a8..ad64751 100644 --- a/utils/v4l2-ctl/v4l2-ctl.cpp +++ b/utils/v4l2-ctl/v4l2-ctl.cpp @@ -178,6 +178,16 @@ enum Option { OptDecoderCmd, OptTryDecoderCmd, OptTunerIndex, + OptHelpTuner, + OptHelpIO, + OptHelpStds, + OptHelpVidCap, + OptHelpVidOut, + OptHelpOverlay, + OptHelpVbi, + OptHelpSelection, + OptHelpMisc, + OptHelpAll, OptLast = 256 }; @@ -258,6 +268,16 @@ static struct option long_options[] = { {"set-fmt-video-out-mplane", required_argument, 0, OptSetVideoOutMplaneFormat}, {"try-fmt-video-out-mplane", required_argument, 0, OptTryVideoOutMplaneFormat}, {"help", no_argument, 0, OptHelp}, + {"help-tuner", no_argument, 0, OptHelpTuner}, + {"help-io", no_argument, 0, OptHelpIO}, + {"help-stds", no_argument, 0, OptHelpStds}, + {"help-vidcap", no_argument, 0, OptHelpVidCap}, + {"help-vidout", no_argument, 0, OptHelpVidOut}, + {"help-overlay", no_argument, 0, OptHelpOverlay}, + {"help-vbi", no_argument, 0, OptHelpVbi}, + {"help-selection", no_argument, 0, OptHelpSelection}, + {"help-misc", no_argument, 0, OptHelpMisc}, + {"help-all", no_argument, 0, OptHelpAll}, {"wrapper", no_argument, 0, OptUseWrapper}, {"get-output", no_argument, 0, OptGetOutput}, {"set-output", required_argument, 0, OptSetOutput}, @@ -363,12 +383,7 @@ static struct option long_options[] = { {0, 0, 0, 0} }; -static void usage_hint(void) -{ - fprintf(stderr, "Try 'v4l2-ctl --help' for more information.\n"); -} - -static void usage_common(void) +static void usage(void) { printf("\nGeneral/Common options:\n" " --all display all information available\n" @@ -380,6 +395,16 @@ static void usage_common(void) " -d, --device=<dev> use device <dev> instead of /dev/video0\n" " if <dev> is a single digit, then /dev/video<dev> is used\n" " -h, --help display this help message\n" + " --help-all all options\n" + " --help-io input/output options\n" + " --help-misc miscellaneous options\n" + " --help-overlay overlay format options\n" + " --help-selection crop/selection options\n" + " --help-stds standards and other video timings options\n" + " --help-tuner tuner/modulator options\n" + " --help-vbi VBI format options\n" + " --help-vidcap video capture format options\n" + " --help-vidout vidout output format options\n" " -l, --list-ctrls display all controls and their values [VIDIOC_QUERYCTRL]\n" " -L, --list-ctrls-menus\n" " display all controls and their menus [VIDIOC_QUERYMENU]\n" @@ -616,9 +641,9 @@ static void usage_vbi(void) ); } -static void usage_crop(void) +static void usage_selection(void) { - printf("\nCropping options:\n" + printf("\nSelection/Cropping options:\n" " --get-cropcap query the crop capabilities [VIDIOC_CROPCAP]\n" " --get-crop query the video capture crop window [VIDIOC_G_CROP]\n" " --set-crop=top=<x>,left=<y>,width=<w>,height=<h>\n" @@ -640,12 +665,6 @@ static void usage_crop(void) " query the video output overlay crop window [VIDIOC_G_CROP]\n" " --set-crop-output-overlay=top=<x>,left=<y>,width=<w>,height=<h>\n" " set the video output overlay crop window [VIDIOC_S_CROP]\n" - ); -} - -static void usage_selection(void) -{ - printf("\nSelection options:\n" " --get-selection=target=<target>\n" " query the video capture selection rectangle [VIDIOC_G_SELECTION]\n" " See --set-selection command for the valid <target> values.\n" @@ -709,20 +728,18 @@ static void usage_misc(void) ); } -static void usage(void) +static void usage_all(void) { - printf("Usage:\n"); - usage_common(); - usage_tuner(); - usage_io(); - usage_stds(); - usage_vidcap(); - usage_vidout(); - usage_overlay(); - usage_vbi(); - usage_selection(); - usage_crop(); - usage_misc(); + usage(); + usage_tuner(); + usage_io(); + usage_stds(); + usage_vidcap(); + usage_vidout(); + usage_overlay(); + usage_vbi(); + usage_selection(); + usage_misc(); } static int test_open(const char *file, int oflag) @@ -2064,7 +2081,7 @@ static void parse_crop(char *optarg, unsigned int &set_crop, v4l2_rect &vcrop) set_crop |= CropHeight; break; default: - usage_crop(); + usage_selection(); exit(1); } } @@ -2587,7 +2604,7 @@ int main(int argc, char **argv) memset(&freq_seek, 0, sizeof(freq_seek)); if (argc == 1) { - usage_hint(); + usage(); return 0; } for (i = 0; long_options[i].name; i++) { @@ -2611,6 +2628,36 @@ int main(int argc, char **argv) case OptHelp: usage(); return 0; + case OptHelpTuner: + usage_tuner(); + return 0; + case OptHelpIO: + usage_io(); + return 0; + case OptHelpStds: + usage_stds(); + return 0; + case OptHelpVidCap: + usage_vidcap(); + return 0; + case OptHelpVidOut: + usage_vidout(); + return 0; + case OptHelpOverlay: + usage_overlay(); + return 0; + case OptHelpVbi: + usage_vbi(); + return 0; + case OptHelpSelection: + usage_selection(); + return 0; + case OptHelpMisc: + usage_misc(); + return 0; + case OptHelpAll: + usage_all(); + return 0; case OptSetDevice: device = optarg; if (device[0] >= '0' && device[0] <= '9' && device[1] == 0) { @@ -2927,11 +2974,11 @@ int main(int argc, char **argv) subs = optarg; while (*subs != '\0') { if (parse_next_subopt(&subs, &value)) { - usage_common(); + usage(); exit(1); } if (strchr(value, '=')) { - usage_common(); + usage(); exit(1); } else { @@ -2943,7 +2990,7 @@ int main(int argc, char **argv) subs = optarg; while (*subs != '\0') { if (parse_next_subopt(&subs, &value)) { - usage_common(); + usage(); exit(1); } if (const char *equal = strchr(value, '=')) { @@ -3202,12 +3249,12 @@ int main(int argc, char **argv) case ':': fprintf(stderr, "Option '%s' requires a value\n", argv[optind]); - usage_hint(); + usage(); return 1; case '?': if (argv[optind]) fprintf(stderr, "Unknown argument '%s'\n", argv[optind]); - usage_hint(); + usage(); return 1; } } @@ -3216,7 +3263,7 @@ int main(int argc, char **argv) while (optind < argc) printf("%s ", argv[optind++]); printf("\n"); - usage_hint(); + usage(); return 1; } _______________________________________________ linuxtv-commits mailing list [email protected] http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
