解决ubuntu下 笔记本内置摄像头发热问题

笔记本/便携移动设备,手机平板等软硬件
回复
174545690
帖子: 7
注册时间: 2008-12-01 13:02

解决ubuntu下 笔记本内置摄像头发热问题

#1

帖子 174545690 »

几天前,发现在ubuntu下,本本的摄像头发热,考虑应该是因为摄像头一直在工作,查了一些资料,试着禁用它,找到代码

代码: 全选

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"
关闭摄像头的usb

代码: 全选

sudo sh -c "echo 1>/sys/devices/pci0000:00/0000:00:1a.7/usb1/bConfigurationValue"
启用摄像头的usb

但是后来我发现上面多方法好像没有作用阿!怎么办啊!! 那我想是不是可以换个思路,继续查资料,后来我发现了一个解决笔记本指纹识别发热的文章,想到应该可以借鉴一下,具体方法如下

首先我们需要检测摄像头是否没有处在自动挂起模式。
打开一个终端并运行:

代码: 全选

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口令,可以保持原样。我就保持的原样)

******(再次输入新的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
发现又变成了on状态!原来这样只是当前起作用,那我们现在就将他设置成永久有效!

如果你想让这个改动持续有效并且已经安装了sysfsutils,则编辑文件/etc/sysfs.conf并加入这行:

<设备的路径>/power/level = auto

对于前面的例子,则应该是

代码: 全选

devices/pci0000:00/0000:00:1a.7/usb1/1-1/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了
大功告成! 不仅不用的时候温度下去了!而且,不影响摄像头使用!
很多事情,就靠我们一点点区挖掘,一点点区学习!又问题,不要放弃,慢慢来,一定可以解决的,第一部分的方法没成功但是还写出来了,呵呵因为第二部分也用到了前面的东西的! 而且也是一个思路,只不过不太正确而已! 第一次发贴,大家不要取笑
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: 解决ubuntu下 笔记本内置摄像头发热问题

#2

帖子 eexpress »

记得发过脚本的。
● 鸣学
174545690
帖子: 7
注册时间: 2008-12-01 13:02

Re: 解决ubuntu下 笔记本内置摄像头发热问题

#3

帖子 174545690 »

eexpress 写了:记得发过脚本的。
我刚上ubuntu不几天,去年就准备用来着 后来因为电脑是在是装不上就一直拖到现在,我也看到过你多帖子 还有东西想请教呢,就是那个你是怎么查到设备路径的!
头像
pcbird
帖子: 2337
注册时间: 2008-12-19 13:44
来自: 东8区

Re: 解决ubuntu下 笔记本内置摄像头发热问题

#4

帖子 pcbird »

吧你的过程合成一个脚本

代码: 全选

 
       \   ,__,
        \  (oo)____
           (__)    )\
              ||--|| *  
 
174545690
帖子: 7
注册时间: 2008-12-01 13:02

Re: 解决ubuntu下 笔记本内置摄像头发热问题

#5

帖子 174545690 »

pcbird 写了:吧你的过程合成一个脚本
那就请高手写成脚本吧 ! 我不会!
cstn
帖子: 30
注册时间: 2008-10-01 17:35

Re: 解决ubuntu下 笔记本内置摄像头发热问题

#6

帖子 cstn »

楼主好人!虽然现在ubuntu原生系统早就解决了这个问题。但是楼主的方法却修复了困扰我很久的debian squeeze下笔记本内置USB设备发热的问题,包括摄像头、指纹等,感谢楼主!
头像
guyanqiu
帖子: 360
注册时间: 2009-05-05 23:42

Re: 解决ubuntu下 笔记本内置摄像头发热问题

#7

帖子 guyanqiu »

标记,备查。
:em04
-----------------------
在迷茫中追逐,在追逐中迷茫……
-----------------------
ixepet
帖子: 25
注册时间: 2012-12-14 4:42
系统: MAC OS X

Re: 解决ubuntu下 笔记本内置摄像头发热问题

#8

帖子 ixepet »

cstn 写了:楼主好人!虽然现在ubuntu原生系统早就解决了这个问题。但是楼主的方法却修复了困扰我很久的debian squeeze下笔记本内置USB设备发热的问题,包括摄像头、指纹等,感谢楼主!
:em20
没有解决这个问题啊 现在12•04还是很热啊 还不知道指纹识别也会不会很热呢 担心
回复