Chinaunix首页 | 论坛 | 博客
  • 博客访问: 349352
  • 博文数量: 69
  • 博客积分: 3077
  • 博客等级: 中校
  • 技术积分: 602
  • 用 户 组: 普通用户
  • 注册时间: 2009-06-11 09:40
个人简介

或以为孤权重,妄相忖度

文章分类

全部博文(69)

文章存档

2012年(1)

2011年(10)

2010年(39)

2009年(19)

我的朋友

分类: LINUX

2009-06-15 10:13:19

Linux2.6.26.8 移植之:中星微摄像头(ZC03xx+MI0360)驱动的移植

Kernel version :2.6.26.8
Crosstool      :arm-linux-gcc-3.4.1

CameraZC0301b+MI0360

一、移植gspcav1-20071224

gspcav1-20071224下载地址:

步骤1

gspcav1-20071224.tar.gz 复制到linux-kernel-dir/driver/media/video下并解压,重命名文件夹为:gspca
[root@localhost video]# cd gspca
[root@localhost gspca]# vi  Kconfig
添加:

config USB_SPCA5XX

        tristate "USB SPCA5XX Sunplus/Vimicro/Sonix jpeg Cameras"

        depends on USB && VIDEO_DEV

        ---help---

          Say Y or M here if you want to use one of these webcams:

          The built-in microphone is enabled by selecting USB Audio support.

          This driver uses the Video For Linux API. You must say Y or M to

          "Video For Linux" (under Character Devices) to use this driver.

          Information on this API and pointers to "v4l" programs may be found

          at .

          To compile this driver as a module, choose M here: the

          module will be called spca5xx.

[root@localhost gspca]# vi Makefile
添加:

gspca-objs := gspca_core.o decoder/gspcadecoder.o

obj-$(CONFIG_USB_SPCA5XX) += gspca.o

clean:

     rm -r -f *.o decoder/.gspcadecoder.o.cmd decoder/*.o \

     .gspca.o.cmd  *.o *.ko *.mod.* .[a-z]* core *.i \

     *.symvers *.err

步骤2

[root@localhost gspca]# cd ..

[root@localhost video]# vi Makefile

添加:

obj-$(CONFIG_USB_SPCA5XX)   += gspca/
[root@localhost video]# vi Kconfig

if V4L_USB_DRIVERS && USB下面

添加:

source "drivers/media/video/gspca/Kconfig"

步骤3gspca驱动源代码修改

1.

[root@localhost video]# cd gspca

[root@localhost gspca]# gedit zc3xx.h

h:160找到函数:

static int zcxx_probeSensor(struct usb_spca50x *spca50x)

{

         …………

//增加这一句使下面的if语句满足条件,最后能够返回代表MI0360传感器的0x13

checkword = 0xc001;

PDEBUG(1, "sensor 3w Vga ??? 0x%04X ", (checkword & 0xffff));    //h:322

if (checkword == 0xc001 || checkword == 0xe001 || checkword == 0x8001) // h:323

{

………….

return 0x13;

}

…………

}

2.

gspca目录下打开gspca_core.c,将h3592改为:

//spca50x->sensor = SENSOR_PB0330;

spca50x->sensor = SENSOR_MI0360;

步骤4make menuconfig

 Device Drivers  --->

Multimedia devices   --->

Video capture adapters  --->

V4L USB devices
     <*>USB SPCA5XX Sunplus/Vimicro/Sonix jpeg Cameras

此时,可能会提示 gspca_core.c 的错误:
//static const char gspca_version[] = GSPCA_VERSION;
static const char gspca_version[] = "1.00.20";
把新生成的内核烧进开发板,重启,插上中星微芯片的摄像头,命令行出现
# usb 1-1: new full speed USB device using s3c2410-ohci and address 2          
usb 1-1: configuration #1 chosen from 1 choice                                 
drivers/usb/media/gspcav1-20071224/gspca_core.c: USB GSPCA camera found.(ZC3XX)
说明移植的驱动已经能识别设备,设备名所在路径 /dev/video0

 

二、servfox
   
服务器端程序用是servfox,通过它可以在PC上看到开发板采集来的图像,从这里下载


下载,解压,进入其目录,发现没有一个makefile.arm,还有一个makefile.386,将makefile.arm改名为makefile,然后输入命令 make,生成 servfox 可实行文件,copy 到开发板运行之:

# ./servfox -d /dev/video0 -g -s 640x480 -w 7070                               
 servfox version: 1.1.3 date: 11:12:2005 (C)
                  
wrong spca5xx device                                                           
Waiting .... for connection. CTrl_c to stop !!!!                               
Got connection from 192.168.1.2

三、spcaview

    客户端程序使用的是spcaview,下载地址为:


这个程序在PC 上运行,直接解压编译,生成 spcaview 可实行文件,运行如下:

 

[root@weijing spcaview-20061208]# ./spcaview -g -w 192.168.1.17
 Spcaview version: 1.1.7 date: 06:11:2006 (C)

ERROR Set default port to 7070
using Server 192.168.1.17 Port 7070
bright 32768 contrast 32768  

参考:http://blog.chinaunix.net/u/26710/showart_387765.html

阅读(2512) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~