Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Sep 2014 18:33:50 +0000 (UTC)
From:      Juergen Lock <nox@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r368127 - in head/multimedia/webcamd: . files
Message-ID:  <201409131833.s8DIXol4073710@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nox
Date: Sat Sep 13 18:33:50 2014
New Revision: 368127
URL: http://svnweb.freebsd.org/changeset/ports/368127
QAT: https://qat.redports.org/buildarchive/r368127/

Log:
  - Update to 3.17.0.5 . [1]
  - Import much improved rc.d script - check the script at (usually)
    /usr/local/etc/rc.d/webcamd for configuration info. [2]
  - Some Makefile cleanups, pet portlint.
  
  Submitted by:	hselasky (maintainer) [1],
  		dreamcat4@gmail.com [2]
  PR:		191781 [2]

Modified:
  head/multimedia/webcamd/Makefile
  head/multimedia/webcamd/distinfo
  head/multimedia/webcamd/files/webcamd.conf.in
  head/multimedia/webcamd/files/webcamd.in
  head/multimedia/webcamd/pkg-message

Modified: head/multimedia/webcamd/Makefile
==============================================================================
--- head/multimedia/webcamd/Makefile	Sat Sep 13 18:25:04 2014	(r368126)
+++ head/multimedia/webcamd/Makefile	Sat Sep 13 18:33:50 2014	(r368127)
@@ -2,7 +2,7 @@
 # $FreeBSD$
 
 PORTNAME=	webcamd
-PORTVERSION=	3.16.0.1
+PORTVERSION=	3.17.0.5
 CATEGORIES=	multimedia
 MASTER_SITES=	http://www.selasky.org/hans_petter/distfiles/ \
 		http://home.selasky.org:8192/distfiles/
@@ -10,28 +10,27 @@ MASTER_SITES=	http://www.selasky.org/han
 MAINTAINER=	hselasky@FreeBSD.org
 COMMENT=	Port of Linux USB webcam and DVB drivers into userspace
 
-BUILD_DEPENDS=	v4l_compat>=1.0.20100321:${PORTSDIR}/multimedia/v4l_compat \
-		cuse4bsd-kmod>=0.1.31:${PORTSDIR}/multimedia/cuse4bsd-kmod
-LIB_DEPENDS=	libv4l1.so:${PORTSDIR}/multimedia/libv4l \
-		libcuse4bsd.so:${PORTSDIR}/multimedia/cuse4bsd-kmod
-
 LICENSE=	GPLv2
 
+BUILD_DEPENDS=	v4l_compat>=1.0.20100321:${PORTSDIR}/multimedia/v4l_compat
+LIB_DEPENDS=	libv4l1.so:${PORTSDIR}/multimedia/libv4l
+
 USES=		pkgconfig tar:bzip2 uidfix
 USE_RC_SUBR=	webcamd
 USE_LDCONFIG=	yes
 
 LIBDIR=		${PREFIX}/lib
 
-OPTIONS_DEFINE=	DEBUG HAL VT_CLIENT VT_SERVER DVB INPUT RADIO WEBCAM
+OPTIONS_DEFINE=	CUSE DEBUG HAL VT_CLIENT VT_SERVER DVB INPUT RADIO WEBCAM
 OPTIONS_DEFAULT=DVB HAL INPUT RADIO WEBCAM
+CUSE_DESC=	Use CUSE and not CUSE4BSD (FreeBSD-11+ only)
 HAL_DESC=	Build with HAL and DBUS support
 DEBUG_DESC=	Build with debugging support
 VT_CLIENT_DESC=	Build with vTuner client support
 VT_SERVER_DESC=	Build with vTuner server support
 
 DVB_DESC=	Build with USB DVB support (DVB-X, analog TV, ...)
-INPUT_DESC=	Build with USB input support (tablet, joystick, IR, ...)
+INPUT_DESC=	Build with USB input support (tablet, joystick, HID, IR, ...)
 RADIO_DESC=	Build with USB radio support
 WEBCAM_DESC=	Build with USB webcam support (UVC, gspca, ...)
 
@@ -40,46 +39,53 @@ GROUPS=		webcamd
 
 .include <bsd.port.pre.mk>
 
-LIBCUSE=${LIBDIR}/libcuse4bsd.so
+MAKE_ARGS+=	"HAVE_MAN=YES"
+MAKE_ARGS+=	"PTHREAD_LIBS=${PTHREAD_LIBS}"
 
-MAKE_ARGS+=" HAVE_MAN=YES"
-MAKE_ARGS+=" PTHREAD_LIBS=${PTHREAD_LIBS}"
+.if ${PORT_OPTIONS:MCUSE}
+MAKE_ARGS+=	"HAVE_CUSE=YES"
+LIBCUSE=	/usr/lib/libcuse.so
+.else
+BUILD_DEPENDS+=	cuse4bsd-kmod>=0.1.31:${PORTSDIR}/multimedia/cuse4bsd-kmod
+LIB_DEPENDS+=	libcuse4bsd.so:${PORTSDIR}/multimedia/cuse4bsd-kmod
+LIBCUSE=	${LIBDIR}/libcuse4bsd.so
+.endif
 
 .if ${PORT_OPTIONS:MDVB}
-MAKE_ARGS+=" HAVE_DVB_DRV=YES"
+MAKE_ARGS+=	"HAVE_DVB_DRV=YES"
 .endif
 
 .if ${PORT_OPTIONS:MINPUT}
-MAKE_ARGS+=" HAVE_INPUT_DRV=YES"
+MAKE_ARGS+=	"HAVE_INPUT_DRV=YES"
 .endif
 
 .if ${PORT_OPTIONS:MRADIO}
-MAKE_ARGS+=" HAVE_RADIO_DRV=YES"
+MAKE_ARGS+=	"HAVE_RADIO_DRV=YES"
 .endif
 
 .if ${PORT_OPTIONS:MWEBCAM}
-MAKE_ARGS+=" HAVE_WEBCAM_DRV=YES"
+MAKE_ARGS+=	"HAVE_WEBCAM_DRV=YES"
 .endif
 
 .if ${PORT_OPTIONS:MHAL}
-MAKE_ARGS+=" HAVE_HAL=YES"
-LIBHAL=${LIBDIR}/libhal.so:${LIBDIR}/libdbus-1.so:
-LIB_DEPENDS+=libhal.so:${PORTSDIR}/sysutils/hal
-LIB_DEPENDS+=libdbus-1.so:${PORTSDIR}/devel/dbus
+MAKE_ARGS+=	"HAVE_HAL=YES"
+LIBHAL=		${LIBDIR}/libhal.so:${LIBDIR}/libdbus-1.so:
+LIB_DEPENDS+=	libhal.so:${PORTSDIR}/sysutils/hal
+LIB_DEPENDS+=	libdbus-1.so:${PORTSDIR}/devel/dbus
 .else
 LIBHAL=
 .endif
 
 .if ${PORT_OPTIONS:MVT_CLIENT}
-MAKE_ARGS+=" HAVE_VTUNER_CLIENT=YES"
+MAKE_ARGS+=	"HAVE_VTUNER_CLIENT=YES"
 .endif
 
 .if ${PORT_OPTIONS:MVT_SERVER}
-MAKE_ARGS+=" HAVE_VTUNER_SERVER=YES"
+MAKE_ARGS+=	"HAVE_VTUNER_SERVER=YES"
 .endif
 
 .if ${PORT_OPTIONS:MDEBUG}
-MAKE_ARGS+=" HAVE_DEBUG=YES"
+MAKE_ARGS+=	"HAVE_DEBUG=YES"
 .endif
 
 .if ${OSVERSION} < 800000

Modified: head/multimedia/webcamd/distinfo
==============================================================================
--- head/multimedia/webcamd/distinfo	Sat Sep 13 18:25:04 2014	(r368126)
+++ head/multimedia/webcamd/distinfo	Sat Sep 13 18:33:50 2014	(r368127)
@@ -1,2 +1,2 @@
-SHA256 (webcamd-3.16.0.1.tar.bz2) = 1daa5236b57c6c4531ee5caa2217e5afb27524a1f017025872b954cb83d1d27e
-SIZE (webcamd-3.16.0.1.tar.bz2) = 9973063
+SHA256 (webcamd-3.17.0.5.tar.bz2) = c43d25938c6dc33c4c9debb7754de4dfa067e67acd00f8ae0096243af773c675
+SIZE (webcamd-3.17.0.5.tar.bz2) = 10327807

Modified: head/multimedia/webcamd/files/webcamd.conf.in
==============================================================================
--- head/multimedia/webcamd/files/webcamd.conf.in	Sat Sep 13 18:25:04 2014	(r368126)
+++ head/multimedia/webcamd/files/webcamd.conf.in	Sat Sep 13 18:33:50 2014	(r368127)
@@ -31,5 +31,11 @@ notify 100 {
 	match "subsystem"	"INTERFACE";
 	match "type"		"ATTACH";
 	match "intclass"	"0x03";
+#
+# Limit HID device attach to Wacom Devices
+# else webcamd might attach to your keyboard
+# and mouse
+#
+	match "vendor"		"0x056a";
 	action "env LD_PRELOAD=%%LIBHAL%%%%LIBCUSE%% %%PREFIX%%/etc/rc.d/webcamd start $cdev $interface";
 };

Modified: head/multimedia/webcamd/files/webcamd.in
==============================================================================
--- head/multimedia/webcamd/files/webcamd.in	Sat Sep 13 18:25:04 2014	(r368126)
+++ head/multimedia/webcamd/files/webcamd.in	Sat Sep 13 18:33:50 2014	(r368127)
@@ -2,44 +2,241 @@
 # $FreeBSD$
 #
 # PROVIDE: webcamd
-# REQUIRE: DAEMON
+# REQUIRE: DAEMON LOGIN
+# BEFORE: devd
+# KEYWORD: shutdown
 #
-# Add the following line to /etc/rc.conf[.local] to enable webcamd:
+# ================================================================
+# Webcamd is enabled by adding the following line to /etc/rc.conf:
+# ================================================================
 #
 # webcamd_enable="YES"
 #
-# Optional:
-# webcamd_flags="-m v4l2-dev.vflip=1"
+# ================================================================
+# By default webcamd instances are invoked by the devd(8) system
+# daemon and you do not normally need to do any extra configuration
+# just restart the devd service. If the devd service is not enabled,
+# you need to add instances of "webcamd_N_flags=" which contain at
+# least one of the "-d", "-D", "-N", or "-S" options.
+# ================================================================
+#
+# webcamd_0_flags="<instance 0 flags>"
+# webcamd_1_flags="<instance 1 flags>"
+# etc ...
+#
+# ================================================================
+# Specify which USB device to start with the "-N" and "-S" options.
+# For example, if "webcamd -l" shows this device in device list:
+# webcamd [-d ugen7.2] -N SCEH-0036-SONY -S ALR001DN4J -M 0
+# 
+# Then it can be set in your rc.conf file:
+# webcamd_0_flags="-N SCEH-0036-SONY -S ALR001DN4J"
+# 
+# ================================================================
+# You can add extra instances with webcamd_N_flags, where "N" is a
+# sequentially increasing number starting from "0".
+# ================================================================
+#
+# ================================================================
+# General flags can be set on all webcamd instances with the variable
+# "webcamd_flags" which applies globally to all instances:
+# ================================================================
 # webcamd_flags="-m v4l2-dev.hflip=1"
+# 
+# ================================================================
+# If you need to start a vtuner client instance using the "-D" option,
+# put the following line into your rc.conf. The "-i" option must be
+# unique for every vtuner client instance, else there will be a PID
+# file name conflict.
+# ================================================================
+# webcamd_2_flags="-D 127.0.0.1:5100:-1 -i 0"
+# ================================================================
+# 
+# ================================================================
+# If you have multiple identical devices of the same model number,
+# then you should specify the unique serial number for each instance
+# the recommended way with "-N" and "-S" options.
+#
+# However some USB devices may not have a unique serial number. So if
+# "-S" output is blank or always the same then serial number is no
+# good. You should instead use "-N" and the "-M" index option.
+# 
+# ================================================================
+# If you are using a remote control you might need to force the
+# protocol by setting the "rc-main.default_protocol" parameter to
+# "lirc" for example. Run webcamd -s to get a description of available
+# protocols.
+# ================================================================
+#
+# webcamd_flags="-m rc-main.default_protocol=lirc"
+# webcamd_N_flags="-m rc-main.default_protocol=lirc"
+#
+# ================================================================
+# Additional Webcamd flags:
+# ================================================================
+#
+# webcamd_startup_delay=<seconds>
+# webcamd_user=<the user to run webcamd as>
+# webcamd_group=<the group to run webcamd as>
+# webcamd_devd_starts_unspecified=<YES/NO>
 #
-
-webcamd_enable=${webcamd_enable-"NO"}
-hald_enable=${hald_enable-"NO"}
 
 . /etc/rc.subr
 
 name=webcamd
 rcvar=webcamd_enable
-iface=${3-0}
+load_rc_config $name
+
+: ${webcamd_enable:=NO}
+: ${webcamd_user:=webcamd}
+: ${webcamd_group:=webcamd}
+: ${webcamd_startup_delay=1}
+: ${webcamd_devd_starts_unspecified=YES}
+
+: ${hald_enable:=NO}
+
+# If invoked automatically by devd, we receive additional arguments
+devd_device=${2}
+devd_interface=${3-0}
+
 command=%%PREFIX%%/sbin/webcamd
-command_args="-B -U webcamd -G webcamd"
+command_args="-B -U ${webcamd_user} -G ${webcamd_group}"
+
+start_cmd="${name}_start"
+stop_cmd="${name}_stop"
+status_cmd="${name}_status"
+
+webcamd_pids()
+{
+  pids=$(pgrep -d ' ' $name)
+  pids=${pids% }
+  printf "${pids}"
+}
+
+webcamd_grep_instance_flags()
+{
+    echo "$instance_flags" | grep -oE -- "(^| |	)($1)"
+    exit 0
+}
 
-start_precmd="${name}_prestart"
+webcamd_start_devd()
+{
+  # Start a single USB device, as this rc.d script was invoked by devd
+  # with extra arguments
 
-webcamd_prestart()
+  n=0
+  while true
+  do
+    instance_flags=$(eval "echo \$webcamd_${n}_flags")
+    n=$(expr $n + 1)
+    if [ ! "$instance_flags" ]; then
+      instance_flags="-d ${devd_device}"
+      break
+    fi
+
+    # ignore instance entries which are for "-D" vtuner client
+    if [ "$(webcamd_grep_instance_flags '-D')" ]; then
+      continue
+    fi
+
+    # skip flags if no "-d" option is present
+    if [ ! "$(webcamd_grep_instance_flags '-d')" ]; then
+      continue
+    fi
+
+    # skip if the "-d" option does not match
+    if [ ! "$(webcamd_grep_instance_flags '-d[ 	]*[[:alpha:]]*'${devd_device#ugen})" ]; then
+      continue
+    fi
+
+    # we got a match
+    break
+  done
+
+  if checkyesno webcamd_devd_starts_unspecified; then
+    # Try to start the connected USB device
+    ${command} -i ${devd_interface} ${instance_flags} ${webcamd_flags} ${command_args}
+  fi
+}
+
+webcamd_start()
 {
+  # Check if we should attach to the "hald" service
   if checkyesno hald_enable ; then
-	command_args="$command_args -H"
+    command_args="$command_args -H"
+  fi
+
+  # If this rc.d script was invoked by devd
+  if [ "$devd_device" ]; then
+    # Then start the device ugenX.X, as provied in the argv $2, $3
+    webcamd_start_devd
+  else
+    # Start specified instances
+    webcamd_start_instances
   fi
 }
 
-pidfile="/var/run/webcamd.*.$iface.pid"
+webcamd_start_instances()
+{
+  # Start instances that were specified by $webcamd_N_flags
+  echo "Starting ${name}."
 
-load_rc_config $name
+  n=0
+  instance_flags=$(eval "echo \$webcamd_${n}_flags")
+  while true
+  do
+    n=$(expr $n + 1)
+    if [ ! "$instance_flags" ]; then
+        break
+    fi
+
+    # check if valid flags are present
+    if [ ! "$(webcamd_grep_instance_flags '-d|-D|-N|-S')" ]; then
+      continue
+    fi
+
+    # launch an instance of webcamd for this configuration entry
+    ${command} ${instance_flags} ${webcamd_flags} ${command_args}
+
+    # next instance flags
+    instance_flags=$(eval "echo \$webcamd_${n}_flags")
+
+    if [ "$instance_flags" ]; then
+      # wait a bit before invoking next instance
+      sleep "$webcamd_startup_delay"
+    fi
+  done
+}
+
+webcamd_stop()
+{
+  pids=$(webcamd_pids)
+  if [ "${pids}" ]; then
+    echo "Stopping ${name}."
+    echo "Waiting for PIDs: ${pids}"
+    for signal in TERM INT QUIT KILL HUP
+    do
+      kill -s ${signal} ${pids}
+      sleep 1
+      pids=$(webcamd_pids)
+      [ "${pids}" ] || break
+    done
+  else
+    echo "${name} is not running."
+    return 1
+  fi
+}
+
+webcamd_status()
+{
+  pids=$(webcamd_pids)
+
+  if [ "${pids}" ]; then
+    echo "${name} is running as pid ${pids}."
+  else
+    echo "${name} is not running."
+    return 1
+  fi
+}
 
-if [ $# -gt 1 ]; then
-	pidfile="webcamd.dummy"
-	command_args="$command_args -d $2 -i $iface"
-	# Only run the rc command if the appropriate arguments are specified:	
-	run_rc_command $1
-fi
+run_rc_command "$1"

Modified: head/multimedia/webcamd/pkg-message
==============================================================================
--- head/multimedia/webcamd/pkg-message	Sat Sep 13 18:25:04 2014	(r368126)
+++ head/multimedia/webcamd/pkg-message	Sat Sep 13 18:33:50 2014	(r368127)
@@ -1,12 +1,16 @@
 *********************************************************************
-1) webcamd requires the cuse4bsd kernel module, please load this
-by doing
+1) webcamd requires the cuse4bsd or cuse kernel module, depending on
+how webcamd was compiled. Please load this dependency by doing:
 
        # kldload cuse4bsd
+or
+       # kldload cuse
 
-or adding
+or by adding
 
        cuse4bsd_load="YES"
+or
+       cuse_load="YES"
 
 to your /boot/loader.conf.
 
@@ -14,7 +18,7 @@ to your /boot/loader.conf.
 
 to your /etc/rc.conf
 
-3) Please restart devd as the configuration changed
+3) Please restart devd to start webcamd
 
 	# service devd restart
 
@@ -22,4 +26,6 @@ to your /etc/rc.conf
 
 	# pw groupmod webcamd -m <username>
 
+5) If webcamd still did not start, consult the installed webcamd rc.d
+script for more help and instructions on how to start webcamd.
 *********************************************************************



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