最近心情比较烦,很郁闷,有各种各样的事情,又快考试了,还有六级,还有学习,还有自己的计划,总之写篇博客整理一下心情啦。
因为打算做一个实际用处的东西,需要用到摄像头,所以最近开始了摄像头的移植。
我移植的摄像头的芯片是ov511 ,非常幸运的是linux内核默认支持ov511 摄像头驱动。
所以很容易的开始了我的摄像头移植之路。我用的内核是2.6.32.2
要支持USB摄像头首先需要这样一些选项,
make menuconfig 进入图形界面进行,内核的配置和裁剪。
首先
配置内核,支持 USB:
Device drivers --->
SCSI Device support --->
<*> SCSI device support
[*] legacy /proc/scsi/ support
<*> SCSI disk support
[*] HID Devices --->
<*> USB Human Interface Device (full HID) support
22
[*] /dev/hiddev raw HID device support
[*] USB support --->
<*> Support for Host-side USB
[*] USB device filesystem
[*] USB device class-devices(DEPRECATED)
<*> USB Monitor
<*> OHCI HCD support
<*> USB Mass Storage support
USB Human Interface Device (full HID) support 是对 USB 鼠标键盘的支持
SCSI disk support 和 USB Mass Storage support 是对 U 盘的支持
启动时输出:
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver libusual
usb 1-1: configuration #1 chosen from 1 choice
hub 1-1:1.0: USB hub found
hub 1-1:1.0: 4 ports detected
如果出现这个,说明已经找到 USB HUB,可以使用四个 USB 设备。
U 盘的挂载:
插入 U 盘后会提示:
[root@TX2440A /dev]# usb 1-1.4: new full speed USB device using s3c2410-ohci
and address 3 Å 插入第三个 USB 口
usb 1-1.4: configuration #1 chosen from 1 choice
scsi0 : SCSI emulation for USB Mass Storage devices
scsi 0:0:0:0: Direct-Access Kingston DataTraveler G2 1.00 PQ: 0 ANSI:
2
sd 0:0:0:0: [sda] 7831552 512-byte logical blocks: (4.00 GB/3.73 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: Attached scsi generic sg0 type 0
sd 0:0:0:0: [sda] Assuming drive cache: write through
23
sda: sda1 Å 设备名称
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] Attached SCSI removable disk
然后选择对于摄像头的支持
1)在arm linux的kernel目录下make menuconfig。
(2)首先
device drive->
选择Multimedia device->下的Video for linux。加载video4linux模块,
为视频采集设备提供了编程接口;
(3)然后在usb support->目录下(*)选择support for usb和usb camera ov511
这里遇到一个问题,就是我的内核只要是加载 usb camera ov511
重启根文件系统,插入摄像头没有任何反应
120S以后便会崩溃,后来发现问题
原来,linux内核有些驱动并不是很完美的,也会存在bug。而官方会把没有解决的存在bug的驱动标注出来
就会在你所要添加的驱动上添加(DEPRECATED)
< > USB OV511 Camera support (DEPRECATED)
这个意思是可替代的废弃的。。。
查看它的help信息
CONFIG_VIDEO_OVCAMCHIP: │
│ │
│ Support for the OmniVision OV6xxx and OV7xxx series of camera chips. │
│ This driver is intended to be used with the ov511 and w9968cf USB │
│ camera drivers. │
│ │
│ To compile this driver as a module, choose M here: the │
│ module will be called ovcamchip. │
│ │
│ Symbol: VIDEO_OVCAMCHIP [=n] │
│ Prompt: OmniVision Camera Chip support │
│ Defined at drivers/media/video/Kconfig:941 │
│ Depends on: MEDIA_SUPPORT [=y] && VIDEO_CAPTURE_DRIVERS [=y] && VIDEO │
│ Locatio -> Device Drivers │
│ -> Multimedia support (MEDIA_SUPPORT [=y]) │
│ -> Video capture adapters (VIDEO_CAPTURE_DRIVERS [=y]) │
│ -> V4L USB devices (V4L_USB_DRIVERS [=y])n:
这段话的意思是你可以用ov519的驱动替代ov511的
ov519在 <*> GSPCA based webcams --->
<*> OV519 USB Camera Drive
编译完成,下载到开发板启动后,插入摄像头
usb 1-1.3: new full speed USB device using s3c2410-ohci and address 3
usb 1-1.3: configuration #1 chosen from 1 choice
gspca: probing 05a9:a511
ov519: Device custom id 6c
ov519: Uploading quantization tables
ov519: I2C synced in 0 attempt(s)
ov519: starting OV7xx0 configuration
ov519: Sensor is an OV7620
gspca: probe ok有如下打印信息,
驱动程序移植完成。
但是遇到一个问题就是我用vidicat 测试摄像头的时候
生成的图像全是雪花。这个问题至今没有解决。
PS:仍在解决中。。。。。
参见:ov511驱动移植(二)