注:本文出处 http://www.cnblogs.com/leaven/archive/2010/08/19/1802934.html 谢过博主的这篇文章,对我在摄像头方面的学习起到了很大的帮助

http://weijb0606.blog.163.com/blog/static/131286274201063145356429/

我的摄像头终于出现图像了!

李迟按:本文章不是教程,不是心得总结,而是记录我在做毕业设计过程中遇到的一些问题,以及怎么去解决

(有些还是没有解决)。可能带有牢骚,可能带有某些让人不悦的话。希望大家见谅。

今晚很高兴,捣鼓了几天,郁闷了几天的事,今天解决了一些了。起码我能在linux下看到摄像头的图像了。

提起USB摄像在linux下的使用,无论是百度还是Google,出现的多数是法国人写的一个通用驱动程序,即spca5xx,

我也是找了很久才找到,——因为在网上看到的那个网站已经不能登陆了,就是说不再维护了(这个后来再作说明),所以

找了很久。可惜不能用。因为我make都不通过,出现的错误如下:

make -C /lib/modules/`uname -r`/build SUBDIRS=/usr/local/gspcav1-20071224 CC=cc modules

make[1]: Entering directory `/usr/src/linux-2.6.30.2'

CC [M] /usr/local/gspcav1-20071224/gspca_core.o

/usr/local/gspcav1-20071224/gspca_core.c:54:27: error: asm/semaphore.h: No such file or directory

In file included from /usr/local/gspcav1-20071224/gspca_core.c:845:

/usr/local/gspcav1-20071224/utils/spcausb.h: In function ‘spca5xxRegRead’:

/usr/local/gspcav1-20071224/utils/spcausb.h:95: error: implicit declaration of function ‘info’

/usr/local/gspcav1-20071224/utils/spcausb.h: In function ‘spca_set_interface’:

/usr/local/gspcav1-20071224/utils/spcausb.h:278: error: implicit declaration of function ‘warn’

In file included from /usr/local/gspcav1-20071224/gspca_core.c:853:

/usr/local/gspcav1-20071224/Sunplus-jpeg/sp5xxfw2.h: In function ‘sp5xxfw2_init’:

/usr/local/gspcav1-20071224/Sunplus-jpeg/sp5xxfw2.h:122: error: called object ‘info’ is not a function

/usr/local/gspcav1-20071224/Sunplus-jpeg/sp5xxfw2.h:136: error: called object ‘info’ is not a function

/usr/local/gspcav1-20071224/Sunplus-jpeg/sp5xxfw2.h:141: error: called object ‘info’ is not a function

/usr/local/gspcav1-20071224/Sunplus-jpeg/sp5xxfw2.h:148: error: called object ‘info’ is not a function

/usr/local/gspcav1-20071224/Sunplus-jpeg/sp5xxfw2.h:176: error: called object ‘info’ is not a function

/usr/local/gspcav1-20071224/Sunplus-jpeg/sp5xxfw2.h: In function ‘sp5xxfw2_start’:

/usr/local/gspcav1-20071224/Sunplus-jpeg/sp5xxfw2.h:214: error: called object ‘info’ is not a function

/usr/local/gspcav1-20071224/Sunplus-jpeg/sp5xxfw2.h:230: error: called object ‘info’ is not a function

/usr/local/gspcav1-20071224/gspca_core.c: In function ‘spca5xx_ioctl’:

/usr/local/gspcav1-20071224/gspca_core.c:2463: error: implicit declaration of function ‘video_usercopy’

/usr/local/gspcav1-20071224/gspca_core.c: At top level:

/usr/local/gspcav1-20071224/gspca_core.c:2609: error: unknown field ‘owner’ specified in initializer

/usr/local/gspcav1-20071224/gspca_core.c:2609: warning: initialization from incompatible pointer type

/usr/local/gspcav1-20071224/gspca_core.c:2611: error: unknown field ‘type’ specified in initializer

/usr/local/gspcav1-20071224/gspca_core.c:2615: warning: initialization from incompatible pointer type

/usr/local/gspcav1-20071224/gspca_core.c: In function ‘spca50x_create_sysfs’:

/usr/local/gspcav1-20071224/gspca_core.c:2769: error: implicit declaration of function ‘video_device_create_file’

/usr/local/gspcav1-20071224/gspca_core.c:2780: error: implicit declaration of function ‘video_device_remove_file’

/usr/local/gspcav1-20071224/gspca_core.c: In function ‘spca5xx_probe’:

/usr/local/gspcav1-20071224/gspca_core.c:4301: error: incompatible types in assignment

make[2]: *** [/usr/local/gspcav1-20071224/gspca_core.o] Error 1

make[1]: *** [_module_/usr/local/gspcav1-20071224] Error 2

make[1]: Leaving directory `/usr/src/linux-2.6.30.2'

make: *** [default] Error 2

以我现在的能力,我不能解决,我google过,但得不到好的解决方法。

更重要的是,现在想找一个几年前驱动支持的摄像头很难啊!现在都流行免驱了——根据OS相关理论,这是不成功的,

设备没有驱动哪能访问?他们说的是用户免去安装驱动程序这一步骤,——是这个“免驱”。我买的摄像头不

在spca5xx支持范围之中。我好容易找到一个,是小郭用的,摄像头ID刚好是上述驱动所支持的。当时很兴

奋,心想,万事俱备,只差编译、测试了。可惜,以失败告终。错误如上所述。

我试的几个版本为spca5xx-20060501和gspcav1-20071224,都不行。

在网上找了那么多文章看,但一个也行不通。我不知大家的感受是什么,反正我很郁闷,很无奈。

后来,在插入我买的摄像头时,使用了lsusb,将ID那一行复制到google中,一不小心,发现了一个

好网站:http://linux-uvc.berlios.de/。上面竟然有我摄像头的ID号!!继续研究,发现有UVC这个东东,

我在配置内核时也碰到过,但没有注意,没想到如此有用!后来在一个网站中找到有关使用UVC驱动摄像头的

文章,地址忘了,我也不知是怎么搜索到的。此外还下载一个观看图像的小软件(补充一下:luvcview 或者cheese[debian自带])。

结果成了!可以显示图像了!下面写一下过程:

如果你能在http://linux-uvc.berlios.de/找到你的摄像头的ID,即UVC支持的,那么就可以在linux下使用了。

至于从哪个版本开始内核支持UVC,官方的话是“Linux 2.6.26 and newer includes the Linux UVC driver natively.”

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)

哈哈,识别出来了!可以测试了。

4、我使用的软件是luvcview,这个软件google就可以找到的。安装过程很简单,——make,make install就可以了。(哈哈,这里才说)

下面这个过程是测试过程,从看到图像到结束的过程:

[root@151 dev]# luvcview -d /dev/video0 -f yuv -s 640x480   (直接运行luvcview也可)

uvcview verion 0.1.4

size width: 640 height: 480

Video driver: x11

A window manager is available

video /dev/video0

Stop asked

Clean Up done Quit

[root@151 dev]#

解释命令:

-d 设备名,这里/dev/video或/dev/video0都可以,因为它们都是一个文件

-f 格式,有yuv和jpg两种,后者测试不行

-s 大小,能支持的最大尺度可能由luvcview决定,也可能由摄像头决定,(应该是后者,暂没有研究)

更具体的参见luvcview目录下的README文件。

另外,如果没有插入摄像头,即使modprobe uvcvideo也不会出现/dev/video设备文件;插入摄像头,即使没有modprobe uvcvideo,

也会出现/dev/video设备文件,当然这是我的测试,没有代表性,也没有理论根据的。

注:

1、UVC:USB Video Class

2、gspcav不是不再维护,而是在某一版本开始已经纳入内核了,至于哪个版本(2.6.26),就不太清楚了。特此说明。

3、这次毕业设计所不再编译gspca到内核中了。不支持它,直接使用UVC。

第一张图:红旗6.2,内核2.6.28.8

500)this.width=500;" width="500" border="0">

虚拟机FC9,内核2.6.30

500)this.width=500;" width="500" border="0">

发表于: 2010-03-19,修改于:

我跟作者经历简直太相似了,起先搞了好几天真是有点摸不着头脑,哈哈!!

USB Camera摄像头 (UVC 与 gspca)相关推荐

  1. USB Camera摄像头 UVC 驱动

    UVC 驱动的代码在linux-3.7.2\drivers\media\usb\uvc 中 我的摄像头终于出现图像了! 李迟按:本文章不是教程,不是心得总结,而是记录我在做毕业设计过程中遇到的一些问题 ...

  2. USB Camera摄像头(UVC 与 gspca)

    From: http://www.cnblogs.com/leaven/archive/2010/08/19/1802934.html http://weijb0606.blog.163.com/bl ...

  3. USB Camera摄像头

    http://weijb0606.blog.163.com/blog/static/131286274201063145356429/ 我的摄像头终于出现图像了! 李迟按:本文章不是教程,不是心得总结 ...

  4. 外接 USB 摄像头(UVC Camera)

    转载地址:https://source.android.google.cn/devices/camera/external-usb-cameras?hl=zh_cn Android 平台支持使用即插即 ...

  5. USB摄像头转HDMI设备,USB Camera to HDMI

    本文镜像:https://linkpi.cn/archives/1681 本文链接:https://blog.csdn.net/weixin_45326556/article/details/1270 ...

  6. rk3399 采集摄像头数据_[Camera]摄像头镜像

    platform:RK3399 OS:Android 7.1 参考: 1.石先 https://www.jianshu.com/p/7d88ec1347b6 2.KrisFei https://blo ...

  7. 高通平台android 8.1基线某款usb camera打开dev/video1出错

    故障现象: 某客户需要调试一款usb camera,包括黑白和彩色两个sensor: 在调试中发现调用open函数去打开注册的 dev/video1节点时报错: USBCamera: Cannot o ...

  8. usb gadget g_webcam uvc gadget调试

    开发板连接了一个USB camera,想通过UVC gadget将摄像头输出到PC上. 内核关于gadget的测试说明 gadget-testing.txt 中提到: # uvc-gadget -u ...

  9. Camera摄像头模组硬件

    1. 简介 摄像头模组,全称CameraCompact Module,简写为CCM.CCM 包含四大件: 镜头(lens).传感器(sensor).软板(FPC).图像处理芯片(DSP).决定一个摄像 ...

最新文章

  1. html5 data url,HTML5 / Javascript – DataURL到Blob和Blob到DataURL
  2. java 四种实现延迟加载的方法
  3. java项目使用mybatis
  4. [html] DOM和BOM有什么区别?
  5. 技术要点|Python监控学生端电脑屏幕自动识别学习状态
  6. 解决 No module named ‘tensorflow.examples.tutorials‘
  7. 放弃 Python 2 之后,这家公司写了 50 万行的 Go 代码来迁移!
  8. 解决sketch文件导出没有背景色的问题
  9. 20行代码实现网页图片抓取。(待完善
  10. 2gt;MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _calloc 已经在 LIBCMTD.lib(dbgcalloc.obj) 中定义...
  11. [Android]-图片JNI(C++\Java)高斯模糊的实现与比较
  12. 【学习资源】光学、物理类、电子学实验合集
  13. 申请CVE的姿势总结
  14. 《炬丰科技-半导体工艺》 硅光电子器件上的单片砷化铟量子点
  15. 在hive3.1.2中插入数据,报could not find or load main class org.apache.hadoop.mapred.YarnChild
  16. linux :安装中文输入法
  17. 1分钟学会便捷绘制跨职能流程图
  18. 我的世界java版多核优化_Minecraft 我的世界服务器优化教程 —— 让多带50%的玩家不再是梦...
  19. 2018年校招深睿医疗面试
  20. STC8H1K08 - INT3 - 下降沿触发外部中断 3

热门文章

  1. MySQL时间戳和时间的获取/相互转换/格式化
  2. dimission letter exmaple
  3. 用matlab画散点图,并指定点与点之间的连线
  4. c语言中整除和模除的优先级,整除运算与取模运算
  5. 基于JavaWeb平台的常用物联网硬件接口对接代码总结文档_田超凡
  6. A1010. Radix
  7. Docker 使用快速入门
  8. 投资的心里按摩(一):远离噪声
  9. 有些人认识了,就是一辈子的福份
  10. i3 10100f和i5 10400f 哪个好