关闭uvcdynctrl-udev.log

在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
@              

 

就是这么简单                                                                                              

  • 4
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值