⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uvcdynctrl

📁 linux对usb web camera的支持库
💻
字号:
#!/bin/sh################################################################################ udev helper script for UVC devices to support dynamic controls.## Version: 0.1###############################################################################xmlpath=/etc/udev/datalogfile=/tmp/uvcdynctrl-udev.log#logfile=/dev/nulluvcdynctrlpath=uvcdynctrlecho -e "\n==============================================================================" >> $logfileecho -e "Triggered at `date`\n" >> $logfileset >> $logfileecho >> $logfile# Extract interface and device pathsifacepath="/sys$PHYSDEVPATH"if [ -e "$ifacepath/idVendor" ]; then	devpath="$ifacepath"	unset ifacepath	driverpath="$devpath/driver"else	devpath="$ifacepath/.."	driverpath="$ifacepath/driver"fi# Extract the VID and PIDvid=`cat "$devpath/idVendor" | tr "[:upper:]" "[:lower:]"`pid=`cat "$devpath/idProduct" | tr "[:upper:]" "[:lower:]"`echo "VID of new device: '$vid'" >> $logfileecho "PID of new device: '$pid'" >> $logfileif [ -z $vid ]; then	echo "ERROR: Unable to extract USB VID from '$devpath/idVendor'." >> $logfile	exit 2fi# Check whether the device is managed by the UVC driverdrivername=`readlink $driverpath`drivername=`basename $drivername`if [ "$drivername" != "uvcvideo" ]; then	echo "ERROR: Device is not handled by uvcvideo but by '$drivername'." >> $logfile	if [ "$drivername" = "usb" ]; then		echo "Note: There is a known problem for older versions of the UVC driver where the physical device path reported by udev ('/sys$PHYSDEVPATH' in this case) points to the USB device instead of the USB interface. For these versions of the UVC driver dynamic controls are not supported anyway. Please update your uvcvideo driver to the latest version if you know that this device is a UVC device." >> $logfile	fi	exit 3fiif [ -z $ifacepath ]; then	echo "ERROR: Interface path not available." >> $logfile	exit 4fi# Make sure the vendor directory ($xmlpath/VID) existsvendordir="$xmlpath/$vid"if [ ! -d "$vendordir" ]; then	echo "ERROR: Vendor directory '$vendordir' not found." >> $logfile	exit 5fi# Look for device specific XML files ($xmlpath/VID/PID/*.xml)if [ ! -z $pid ]; then	productdir="$xmlpath/$vid/$pid"	if [ -d "$productdir" ]; then		for file in $productdir/*.xml; do			if [ -f "$file" ]; then				echo "Found product XML file: $file" >> $logfile				cmd="$uvcdynctrlpath -d $DEVNAME -i $file"				echo "Executing command: '$cmd'" >> $logfile				$cmd >> $logfile 2>&1			fi		done	fifi# Look for vendor specific XML files ($xmlpath/VID/*.xml)for file in $vendordir/*.xml; do	if [ -f "$file" ]; then		echo "Found vendor XML file: $file" >> $logfile		cmd="$uvcdynctrlpath -d $DEVNAME -i $file"		echo "Executing command: '$cmd'" >> $logfile		$cmd >> $logfile 2>&1	fidoneecho -e "==============================================================================\n" >> $logfile

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -