解决ubuntu下 笔记本内置摄像头发热问题
发表于 : 2009-12-13 11:34
几天前,发现在ubuntu下,本本的摄像头发热,考虑应该是因为摄像头一直在工作,查了一些资料,试着禁用它,找到代码
可是,这个不是我电脑摄像头多代码呀,怎么办?
控制台下 输入 lsusb 查看usb信息
Bus 001 Device 002: ID 0ac8:c302 Z-Star Microelectronics Corp. Vega USB 2.0 Camera
可是 这是怎么能转换成第一个代码呢??记住红色的东西先!!
于是我们用到了lshal,它是什么??
lshal is a utility for displaying items in the HAL device database. For more information about both the big picture and specific HAL properties, refer to the HAL spec which can be found in /usr/share/doc/hal-doc/spec/hal-spec.html depending on the distribution.
这是它多信息,这是啥??
看不懂就不看 看看我们感兴趣的一些信息吧!
终端输入
得到代码:
udi = '/org/freedesktop/Hal/devices/usb_device_ac8_c302_noserial_if0_logicaldev_input'
button.has_state = false (bool)
info.addons.singleton = {'hald-addon-input'} (string list)
info.callouts.add = {'debian-setup-keyboard'} (string list)
info.capabilities = {'input', 'button', 'input.keys'} (string list)
info.category = 'input' (string)
info.parent = '/org/freedesktop/Hal/devices/usb_device_ac8_c302_noserial_if0' (string)
info.product = 'Vega USB 2.0 Camera.' (string)
info.subsystem = 'input' (string)
info.udi = '/org/freedesktop/Hal/devices/usb_device_ac8_c302_noserial_if0_logicaldev_input' (string)
input.device = '/dev/input/event10' (string)
input.originating_device = '/org/freedesktop/Hal/devices/usb_device_ac8_c302_noserial_if0' (string)
input.product = 'Vega USB 2.0 Camera.' (string)
input.x11_driver = 'evdev' (string)
input.xkb.layout = 'cn' (string)
input.xkb.model = 'pc105' (string)
input.xkb.rules = 'base' (string)
linux.device_file = '/dev/input/event10' (string)
linux.hotplug_type = 2 (0x2) (int)
linux.subsystem = 'input' (string)
linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1a.7/usb1/1-1/1-1:1.0/input/input10/event10' (string)
udi = '/org/freedesktop/Hal/devices/usb_device_ac8_c302_noserial_if0_video4linux'
info.capabilities = {'video4linux', 'video4linux.video_capture'} (string list)
info.category = 'video4linux' (string)
info.parent = '/org/freedesktop/Hal/devices/usb_device_ac8_c302_noserial_if0' (string)
info.product = 'Vega USB 2.0 Camera.' (string)
info.subsystem = 'video4linux' (string)
info.udi = '/org/freedesktop/Hal/devices/usb_device_ac8_c302_noserial_if0_video4linux' (string)
linux.device_file = '/dev/video0' (string)
linux.hotplug_type = 2 (0x2) (int)
linux.subsystem = 'video4linux' (string)
linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1a.7/usb1/1-1/1-1:1.0/video4linux/video0' (string)
video4linux.device = '/dev/video0' (string)
video4linux.version = '2' (string)
这只是一部分,现在,实话我也不知道具体都是啥,还要继续学习啊! 但是我们要的信息里面已经有了,看见没,对 就是红色的部分 !哈哈,我们行动吧!
关闭摄像头的usb
启用摄像头的usb
但是后来我发现上面多方法好像没有作用阿!怎么办啊!! 那我想是不是可以换个思路,继续查资料,后来我发现了一个解决笔记本指纹识别发热的文章,想到应该可以借鉴一下,具体方法如下
首先我们需要检测摄像头是否没有处在自动挂起模式。
打开一个终端并运行:
得到多代码是
/sys/devices/pci0000:00/0000:00:1a.0/usb3/power/level: auto
/sys/devices/pci0000:00/0000:00:1a.1/usb4/power/level: auto
/sys/devices/pci0000:00/0000:00:1a.7/usb1/power/level: auto
/sys/devices/pci0000:00/0000:00:1a.7/usb1/1-1/power/level: on
/sys/devices/pci0000:00/0000:00:1d.0/usb5/power/level: auto
/sys/devices/pci0000:00/0000:00:1d.1/usb6/power/level: auto
/sys/devices/pci0000:00/0000:00:1d.1/usb6/6-1/power/level: on
/sys/devices/pci0000:00/0000:00:1d.1/usb6/6-2/power/level: auto
/sys/devices/pci0000:00/0000:00:1d.1/usb6/6-2/6-2.1/power/level: on
/sys/devices/pci0000:00/0000:00:1d.2/usb7/power/level: auto
/sys/devices/pci0000:00/0000:00:1d.2/usb7/7-2/power/level: on
/sys/devices/pci0000:00/0000:00:1d.7/usb2/power/level: auto
下面我们只看on的选项,发现了什么红色部分的路径正好是我的摄像头
我们还可以运行例如(每次多路径不一样的,就是上面为on的设备路径):
得到
0ac8
得到
c302
发现了吗 这正是摄像头id 呵呵 很多方法都可以达到一样多效果
接着我们就把它设置成自动挂起模式:
首先打开终端 取得root权限!怎么取得 呵呵在ubuntu下
******(输入原先的root口令)
******(输入新的root口令,可以保持原样。我就保持的原样)
******(再次输入新的root口令)
我们这里是
此刻 呵呵 现在摄像头就变成自动刮起模式了,几分钟后我发现不热了,后来重启发现问题依旧,再次
发现又变成了on状态!原来这样只是当前起作用,那我们现在就将他设置成永久有效!
如果你想让这个改动持续有效并且已经安装了sysfsutils,则编辑文件/etc/sysfs.conf并加入这行:
<设备的路径>/power/level = auto
对于前面的例子,则应该是
呵呵,打开/etc/sysfs.conf 无法保存? 因为如果你多权限不是root的话 就保存不了!终端下取得root权限 然后 gedit /etc/sysfs.conf 进入然后编辑 然后保存!重启 然后
for i in `find /sys/devices/*/*/usb* -name level` ; do echo -n "$i: " ; cat $i ; done
成功了现在已经是 auto了
大功告成! 不仅不用的时候温度下去了!而且,不影响摄像头使用!
很多事情,就靠我们一点点区挖掘,一点点区学习!又问题,不要放弃,慢慢来,一定可以解决的,第一部分的方法没成功但是还写出来了,呵呵因为第二部分也用到了前面的东西的! 而且也是一个思路,只不过不太正确而已! 第一次发贴,大家不要取笑
代码: 全选
sudo sh -c "echo 0 > /sys/devices/pci0000:00/0000:00:1d.7/usb5/bConfigurationValue"
控制台下 输入 lsusb 查看usb信息
Bus 001 Device 002: ID 0ac8:c302 Z-Star Microelectronics Corp. Vega USB 2.0 Camera
可是 这是怎么能转换成第一个代码呢??记住红色的东西先!!
于是我们用到了lshal,它是什么??
lshal is a utility for displaying items in the HAL device database. For more information about both the big picture and specific HAL properties, refer to the HAL spec which can be found in /usr/share/doc/hal-doc/spec/hal-spec.html depending on the distribution.
这是它多信息,这是啥??
看不懂就不看 看看我们感兴趣的一些信息吧!
终端输入
代码: 全选
lshal
udi = '/org/freedesktop/Hal/devices/usb_device_ac8_c302_noserial_if0_logicaldev_input'
button.has_state = false (bool)
info.addons.singleton = {'hald-addon-input'} (string list)
info.callouts.add = {'debian-setup-keyboard'} (string list)
info.capabilities = {'input', 'button', 'input.keys'} (string list)
info.category = 'input' (string)
info.parent = '/org/freedesktop/Hal/devices/usb_device_ac8_c302_noserial_if0' (string)
info.product = 'Vega USB 2.0 Camera.' (string)
info.subsystem = 'input' (string)
info.udi = '/org/freedesktop/Hal/devices/usb_device_ac8_c302_noserial_if0_logicaldev_input' (string)
input.device = '/dev/input/event10' (string)
input.originating_device = '/org/freedesktop/Hal/devices/usb_device_ac8_c302_noserial_if0' (string)
input.product = 'Vega USB 2.0 Camera.' (string)
input.x11_driver = 'evdev' (string)
input.xkb.layout = 'cn' (string)
input.xkb.model = 'pc105' (string)
input.xkb.rules = 'base' (string)
linux.device_file = '/dev/input/event10' (string)
linux.hotplug_type = 2 (0x2) (int)
linux.subsystem = 'input' (string)
linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1a.7/usb1/1-1/1-1:1.0/input/input10/event10' (string)
udi = '/org/freedesktop/Hal/devices/usb_device_ac8_c302_noserial_if0_video4linux'
info.capabilities = {'video4linux', 'video4linux.video_capture'} (string list)
info.category = 'video4linux' (string)
info.parent = '/org/freedesktop/Hal/devices/usb_device_ac8_c302_noserial_if0' (string)
info.product = 'Vega USB 2.0 Camera.' (string)
info.subsystem = 'video4linux' (string)
info.udi = '/org/freedesktop/Hal/devices/usb_device_ac8_c302_noserial_if0_video4linux' (string)
linux.device_file = '/dev/video0' (string)
linux.hotplug_type = 2 (0x2) (int)
linux.subsystem = 'video4linux' (string)
linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1a.7/usb1/1-1/1-1:1.0/video4linux/video0' (string)
video4linux.device = '/dev/video0' (string)
video4linux.version = '2' (string)
这只是一部分,现在,实话我也不知道具体都是啥,还要继续学习啊! 但是我们要的信息里面已经有了,看见没,对 就是红色的部分 !哈哈,我们行动吧!
代码: 全选
sudo sh -c "echo 0>/sys/devices/pci0000:00/0000:00:1a.7/usb1/bConfigurationValue"
代码: 全选
sudo sh -c "echo 1>/sys/devices/pci0000:00/0000:00:1a.7/usb1/bConfigurationValue"
但是后来我发现上面多方法好像没有作用阿!怎么办啊!! 那我想是不是可以换个思路,继续查资料,后来我发现了一个解决笔记本指纹识别发热的文章,想到应该可以借鉴一下,具体方法如下
首先我们需要检测摄像头是否没有处在自动挂起模式。
打开一个终端并运行:
代码: 全选
for i in `find /sys/devices/*/*/usb* -name level` ; do echo -n "$i: " ; cat $i ; done
/sys/devices/pci0000:00/0000:00:1a.0/usb3/power/level: auto
/sys/devices/pci0000:00/0000:00:1a.1/usb4/power/level: auto
/sys/devices/pci0000:00/0000:00:1a.7/usb1/power/level: auto
/sys/devices/pci0000:00/0000:00:1a.7/usb1/1-1/power/level: on
/sys/devices/pci0000:00/0000:00:1d.0/usb5/power/level: auto
/sys/devices/pci0000:00/0000:00:1d.1/usb6/power/level: auto
/sys/devices/pci0000:00/0000:00:1d.1/usb6/6-1/power/level: on
/sys/devices/pci0000:00/0000:00:1d.1/usb6/6-2/power/level: auto
/sys/devices/pci0000:00/0000:00:1d.1/usb6/6-2/6-2.1/power/level: on
/sys/devices/pci0000:00/0000:00:1d.2/usb7/power/level: auto
/sys/devices/pci0000:00/0000:00:1d.2/usb7/7-2/power/level: on
/sys/devices/pci0000:00/0000:00:1d.7/usb2/power/level: auto
下面我们只看on的选项,发现了什么红色部分的路径正好是我的摄像头
我们还可以运行例如(每次多路径不一样的,就是上面为on的设备路径):
代码: 全选
cat /sys/devices/pci0000:00/0000:00:1a.7/usb1/1-1/idVendor
0ac8
代码: 全选
cat /sys/devices/pci0000:00/0000:00:1a.7/usb1/1-1//idProduct
c302
发现了吗 这正是摄像头id 呵呵 很多方法都可以达到一样多效果
接着我们就把它设置成自动挂起模式:
首先打开终端 取得root权限!怎么取得 呵呵在ubuntu下
代码: 全选
sudo passwd root
******(输入新的root口令,可以保持原样。我就保持的原样)
******(再次输入新的root口令)
代码: 全选
su root
代码: 全选
echo "auto" > /sys/<设备的路径>/power/level
代码: 全选
echo "auto" >/sys/devices/pci0000:00/0000:00:1a.7/usb1/1-1/power/level
代码: 全选
for i in `find /sys/devices/*/*/usb* -name level` ; do echo -n "$i: " ; cat $i ; done
如果你想让这个改动持续有效并且已经安装了sysfsutils,则编辑文件/etc/sysfs.conf并加入这行:
<设备的路径>/power/level = auto
对于前面的例子,则应该是
代码: 全选
devices/pci0000:00/0000:00:1a.7/usb1/1-1/power/level= auto
for i in `find /sys/devices/*/*/usb* -name level` ; do echo -n "$i: " ; cat $i ; done
成功了现在已经是 auto了
大功告成! 不仅不用的时候温度下去了!而且,不影响摄像头使用!
很多事情,就靠我们一点点区挖掘,一点点区学习!又问题,不要放弃,慢慢来,一定可以解决的,第一部分的方法没成功但是还写出来了,呵呵因为第二部分也用到了前面的东西的! 而且也是一个思路,只不过不太正确而已! 第一次发贴,大家不要取笑