主题 : 求助,关于在mini2440上移植usb摄像头的问题 复制链接 | 浏览器收藏 | 打印
学习嵌入式
级别: 侠客
UID: 12237
精华: 0
发帖: 66
金钱: 345 两
威望: 69 点
综合积分: 132 分
注册时间: 2010-01-02
最后登录: 2013-01-14
楼主  发表于: 2010-04-25 18:26

 求助,关于在mini2440上移植usb摄像头的问题

我的mini2440的内核版本号位2.6.29,网上下载了一个摄像头驱动源码gspcav1-20071224.tar,可是编译出现如下问题,请高人指导,谢谢
make -C /opt/kernel/linux-2.6.29/ SUBDIRS=/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224 CC=/usr/local/arm/4.3.2/bin/arm-linux-gcc modules
make[1]: Entering directory `/opt/kernel/linux-2.6.29'
  CC [M]  /opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/gspca_core.o
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/gspca_core.c:55:27: error: asm/semaphore.h: No such file or directory
In file included from /opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/gspca_core.c:846:
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/utils/spcausb.h: In function 'spca5xxRegRead':
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/utils/spcausb.h:95: error: implicit declaration of function 'info'
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/utils/spcausb.h: In function 'spca_set_interface':
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/utils/spcausb.h:278: error: implicit declaration of function 'warn'
In file included from /opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/gspca_core.c:854:
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/Sunplus-jpeg/sp5xxfw2.h: In function 'sp5xxfw2_init':
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/Sunplus-jpeg/sp5xxfw2.h:122: error: called object 'info' is not a function
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/Sunplus-jpeg/sp5xxfw2.h:136: error: called object 'info' is not a function
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/Sunplus-jpeg/sp5xxfw2.h:141: error: called object 'info' is not a function
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/Sunplus-jpeg/sp5xxfw2.h:148: error: called object 'info' is not a function
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/Sunplus-jpeg/sp5xxfw2.h:176: error: called object 'info' is not a function
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/Sunplus-jpeg/sp5xxfw2.h: In function 'sp5xxfw2_start':
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/Sunplus-jpeg/sp5xxfw2.h:214: error: called object 'info' is not a function
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/Sunplus-jpeg/sp5xxfw2.h:230: error: called object 'info' is not a function
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/gspca_core.c: In function 'spca5xx_ioctl':
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/gspca_core.c:2464: error: implicit declaration of function 'video_usercopy'
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/gspca_core.c: At top level:
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/gspca_core.c:2610: error: unknown field 'owner' specified in initializer
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/gspca_core.c:2610: warning: initialization from incompatible pointer type
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/gspca_core.c:2612: error: unknown field 'type' specified in initializer
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/gspca_core.c:2616: warning: initialization from incompatible pointer type
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/gspca_core.c: In function 'spca50x_create_sysfs':
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/gspca_core.c:2770: error: implicit declaration of function 'video_device_create_file'
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/gspca_core.c:2781: error: implicit declaration of function 'video_device_remove_file'
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/gspca_core.c: In function 'spca5xx_probe':
/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/gspca_core.c:4302: error: incompatible types in assignment
make[2]: *** [/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224/gspca_core.o] Error 1
make[1]: *** [_module_/opt/kernel/linux-2.6.29/drivers/media/video/gspcav1-20071224] Error 2
make[1]: Leaving directory `/opt/kernel/linux-2.6.29'
make: *** [default] Error 2

*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2010-04-25 21:23
你用的驱动代码是2007年12月份的,Linux 2.6.29是2009年3月份发布的,不要指望这样的代码还能顺利编译
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 25392
精华: 0
发帖: 28
金钱: 140 两
威望: 28 点
综合积分: 56 分
注册时间: 2010-07-23
最后登录: 2014-02-20
2楼  发表于: 2011-03-30 00:51
我也遇到此问题,

我用的Micro2440开发板和今视通KS-188摄像头,是中星微芯片的,程序使用JPEG图片格式取图像,程序是很成熟的,用了很多年,程序运行就报错,重新编译了内核,还是一样,不知道问题原因,该怎么解决。


想问大侠一下,Micro2440自带的Linux2.6.32.2内核支持中星微驱动和JPEG格式吗?是不是配置一下内核编译选项重新编译就可以。

我编译Linux2.6.32.2内核的配置选项是:

Device Driver
     Multimedia Support
             <*> Video For Linux  

              <*> Video Capture adapter

                      <*> V4L USB Device

                                 <*> GSPCA based WebCamera

                                        <*> ZC3XX USB camera driver

                                 <*> ZC0301 [p] Image  Processor and Control Chip support  

     USB support --->  
               <*> Support for Host-side USB
               --- USB Host Controller Drivers  
               <*> OHCI HCD support  



部分程序代码和运行日志:

// 获取摄像头图像处理芯片组信息
if (ioctl (vd->fd, VIDIOCGCHAN, &vd->videochan) < 0)
{
      g_LogFile.AppLogOut(0, APP_LOG_ERROR,"spcav4l.c:  Hmm did not support Video_channel");
  
      vd->cameratype = UNOW;
      close(vd->fd);
      return exit_fatal ("Couldn't get videodevice videochan");
}
else
{
     if (vd->videochan.name)
     {
         if (0 == strcmp(vd->videodevice,"/dev/video0"))
         {
              g_LogFile.AppLogOut(0, APP_LOG_ERROR,"v1 Bridge = %s", vd->videochan.name);
         }
         else
         {
              g_LogFile.AppLogOut(0, APP_LOG_ERROR,"v2 Bridge = %s", vd->videochan.name);
         }
    
        snprintf (vd->bridge, 9, "%s", vd->videochan.name);
        vd->cameratype = GetStreamId (vd->videochan.name);
        spcaPrintParam (vd->fd,&vd->videoparam);
    }
    else
    {
        g_LogFile.AppLogOut(0, APP_LOG_INFO,"spcav4l.c: Bridge not found not a spca5xx Webcam Probing the hardware !");
  
       vd->cameratype = UNOW;
    }
}
//-- end of " if (ioctl (vd->fd, VIDIOCGCHAN, &vd->videochan) == -1) " --

/* Only jpeg webcam allowed */
if(vd->cameratype != JPEG)
{
    close(vd->fd);
    return exit_fatal ("Not a JPEG webcam sorry Abort !");
}

以下是这部分运行的日志:
Mon Mar 28 15:44:01.011-v1 CameraName: PC Camera
Mon Mar 28 15:44:01.015-v1 Bridge = zc3xx
Mon Mar 28 15:44:01.018-exit_fatal: Not a JPEG webcam sorry Abort !



内核是否需要加入 gspcav1-20071224 驱动代码编译才可以? 我试着加入这个驱动包编译,但发现编译通不过,错误现象同楼主。

请大侠帮忙指点一下,给个解决思路,谢谢。