[git:v4l-utils/master] cec: improve usage messages

2018-02-28 Thread Hans Verkuil
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: cec: improve usage messages
Author:  Hans Verkuil 
Date:Wed Feb 28 20:52:02 2018 +0100

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

Signed-off-by: Hans Verkuil 

 utils/cec-compliance/cec-compliance.1.in |  8 
 utils/cec-compliance/cec-compliance.cpp  |  8 
 utils/cec-ctl/cec-ctl.1.in   | 22 +++---
 utils/cec-ctl/cec-ctl.cpp| 30 +++---
 utils/cec-ctl/msg2ctl.pl |  2 +-
 utils/cec-follower/cec-follower.1.in |  2 +-
 utils/cec-follower/cec-follower.cpp  |  2 +-
 7 files changed, 37 insertions(+), 37 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=2294bebdd17a2bfbb4d2deaf1e137003a1fa5cf1
diff --git a/utils/cec-compliance/cec-compliance.1.in 
b/utils/cec-compliance/cec-compliance.1.in
index b25ba50eaa37..ba4aa88b88d0 100644
--- a/utils/cec-compliance/cec-compliance.1.in
+++ b/utils/cec-compliance/cec-compliance.1.in
@@ -71,7 +71,7 @@ Some tests depend on other tests being successful. These are 
not run if the
 tests they depend on failed, and they will not be shown in the test listing.
 .SH OPTIONS
 .TP
-\fB\-d\fR, \fB\-\-device\fR=\fI\fR
+\fB\-d\fR, \fB\-\-device\fR \fI\fR
 Use device  as the CEC device. If  is a number, then /dev/cec 
is used.
 .TP
 \fB\-v\fR, \fB\-\-verbose\fR
@@ -89,16 +89,16 @@ Show timestamps as wall-clock time.
 \fB\-n\fR, \fB\-\-no\-warnings\fR
 Turn off warning messages.
 .TP
-\fB\-r\fR, \fB\-\-remote\fR=\fI\fR
+\fB\-r\fR, \fB\-\-remote\fR \fI\fR
 As initiator test the remote logical address  or all LAs if no LA was 
given.
 .TP
 \fB\-i\fR, \fB\-\-interactive\fR
 Interactive mode when doing remote tests.
 .TP
-\fB\-R\fR, \fB\-\-reply\-threshold\fR=\fI\fR
+\fB\-R\fR, \fB\-\-reply\-threshold\fR \fI\fR
 Warn if replies take longer than this threshold (default 1000ms).
 .TP
-\fB\-t\fR, \fB\-\-timeout\fR=\fI\fR
+\fB\-t\fR, \fB\-\-timeout\fR \fI\fR
 Set the standby/resume timeout to the given number of seconds. Default is 60s.
 .TP
 \fB\-A\fR, \fB\-\-test\-adapter\fR
diff --git a/utils/cec-compliance/cec-compliance.cpp 
b/utils/cec-compliance/cec-compliance.cpp
index 234dbca06fab..0adbbe78ce4d 100644
--- a/utils/cec-compliance/cec-compliance.cpp
+++ b/utils/cec-compliance/cec-compliance.cpp
@@ -160,13 +160,13 @@ static struct option long_options[] = {
 static void usage(void)
 {
printf("Usage:\n"
-  "  -d, --device=   Use device  instead of /dev/cec0\n"
+  "  -d, --deviceUse device  instead of /dev/cec0\n"
   "   If  starts with a digit, then 
/dev/cec is used.\n"
-  "  -r, --remote[=]  As initiator test the remote logical 
address or all LAs if no LA was given\n"
-  "  -R, --reply-threshold=\n"
+  "  -r, --remote []  As initiator test the remote logical 
address or all LAs if no LA was given\n"
+  "  -R, --reply-threshold \n"
   "   Warn if replies take longer than this 
threshold (default 1000ms)\n"
   "  -i, --interactiveInteractive mode when doing remote 
tests\n"
-  "  -t, --timeout= Set the standby/resume timeout to 
. Default is 60s.\n"
+  "  -t, --timeout  Set the standby/resume timeout to 
. Default is 60s.\n"
   "\n"
   "  -A, --test-adapter  Test the CEC adapter 
API\n"
   "  --test-core Test the core 
functionality\n"
diff --git a/utils/cec-ctl/cec-ctl.1.in b/utils/cec-ctl/cec-ctl.1.in
index bff08c59f6aa..9a94623e2818 100644
--- a/utils/cec-ctl/cec-ctl.1.in
+++ b/utils/cec-ctl/cec-ctl.1.in
@@ -10,7 +10,7 @@ any aspect of such devices covering the full CEC API.
 
 .SH OPTIONS
 .TP
-\fB\-d\fR, \fB\-\-device\fR=\fI\fR
+\fB\-d\fR, \fB\-\-device\fR \fI\fR
 Use device  as the CEC device. If  is a number, then /dev/cec 
is used.
 .TP
 \fB\-v\fR, \fB\-\-verbose\fR
@@ -19,15 +19,15 @@ Turn on verbose reporting.
 \fB\-h\fR, \fB\-\-help\fR
 Prints the help message.
 .TP
-\fB\-p\fR, \fB\-\-phys\-addr\fR=\fI\fR
+\fB\-p\fR, \fB\-\-phys\-addr\fR \fI\fR
 Use this physical address. The address can be a number (e.g. 0 or 0x11b1)
 or formatted as a.b.c.d where each component is a hex value from 0-f
 (e.g. 0.0.0.0 or 1.1.b.1).
 .TP
-\fB\-o\fR, \fB\-\-osd\-name\fR=\fI\fR
+\fB\-o\fR, \fB\-\-osd\-name\fR \fI\fR
 Use this OSD name. The maximum length is 14 characters.
 .TP
-\fB\-V\fR, \fB\-\-vendor\-id\fR=\fI\fR
+\fB\-V\fR, \fB\-\-vendor\-id\fR \fI\fR
 Use this vendor ID. The vendor ID is a number from 0x0 to 0xff.
 .TP
 \fB\-l\fR, \fB\-\-logical\-address\fR
@@ -46,10 +46,10 @@ By default when sending a CEC message that expects a reply 
this utility will
 wait for that reply.

[git:v4l-utils/master] v4l2-ctl/compliance: improve usage messages

2018-02-28 Thread Hans Verkuil
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-ctl/compliance: improve usage messages
Author:  Hans Verkuil 
Date:Wed Feb 28 21:03:23 2018 +0100

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

Signed-off-by: Hans Verkuil 

 utils/v4l2-compliance/v4l2-compliance.1.in | 22 -
 utils/v4l2-compliance/v4l2-compliance.cpp  | 22 -
 utils/v4l2-ctl/v4l2-ctl-common.cpp | 14 +--
 utils/v4l2-ctl/v4l2-ctl-edid.cpp   |  9 +++
 utils/v4l2-ctl/v4l2-ctl-io.cpp | 10 
 utils/v4l2-ctl/v4l2-ctl-meta.cpp   |  8 +++---
 utils/v4l2-ctl/v4l2-ctl-misc.cpp   | 18 +++---
 utils/v4l2-ctl/v4l2-ctl-overlay.cpp| 10 
 utils/v4l2-ctl/v4l2-ctl-sdr.cpp|  8 +++---
 utils/v4l2-ctl/v4l2-ctl-selection.cpp  | 16 ++--
 utils/v4l2-ctl/v4l2-ctl-stds.cpp   |  6 ++---
 utils/v4l2-ctl/v4l2-ctl-streaming.cpp  | 39 --
 utils/v4l2-ctl/v4l2-ctl-subdev.cpp | 18 +++---
 utils/v4l2-ctl/v4l2-ctl-tuner.cpp  | 10 
 utils/v4l2-ctl/v4l2-ctl-vbi.cpp|  4 +--
 utils/v4l2-ctl/v4l2-ctl-vidcap.cpp |  6 ++---
 utils/v4l2-ctl/v4l2-ctl-vidout.cpp |  2 +-
 utils/v4l2-ctl/v4l2-ctl.1.in   | 14 +--
 18 files changed, 119 insertions(+), 117 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=cf1dc14faa6886d0b1f52c6c046975d8c8cc67f5
diff --git a/utils/v4l2-compliance/v4l2-compliance.1.in 
b/utils/v4l2-compliance/v4l2-compliance.1.in
index 4006c56e68d5..e9511abb1de7 100644
--- a/utils/v4l2-compliance/v4l2-compliance.1.in
+++ b/utils/v4l2-compliance/v4l2-compliance.1.in
@@ -53,38 +53,38 @@ If your driver passes all tests, then your can be confident 
that your driver is
 very good shape!
 .SH OPTIONS
 .TP
-\fB\-d\fR, \fB\-\-device\fR=\fI\fR
+\fB\-d\fR, \fB\-\-device\fR \fI\fR
 Use device  as the video device. If  is a number, then 
/dev/video is used.
 .TP
-\fB\-V\fR, \fB\-\-vbi\-device\fR=\fI\fR
+\fB\-V\fR, \fB\-\-vbi\-device\fR \fI\fR
 Use device  as the vbi device. If  is a number, then /dev/vbi 
is used.
 .TP
-\fB\-r\fR, \fB\-\-radio\-device\fR=\fI\fR
+\fB\-r\fR, \fB\-\-radio\-device\fR \fI\fR
 Use device  as the radio device. If  is a number, then 
/dev/radio is used.
 .TP
-\fB\-S\fR, \fB\-\-sdr\-device\fR=\fI\fR
+\fB\-S\fR, \fB\-\-sdr\-device\fR \fI\fR
 Use device  as the SDR device. If  is a number, then 
/dev/swradio is used.
 .TP
-\fB\-t\fR, \fB\-\-touch\-device\fR=\fI\fR
+\fB\-t\fR, \fB\-\-touch\-device\fR \fI\fR
 Use device  as the touch device. If  is a number, then 
/dev/v4l-touch is used.
 .TP
-\fB\-u\fR, \fB\-\-subdev\-device\fR=\fI\fR
+\fB\-u\fR, \fB\-\-subdev\-device\fR \fI\fR
 Use device  as the v4l-subdevX device. If  is a number, then 
/dev/v4l-subdev is used.
 .TP
-\fB\-m\fR, \fB\-\-media\-device\fR=\fI\fR
+\fB\-m\fR, \fB\-\-media\-device\fR \fI\fR
 Use device  as the media controller device. Besides this device it also 
tests
 all interfaces it finds.  If  starts with a digit, then /dev/media 
is used.
 .TP
-\fB\-M\fR, \fB\-\-media\-device\-only\fR=\fI\fR
+\fB\-M\fR, \fB\-\-media\-device\-only\fR \fI\fR
 Use device  as the media controller device. Only test this device, don't 
walk
 over all the interfaces.  If  starts with a digit, then /dev/media 
is used.
 .TP
-\fB\-e\fR, \fB\-\-exp\-buf\-device\fR=\fI\fR
+\fB\-e\fR, \fB\-\-exp\-buf\-device\fR \fI\fR
 Use device  as the video device used to export DMABUFfers for doing DMABUF
 streaming tests. If  is a number, then /dev/video is used. If this 
option
 is not specified, then the DMABUF streaming tests will be skipped.
 .TP
-\fB\-s\fR, \fB\-\-streaming\fR=\fI\fR
+\fB\-s\fR, \fB\-\-streaming\fR \fI\fR
 Enable the streaming tests. Set  to the number of frames to stream 
(default 60).
 This requires that before v4l2-compliance is called the device has been 
configured with
 a valid input (or output) and frequency (when the device has a tuner). For 
DMABUF testing
@@ -104,7 +104,7 @@ a long time.
 The configuration of the driver at the time v4l2-compliance was called
 will be used for the streaming tests.
 .TP
-\fB\-c\fR, 
\fB\-\-stream\-all\-color\fR=\fBcolor\fR=\fIred|green|blue\fR,\fBskip\fR=\fI\fR,\fBperc\fR=\fI\fR
+\fB\-c\fR, \fB\-\-stream\-all\-color\fR 
\fBcolor\fR=\fIred|green|blue\fR,\fBskip\fR=\fI\fR,\fBperc\fR=\fI\fR
 For all supported, non-compressed formats stream  frames. For the
 last frame go over all pixels and calculate which of the R, G and B color 
components
 of a pixel has the highest value and count that as a red, green or blue pixel.
diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp 
b/utils/v4l2-compliance/v4l2-compliance.cpp
index f6699b3a7fb4..f1bf6c17f853 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ 

[git:v4l-utils/master] rds-ctl: improve usage messages

2018-02-28 Thread Hans Verkuil
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: rds-ctl: improve usage messages
Author:  Hans Verkuil 
Date:Wed Feb 28 21:45:07 2018 +0100

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

Signed-off-by: Hans Verkuil 

 utils/rds-ctl/rds-ctl.cpp | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=633d4bc936090ab92549e316510a73582f93457b
diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp
index 272c8d75833e..05b882e3fee5 100644
--- a/utils/rds-ctl/rds-ctl.cpp
+++ b/utils/rds-ctl/rds-ctl.cpp
@@ -115,7 +115,7 @@ static void usage_common(void)
printf("\nGeneral/Common options:\n"
   "  --all  display all device information available\n"
   "  -D, --info show driver info [VIDIOC_QUERYCAP]\n"
-  "  -d, --device= use device \n"
+  "  -d, --device  use device \n"
   " If  starts with a digit, then 
/dev/radio is used\n"
   " default: checks for RDS-capable devices,\n"
   " uses device with lowest ID\n"
@@ -128,11 +128,11 @@ static void usage_tuner(void)
 {
printf("\nTuner/Modulator options:\n"
   "  -F, --get-freq query the frequency [VIDIOC_G_FREQUENCY]\n"
-  "  -f, --set-freq=\n"
+  "  -f, --set-freq \n"
   " set the frequency to  MHz 
[VIDIOC_S_FREQUENCY]\n"
   "  -T, --get-tunerquery the tuner settings 
[VIDIOC_G_TUNER]\n"
-  "  --tuner-index= Use idx as tuner idx for tuner/modulator 
commands\n"
-  "  --freq-seek=dir=<0/1>,wrap=<0/1>,spacing=\n"
+  "  --tuner-index  Use idx as tuner idx for tuner/modulator 
commands\n"
+  "  --freq-seek dir=<0/1>,wrap=<0/1>,spacing=\n"
   " perform a hardware frequency seek 
[VIDIOC_S_HW_FREQ_SEEK]\n"
   " dir is 0 (seek downward) or 1 (seek 
upward)\n"
   " wrap is 0 (do not wrap around) or 1 (wrap 
around)\n"
@@ -147,9 +147,9 @@ static void usage_rds(void)
printf("\nRDS options: \n"
   "  -b, --rbds parse the RDS data according to the RBDS 
standard\n"
   "  -R, --read-rds enable reading of RDS data from device\n"
-  "  --file=  open a RDS stream file dump instead of a 
device\n"
+  "  --file   open a RDS stream file dump instead of a 
device\n"
   " all General and Tuner Options are disabled 
in this mode\n"
-  "  --wait-limit=  defines the maximum wait duration for 
avaibility of new\n"
+  "  --wait-limit   defines the maximum wait duration for 
avaibility of new\n"
   " RDS data\n"
   " : 5000 ms\n"
   "  --print-block  prints all valid RDS fields, whenever a 
value is updated\n"

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

[git:v4l-utils/master] v4l2-dbg: improve usage messages

2018-02-28 Thread Hans Verkuil
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 
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 

 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= Use device  instead of /dev/video0\n"
+  "  -d, --device  Use device  instead of /dev/video0\n"
   " If  starts with a digit, then 
/dev/video is used\n"
   "  -h, --help Display this help message\n"
   "  --verbose  Turn on verbose ioctl error reporting\n"
-  "  -c, --chip=  The chip identifier to use with other 
commands\n"
+  "  -c, --chip   The chip identifier to use with other 
commands\n"
   " It can be one of:\n"
   " bridge: bridge chip number 
\n"
   " bridge (default): same as bridge0\n"
   " subdev: sub-device number \n"
   "  -l, --list-registers[=min=[,max=]]\n"
   " Dump registers from  to  
[VIDIOC_DBG_G_REGISTER]\n"
-  "  -g, --get-register=\n"
+  "  -g, --get-register \n"
   " Get the specified register 
[VIDIOC_DBG_G_REGISTER]\n"
-  "  -s, --set-register=\n"
+  "  -s, --set-register \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=\n"
+  "  -w, --wide \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

[git:v4l-utils/master] v4l2-ctl/compliance: improve parsing of optional arguments

2018-02-28 Thread Hans Verkuil
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-ctl/compliance: improve parsing of optional arguments
Author:  Hans Verkuil 
Date:Wed Feb 28 21:48:15 2018 +0100

Improve parsing of optional arguments: it can now understand
--get-edid pad=3. 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 

 utils/v4l2-compliance/v4l2-compliance.cpp | 12 
 utils/v4l2-ctl/v4l2-ctl.cpp   | 12 
 2 files changed, 24 insertions(+)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=548bfbee3e7732ee6432787686ba74b942bd3968
diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp 
b/utils/v4l2-compliance/v4l2-compliance.cpp
index f1bf6c17f853..eb1f90fd7ad8 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -1102,6 +1102,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();
diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp
index ff5fee4469f2..2863764cf0a5 100644
--- a/utils/v4l2-ctl/v4l2-ctl.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl.cpp
@@ -858,6 +858,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:
common_usage();

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

[git:v4l-utils/master] cec-follower/compliance: improve parsing of optional arguments

2018-02-28 Thread Hans Verkuil
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: cec-follower/compliance: improve parsing of optional arguments
Author:  Hans Verkuil 
Date:Wed Feb 28 21:48:53 2018 +0100

Improve parsing of optional arguments: it can now understand
--remote 4. 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 

 utils/cec-compliance/cec-compliance.cpp | 12 
 utils/cec-follower/cec-follower.cpp | 12 
 2 files changed, 24 insertions(+)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=200338d272a908be4d98c0127765a8e1611be639
diff --git a/utils/cec-compliance/cec-compliance.cpp 
b/utils/cec-compliance/cec-compliance.cpp
index 0adbbe78ce4d..e0e8266d2809 100644
--- a/utils/cec-compliance/cec-compliance.cpp
+++ b/utils/cec-compliance/cec-compliance.cpp
@@ -1096,6 +1096,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();
diff --git a/utils/cec-follower/cec-follower.cpp 
b/utils/cec-follower/cec-follower.cpp
index df29c0b52a30..6053299ea72f 100644
--- a/utils/cec-follower/cec-follower.cpp
+++ b/utils/cec-follower/cec-follower.cpp
@@ -392,6 +392,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