Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Mar 2015 05:54:29 +0000 (UTC)
From:      Oliver Lehmann <oliver@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r381524 - head/multimedia/v4l-utils/files
Message-ID:  <201503180554.t2I5sTT1060597@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: oliver
Date: Wed Mar 18 05:54:28 2015
New Revision: 381524
URL: https://svnweb.freebsd.org/changeset/ports/381524
QAT: https://qat.redports.org/buildarchive/r381524/

Log:
  Fix handling of getting and setting v4l2 controls.
  The unpatched implementation depends on a Linux specific behaviour of getsubopt(3):
  
  > If the first suboption in optionp is recognized, getsubopt() returns
  > the index of the matching suboption element  in tokens. Otherwise, -1
  > is returned and *valuep is the entire name[=value] string.
  
  The "Otherwise..." part is implemented differently on FreeBSD. The file gets now
  patched to use a local and reduced implementation of getsubopt(3) to fix this
  
  Approved by:	nox

Modified:
  head/multimedia/v4l-utils/files/patch-v4l2-ctl__v4l2-ctl.cpp

Modified: head/multimedia/v4l-utils/files/patch-v4l2-ctl__v4l2-ctl.cpp
==============================================================================
--- head/multimedia/v4l-utils/files/patch-v4l2-ctl__v4l2-ctl.cpp	Tue Mar 17 22:05:36 2015	(r381523)
+++ head/multimedia/v4l-utils/files/patch-v4l2-ctl__v4l2-ctl.cpp	Wed Mar 18 05:54:28 2015	(r381524)
@@ -1,5 +1,5 @@
---- v4l2-ctl/v4l2-ctl.cpp.orig	2011-06-01 13:23:03.000000000 +0200
-+++ v4l2-ctl/v4l2-ctl.cpp	2011-06-04 10:03:21.000000000 +0200
+--- v4l2-ctl/v4l2-ctl.cpp.orig	2012-04-14 19:33:44.000000000 +0200
++++ v4l2-ctl/v4l2-ctl.cpp	2015-03-17 21:05:27.176219337 +0100
 @@ -21,7 +21,6 @@
   */
  
@@ -16,7 +16,49 @@
  
  #include <linux/videodev2.h>
  #include <libv4l2.h>
-@@ -3279,6 +3277,7 @@
+@@ -1643,10 +1641,31 @@
+ 		printf("%s\n", iter->second.c_str());
+ 	}
+ }
++int
++my_getsubopt (char **optionp, char *const *tokens, char **valuep)
++{
++          char *endp, *vstart;
++          int cnt;
++
++          if (**optionp == '\0')
++            return -1;
++
++          /* Find end of next token.  */
++          endp = strchrnul (*optionp, ',');
++
++          /* The current suboption does not match any option.  */
++          *valuep = *optionp;
++
++          if (*endp != '\0')
++            *endp++ = '\0';
++          *optionp = endp;
++
++          return -1;
++}
+ 
+ static int parse_subopt(char **subs, const char * const *subopts, char **value)
+ {
+-	int opt = getsubopt(subs, (char * const *)subopts, value);
++	int opt = my_getsubopt(subs, (char * const *)subopts, value);
+ 
+ 	if (opt == -1) {
+ 		fprintf(stderr, "Invalid suboptions specified\n");
+@@ -1667,7 +1686,7 @@
+ 	static char *const subopts[] = {
+ 	    NULL
+ 	};
+-	int opt = getsubopt(subs, subopts, value);
++	int opt = my_getsubopt(subs, subopts, value);
+ 
+ 	if (value == NULL) {
+ 		fprintf(stderr, "No value given to suboption <%s>\n",
+@@ -3493,6 +3512,7 @@
  		static char buf[40960];
  		int len;
  
@@ -24,7 +66,7 @@
  		if (doioctl(fd, VIDIOC_LOG_STATUS, NULL) == 0) {
  			printf("\nStatus Log:\n\n");
  			len = klogctl(3, buf, sizeof(buf) - 1);
-@@ -3300,6 +3299,7 @@
+@@ -3514,6 +3534,7 @@
  				}
  			}
  		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201503180554.t2I5sTT1060597>