libv4l: Update version to 1.10.0. Fix musl/uClibc incompatibility with getsubopt()

Signed-off-by: Ted Hess <thess@kitschensync.net>
This commit is contained in:
Ted Hess 2016-02-27 09:36:41 -05:00
parent e16c53636d
commit 4c73560932
5 changed files with 31 additions and 179 deletions

View File

@ -9,12 +9,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=v4l-utils
PKG_VERSION:=1.6.3
PKG_VERSION:=1.10.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://www.linuxtv.org/downloads/v4l-utils
PKG_MD5SUM:=307858616be6374f63bf946307f15a7f
PKG_MD5SUM:=945a38979138997e805828a4a53e53ec
PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
@ -76,7 +76,7 @@ define Package/v4l-utils/description
This package contains the video4linux utilities.
endef
TARGET_CFLAGS += $(FPIC) -std=gnu99
TARGET_CFLAGS += $(FPIC)
TARGET_LDFLAGS += -largp
CONFIGURE_ARGS+= \

View File

@ -1,57 +0,0 @@
--- a/lib/libv4lconvert/control/libv4lcontrol.c
+++ b/lib/libv4lconvert/control/libv4lcontrol.c
@@ -570,7 +570,7 @@ static void v4lcontrol_get_flags_from_db
struct v4lcontrol_data *v4lcontrol_create(int fd, void *dev_ops_priv,
const struct libv4l_dev_ops *dev_ops, int always_needs_conversion)
{
- int shm_fd;
+ int shm_fd, fdflags;
int i, rc, got_usb_info, speed, init = 0;
char *s, shm_name[256], pwd_buf[1024];
struct v4l2_capability cap;
@@ -695,33 +695,38 @@ struct v4lcontrol_data *v4lcontrol_creat
if (getpwuid_r(geteuid(), &pwd, pwd_buf, sizeof(pwd_buf), &pwd_p) == 0) {
if (got_usb_info)
- snprintf(shm_name, 256, "/libv4l-%s:%s:%04x:%04x:%s", pwd.pw_name,
+ snprintf(shm_name, 256, "/dev/shm/libv4l-%s:%s:%04x:%04x:%s", pwd.pw_name,
cap.bus_info, (int)vendor_id, (int)product_id, cap.card);
else
- snprintf(shm_name, 256, "/libv4l-%s:%s:%s", pwd.pw_name,
+ snprintf(shm_name, 256, "/dev/shm/libv4l-%s:%s:%s", pwd.pw_name,
cap.bus_info, cap.card);
} else {
perror("libv4lcontrol: error getting username using uid instead");
if (got_usb_info)
- snprintf(shm_name, 256, "/libv4l-%lu:%s:%04x:%04x:%s",
+ snprintf(shm_name, 256, "/dev/shm/libv4l-%lu:%s:%04x:%04x:%s",
(unsigned long)geteuid(), cap.bus_info,
(int)vendor_id, (int)product_id, cap.card);
else
- snprintf(shm_name, 256, "/libv4l-%lu:%s:%s", (unsigned long)geteuid(),
+ snprintf(shm_name, 256, "/dev/shm/libv4l-%lu:%s:%s", (unsigned long)geteuid(),
cap.bus_info, cap.card);
}
/* / is not allowed inside shm names */
- for (i = 1; shm_name[i]; i++)
+ for (i = 9; shm_name[i]; i++) /* start after "/dev/shm", i = 9 */
if (shm_name[i] == '/')
shm_name[i] = '-';
/* Open the shared memory object identified by shm_name */
- shm_fd = shm_open(shm_name, (O_CREAT | O_EXCL | O_RDWR), (S_IREAD | S_IWRITE));
+ shm_fd = open(shm_name, (O_CREAT | O_EXCL | O_RDWR), (S_IREAD | S_IWRITE));
if (shm_fd >= 0)
init = 1;
else
- shm_fd = shm_open(shm_name, O_RDWR, (S_IREAD | S_IWRITE));
+ shm_fd = open(shm_name, O_RDWR, (S_IREAD | S_IWRITE));
+
+ /* This is all uClibc > 0.9.30 seems to do for shm_open() in librt/shm.c */
+ fdflags = fcntl(shm_fd, F_GETFD, 0);
+ if (fdflags >= 0)
+ fdflags = fcntl(fd, F_SETFD, fdflags | FD_CLOEXEC);
if (shm_fd >= 0) {
/* Set the shared memory size */

View File

@ -1,23 +0,0 @@
--- a/configure.ac
+++ b/configure.ac
@@ -80,6 +80,20 @@ gl_VISIBILITY
AC_CHECK_HEADERS([sys/klog.h])
AC_CHECK_FUNCS([klogctl])
+AC_CACHE_CHECK([for ioctl with POSIX signature],
+ [gl_cv_func_ioctl_posix_signature],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <sys/ioctl.h>]],
+ [[int ioctl (int, int, ...);]])
+ ],
+ [gl_cv_func_ioctl_posix_signature=yes],
+ [gl_cv_func_ioctl_posix_signature=no])
+ ])
+if test "x$gl_cv_func_ioctl_posix_signature" = xyes; then
+ AC_DEFINE([HAVE_POSIX_IOCTL], [1], [Have ioctl with POSIX signature])
+fi
+
# Check host os
case "$host_os" in
linux*)

View File

@ -0,0 +1,28 @@
--- a/utils/v4l2-ctl/v4l2-ctl-common.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp
@@ -671,15 +671,18 @@ static bool parse_subset(char *optarg)
static bool parse_next_subopt(char **subs, char **value)
{
- static char *const subopts[] = {
- NULL
- };
- int opt = getsubopt(subs, subopts, value);
+ char *stmp = *subs;
+ *value = NULL;
- if (opt < 0 || *value)
+ if (*subs) {
+ *subs = strchr(stmp, ',');
+ if (*subs)
+ *(*subs)++ = 0;
+ else *subs = stmp + strlen(stmp);
+
+ *value = stmp;
return false;
- fprintf(stderr, "No value given to suboption <%s>\n",
- subopts[opt]);
+ }
return true;
}

View File

@ -1,96 +0,0 @@
--- a/lib/libv4lconvert/libv4lsyscall-priv.h
+++ b/lib/libv4lconvert/libv4lsyscall-priv.h
@@ -35,18 +35,23 @@
which is broken on some systems and doesn't include them itself :( */
#ifdef linux
+#define __NEED_off_t
#include <sys/time.h>
#include <syscall.h>
#include <linux/types.h>
#include <linux/ioctl.h>
/* On 32 bits archs we always use mmap2, on 64 bits archs there is no mmap2 */
#ifdef __NR_mmap2
+#undef SYS_mmap2
#define SYS_mmap2 __NR_mmap2
#define MMAP2_PAGE_SHIFT 12
#else
#define SYS_mmap2 SYS_mmap
#define MMAP2_PAGE_SHIFT 0
#endif
+#if !(defined(__UCLIBC__) || defined(__GLIBC__))
+typedef off_t __off_t;
+#endif
#endif
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
--- a/lib/libv4l1/v4l1compat.c
+++ b/lib/libv4l1/v4l1compat.c
@@ -62,7 +62,7 @@ LIBV4L_PUBLIC int open(const char *file,
return fd;
}
-#ifdef linux
+#if defined(linux) && (defined(__GLIBC__) || defined(__UCLIBC__))
LIBV4L_PUBLIC int open64(const char *file, int oflag, ...)
{
int fd;
@@ -94,7 +94,11 @@ LIBV4L_PUBLIC int dup(int fd)
return v4l1_dup(fd);
}
+#ifdef HAVE_POSIX_IOCTL
+LIBV4L_PUBLIC int ioctl(int fd, int request, ...)
+#else
LIBV4L_PUBLIC int ioctl(int fd, unsigned long int request, ...)
+#endif
{
void *arg;
va_list ap;
@@ -112,12 +116,12 @@ LIBV4L_PUBLIC ssize_t read(int fd, void
}
LIBV4L_PUBLIC void *mmap(void *start, size_t length, int prot, int flags, int fd,
- __off_t offset)
+ off_t offset)
{
return v4l1_mmap(start, length, prot, flags, fd, offset);
}
-#ifdef linux
+#if defined(linux) && (defined(__GLIBC__) || defined(__UCLIBC__))
LIBV4L_PUBLIC void *mmap64(void *start, size_t length, int prot, int flags, int fd,
__off64_t offset)
{
--- a/lib/libv4l2/v4l2convert.c
+++ b/lib/libv4l2/v4l2convert.c
@@ -86,7 +86,7 @@ LIBV4L_PUBLIC int open(const char *file,
return fd;
}
-#ifdef linux
+#if defined(linux) && (defined(__GLIBC__) || defined(__UCLIBC__))
LIBV4L_PUBLIC int open64(const char *file, int oflag, ...)
{
int fd;
@@ -121,7 +121,11 @@ LIBV4L_PUBLIC int dup(int fd)
return v4l2_dup(fd);
}
+#ifdef HAVE_POSIX_IOCTL
+LIBV4L_PUBLIC int ioctl(int fd, int request, ...)
+#else
LIBV4L_PUBLIC int ioctl(int fd, unsigned long int request, ...)
+#endif
{
void *arg;
va_list ap;
@@ -144,7 +148,7 @@ LIBV4L_PUBLIC void *mmap(void *start, si
return v4l2_mmap(start, length, prot, flags, fd, offset);
}
-#ifdef linux
+#if defined(linux) && (defined(__GLIBC__) || defined(__UCLIBC__))
LIBV4L_PUBLIC void *mmap64(void *start, size_t length, int prot, int flags, int fd,
__off64_t offset)
{