liunx环境,摄像头无法识别,解决方案

今天无语了,linux14.04系统下,使用罗技c270摄像头。发现插上没有反应,系统版本:

lenovo-myc@lenovomyc-Lenovo-Product:~/Downloads$ uname -a
Linux lenovomyc-Lenovo-Product 3.13.0-61-generic #100-Ubuntu SMP Wed Jul 29 11:21:34 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

 

找了一上午UVC驱动,最后发现是测试摄像头的程序cheese刚刚有点问题

 

---------------------------------------------------这是分割线----------------------------------------------------

下载了luvcview, 运行,正常工作

lenovo-myc@lenovomyc-Lenovo-Product:~/Downloads$ sudo apt-get install luvcview
Reading package lists... Done
Building dependency tree       
Reading state information... Done
luvcview is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
lenovo-myc@lenovomyc-Lenovo-Product:~/Downloads$ luvcview
luvcview 0.2.6

SDL information:
  Video driver: x11
  A window manager is available
Device information:
  Device path:  /dev/video0
Stream settings:
  Frame format: MJPG
  Frame size:   640x480
  Frame rate:   30 fps
find DRI 
find DRI 
find DRI 
find DRI 
find DRI 
find DRI 
find DRI 
find DRI 
find DRI 
find DRI 
find DRI 
find DRI 
find DRI 
find DRI 
find DRI 
find DRI 
find DRI 
find DRI 

 

 

 

---------------------------------------------------以下是上午进行的尝试---------------------------------------------------

 

(1)判断是否为UVC设备

http://blog.csdn.net/myarrow/article/details/8465384

  判断一个摄像头是否属于UVC规范可以使用下面方法:

  1.使用lsusb命令或其它硬件信息查看工具找出摄像头的设备号(Vendor ID)和产品号(Product ID)。如Logitech Quickcam for Notebooks Pro摄像头是046d:08cb;

  2.查找是否有视频类接口信息

  lsusb -d 046d:08cb -v | grep "14 Video"

  如果该摄像头兼容UVC,则会输出类似信息

  bFunctionClass 14 Video

  bInterfaceClass 14 Video

  bInterfaceClass 14 Video

  bInterfaceClass 14 Video

  若无以上信息,则是non-UVC设备。

 

 

(2) uvc官网  http://www.ideasonboard.org/uvc/ 有说明:

Linux 2.6.26 and newer includes the Linux UVC driver natively. You will not need to download the driver sources manually unless you want to test a newer version or help with development.

就是说:linux 2.6.26 以及高版本内核都自带UVC驱动的。还以为系统有问题

系统目录下也有 /dev/video0 文件,说明摄像头驱动正常

 

lsusb输出当前usb设备  

罗技C270 为 046d:0825

lenovo-myc@lenovomyc-Lenovo-Product:/dev$ lsusb
Bus 002 Device 012: ID 046d:0825 Logitech, Inc. Webcam C270
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 17ef:6019 Lenovo 
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

 

 

(3)ubuntu下使用UVC摄像头  http://blog.csdn.net/xingyu19871124/article/details/5764954

 

分别下载了

1、v41-dvb  

网址:http://linuxtv.org/hg/v4l-dvb/  make的时候出错,版本不匹配。是针对linux 3.3.0版本编译的, 当前版本为3.13.0 报错:

UVC File not found: /lib/modules/3.3.0-61-generic/build/.config   

又根据:

http://blog.sina.com.cn/s/blog_3dc687f30100kwf5.html

尝试 make config 依旧不行,放弃

 

重新clone了一遍源码

lenovo-myc@lenovomyc-Lenovo-Product:/dev$ git clone git://linuxtv.org/media_build.git

make (编译内核 。。。)

lenovo-myc@lenovomyc-Lenovo-Product:~/Downloads/media_build$ make
make -C /home/lenovo-myc/Downloads/media_build/v4l 
make[1]: Entering directory `/home/lenovo-myc/Downloads/media_build/v4l'
Updating/Creating .config
make[2]: Entering directory `/home/lenovo-myc/Downloads/media_build/linux'
Applying patches for kernel 3.13.0-61-generic
patch -s -f -N -p1 -i ../backports/api_version.patch
patch -s -f -N -p1 -i ../backports/pr_fmt.patch
patch -s -f -N -p1 -i ../backports/debug.patch
patch -s -f -N -p1 -i ../backports/drx39xxj.patch
patch -s -f -N -p1 -i ../backports/v4.1_pat_enabled.patch
patch -s -f -N -p1 -i ../backports/v4.0_dma_buf_export.patch
patch -s -f -N -p1 -i ../backports/v4.0_drop_trace.patch
patch -s -f -N -p1 -i ../backports/v3.16_netdev.patch
patch -s -f -N -p1 -i ../backports/v3.16_wait_on_bit.patch
patch -s -f -N -p1 -i ../backports/v3.16_void_gpiochip_remove.patch
Patched drivers/media/dvb-core/dvbdev.c
Patched drivers/media/v4l2-core/v4l2-dev.c
Patched drivers/media/rc/rc-main.c
make[2]: Leaving directory `/home/lenovo-myc/Downloads/media_build/linux'
Preparing to compile for kernel version 3.13.0

***WARNING:*** You do not have the full kernel sources installed.
This does not prevent you from building the v4l-dvb tree if you have the
kernel headers, but the full kernel source may be required in order to use
make menuconfig / xconfig / qconfig.

If you are experiencing problems building the v4l-dvb tree, please try
building against a vanilla kernel before reporting a bug.

Vanilla kernels are available at http://kernel.org.
On most distros, this will compile a newly downloaded kernel:

cp /boot/config-`uname -r` <your kernel dir>/.config
cd <your kernel dir>
make all modules_install install

Please see your distro's web site for instructions to build a new kernel.

WARNING: This is the V4L/DVB backport tree, with experimental drivers
     backported to run on legacy kernels from the development tree at:
        http://git.linuxtv.org/media-tree.git.
     It is generally safe to use it for testing a new driver or
     feature, but its usage on production environments is risky.
     Don't use it in production. You've been warned.
V4L2_FLASH_LED_CLASS: Requires at least kernel 4.2.0
RC_ST: Requires at least kernel 3.15.0
VIDEO_XILINX: Requires at least kernel 3.17.0
I2C_SI4713: Requires at least kernel 3.17.0
VIDEO_ADV7604: Requires at least kernel 3.17.0
VIDEO_MT9P031: Requires at least kernel 3.17.0
VIDEO_MT9V032: Requires at least kernel 3.19.0
VIDEO_SMIAPP: Requires at least kernel 4.0.0
SOC_CAMERA_OV2640: Requires at least kernel 3.17.0
Created default (all yes) .config file
./scripts/make_myconfig.pl
make[1]: Leaving directory `/home/lenovo-myc/Downloads/media_build/v4l'
make[1]: Entering directory `/home/lenovo-myc/Downloads/media_build/v4l'
perl scripts/make_config_compat.pl /lib/modules/3.13.0-61-generic/build ./.myconfig ./config-compat.h
creating symbolic links...
make -C firmware prep
make[2]: Entering directory `/home/lenovo-myc/Downloads/media_build/v4l/firmware'
make[2]: Leaving directory `/home/lenovo-myc/Downloads/media_build/v4l/firmware'
make -C firmware
make[2]: Entering directory `/home/lenovo-myc/Downloads/media_build/v4l/firmware'
Generating vicam/firmware.fw
Generating ttusb-budget/dspbootcode.bin
Generating cpia2/stv0672_vp4.bin
Generating av7110/bootcode.bin
make[2]: Leaving directory `/home/lenovo-myc/Downloads/media_build/v4l/firmware'
Kernel build directory is /lib/modules/3.13.0-61-generic/build
make -C ../linux apply_patches
make[2]: Entering directory `/home/lenovo-myc/Downloads/media_build/linux'
Patches for 3.13.0-61-generic already applied.
make[2]: Leaving directory `/home/lenovo-myc/Downloads/media_build/linux'
make -C /lib/modules/3.13.0-61-generic/build SUBDIRS=/home/lenovo-myc/Downloads/media_build/v4l  modules
make[2]: Entering directory `/usr/src/linux-headers-3.13.0-61-generic'
  CC [M]  /home/lenovo-myc/Downloads/media_build/v4l/bt87x.o
  LD [M]  /home/lenovo-myc/Downloads/media_build/v4l/snd-bt87x.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/lenovo-myc/Downloads/media_build/v4l/snd-bt87x.mod.o
  LD [M]  /home/lenovo-myc/Downloads/media_build/v4l/snd-bt87x.ko
make[2]: Leaving directory `/usr/src/linux-headers-3.13.0-61-generic'
./scripts/rmmod.pl check
Can't locate Proc/ProcessTable.pm in @INC (you may need to install the Proc::ProcessTable module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at ./scripts/rmmod.pl line 4.
BEGIN failed--compilation aborted at ./scripts/rmmod.pl line 4.
make[1]: *** [default] Error 2
make[1]: Leaving directory `/home/lenovo-myc/Downloads/media_build/v4l'
make: *** [all] Error 2
View Code

 

 

2、gspcav1-20071224.tar.gz

网址:http://mxhaard.free.fr/download.html

make依旧出错

 

后来下载了 luvciew。发现摄像头可以运行! 好吧,到此结束

 

 

 ---------------------------------------------------other---------------------------------------------------

 

1、查看摄像头ID:

[root@151 dev]# lsusb

Bus 002 Device 013: ID 0ac8:3313 Z-Star Microelectronics Corp.

0xc8:3313在UVC中支持了。

2、插入摄像头后,就可以在/dev/下查看是否有video设备文件:

[root@151 dev]# ls | grep video

video

video0

其中,video是video0的连接。如果没有再现,可能UVC没有配置到内核中,重新配置就可以了

(大致在Device DriversàMultimedia devicesàVideo capture adaptersàV4L USB devices下面)。如果内核配置了,

还是不出现,可以使用modprobe uvcvideo来加载该模块。

3、先看看摄像头的相关信息:

lshal | grep Cam

出现:

info.product = 'Vega USB 2.0 Camera.' (string)

usb_device.product = 'Vega USB 2.0 Camera.' (string)

usb.interface.description = 'Vega USB 2.0 Camera.' (string)

info.product = 'Vega USB 2.0 Camera.' (string)

input.product = 'Vega USB 2.0 Camera.' (string)

info.product = 'Vega USB 2.0 Camera.' (string)

对USB有研究的,就很熟悉这些字段。

再看一下系统能不能识别出摄像头:

[root@151 log]# dmesg | grep Cam

uvcvideo: Found UVC 1.00 device Vega USB 2.0 Camera. (0ac8:3313)

input: Vega USB 2.0 Camera. as /class/input/input6

usb 2-7: Product: Vega USB 2.0 Camera.

uvcvideo: Found UVC 1.00 device Vega USB 2.0 Camera. (0ac8:3313)

input: Vega USB 2.0 Camera. as /class/input/input7

usb 2-7: Product: Vega USB 2.0 Camera.

uvcvideo: Found UVC 1.00 device Vega USB 2.0 Camera. (0ac8:3313)

input: Vega USB 2.0 Camera. as /class/input/input8

usb 2-7: Product: Vega USB 2.0 Camera.

[root@151 ~]# dmesg | grep video

pci 0000:05:00.0: Boot video device

Linux video capture interface: v2.00

usbcore: registered new interface driver uvcvideo

uvcvideo 2-7:1.0: usb_probe_interface

uvcvideo 2-7:1.0: usb_probe_interface - got id

uvcvideo: Found UVC 1.00 device Vega USB 2.0 Camera. (0ac8:3313)

uvcvideo 2-7:1.0: usb_probe_interface

uvcvideo 2-7:1.0: usb_probe_interface - got id

uvcvideo: Found UVC 1.00 device Vega USB 2.0 Camera. (0ac8:3313)

uvcvideo 2-7:1.0: usb_probe_interface

uvcvideo 2-7:1.0: usb_probe_interface - got id

uvcvideo: Found UVC 1.00 device Vega USB 2.0 Camera. (0ac8:3313)

转载于:https://www.cnblogs.com/maxiaodoubao/p/4720651.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值