在linux系统中使用USB摄像头时,都会用到这个uvcdynctrl,但是uvcdynctrl也会一些问题引发输出巨量的log文件,会把系统占用达到100%。
但是事实上在根目录下的lib/udev中有一个uvcdynctrl文件可以控制是否把log输出到文件。
#!/bin/sh
###################################################################################################
# udev helper script for UVC devices to support dynamic controls.
#
# Version: 0.2
#
# Note that version 0.2 no longer works with older versions of udev. This script should be
# compatible with udev >= 141.
# Also check 80-uvcdynctrl.rules for more information.
###################################################################################################
# Constants
version=0.3
# Run-time configuration
debug=0 //默认是1
uvcdynctrlpath=uvcdynctrl
# Determine log destination
if [ "$debug" != 0 ]; then
logfile=/var/log/uvcdynctrl-udev.log
else
logfile=/dev/null //写入到“黑洞”里,就是不在文件系统保存
fi
# Write log header
echo >> $logfile
echo "==============================================================================" >> $logfile
echo "uvcdynctrl script version $version running from '$0'" >> $logfile
echo "Triggered at `date`" >> $logfile
echo >> $logfile
set >> $logfile
echo >> $logfile
# Check for the udev version and bail out if it's too old
if [ -z "$ID_VENDOR_ID" ]; then
echo "ERROR: The ID_VENDOR_ID variable is not defined. You are probably using an older version of udev. Please upgrade to udev >= 141 or use version 0.1 of this script." >> $logfile
exit 2
fi
# Extract the VID and PID
vid=$ID_VENDOR_ID
pid=$ID_MODEL_ID
echo "VID of new device: '$vid'" >> $logfile
echo "PID of new device: '$pid'" >> $logfile
if [ -z $vid ]; then
echo "ERROR: Unable to extract USB VID." >> $logfile
exit 3
fi
# Check whether the device is managed by the UVC driver
if [ "$ID_USB_DRIVER" != "uvcvideo" ]; then
echo "ERROR: Device is not handled by uvcvideo but by '$ID_USB_DRIVER'." >> $logfile
if [ "$ID_USB_DRIVER" = "usb" ]; then
@
就是这么简单