This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:

Subject: v4l2-dbg: improve usage messages
Author:  Hans Verkuil <hans.verk...@cisco.com>
Date:    Wed Feb 28 21:45:35 2018 +0100

Drop the '=' separator between the option and the arguments in the
usage message. It's confusing and not needed.

Improve parsing of optional arguments: it can now understand
-l min=0x20,max=0x3f and --list-registers min=0x20,max=0x3f. This worked
fine for required arguments, but an '=' between the option and arguments
was needed if the arguments were optional, otherwise they wouldn't be
parsed.

Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>

 utils/v4l2-dbg/v4l2-dbg.cpp | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=8b4bede2bacc76cdbb6b204b1c5bfd23d2a21126
diff --git a/utils/v4l2-dbg/v4l2-dbg.cpp b/utils/v4l2-dbg/v4l2-dbg.cpp
index 82669b987899..41f94fffa166 100644
--- a/utils/v4l2-dbg/v4l2-dbg.cpp
+++ b/utils/v4l2-dbg/v4l2-dbg.cpp
@@ -166,24 +166,24 @@ static void usage(void)
 {
        printf("Usage: v4l2-dbg [options] [values]\n"
               "  -D, --info         Show driver info [VIDIOC_QUERYCAP]\n"
-              "  -d, --device=<dev> Use device <dev> instead of /dev/video0\n"
+              "  -d, --device <dev> Use device <dev> instead of /dev/video0\n"
               "                     If <dev> starts with a digit, then 
/dev/video<dev> is used\n"
               "  -h, --help         Display this help message\n"
               "  --verbose          Turn on verbose ioctl error reporting\n"
-              "  -c, --chip=<chip>  The chip identifier to use with other 
commands\n"
+              "  -c, --chip <chip>  The chip identifier to use with other 
commands\n"
               "                     It can be one of:\n"
               "                         bridge<num>: bridge chip number 
<num>\n"
               "                         bridge (default): same as bridge0\n"
               "                         subdev<num>: sub-device number <num>\n"
               "  -l, --list-registers[=min=<addr>[,max=<addr>]]\n"
               "                     Dump registers from <min> to <max> 
[VIDIOC_DBG_G_REGISTER]\n"
-              "  -g, --get-register=<addr>\n"
+              "  -g, --get-register <addr>\n"
               "                     Get the specified register 
[VIDIOC_DBG_G_REGISTER]\n"
-              "  -s, --set-register=<addr>\n"
+              "  -s, --set-register <addr>\n"
               "                     Set the register with the commandline 
arguments\n"
               "                     The register will autoincrement 
[VIDIOC_DBG_S_REGISTER]\n"
               "  -n, --scan-chips   Scan the available bridge and subdev chips 
[VIDIOC_DBG_G_CHIP_INFO]\n"
-              "  -w, --wide=<reg length>\n"
+              "  -w, --wide <reg length>\n"
               "                     Sets step between two registers\n"
               "  --list-symbols     List the symbolic register names you can 
use, if any\n"
               "  --log-status       Log the board status in the kernel log 
[VIDIOC_LOG_STATUS]\n");
@@ -453,6 +453,18 @@ int main(int argc, char **argv)
                        break;
 
                options[(int)ch] = 1;
+               if (!option_index) {
+                       for (i = 0; long_options[i].val; i++) {
+                               if (long_options[i].val == ch) {
+                                       option_index = i;
+                                       break;
+                               }
+                       }
+               }
+               if (long_options[option_index].has_arg == optional_argument &&
+                   !optarg && argv[optind] && argv[optind][0] != '-')
+                       optarg = argv[optind++];
+
                switch (ch) {
                case OptHelp:
                        usage();

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to