分享

tiny 210 的cmos摄像头问题 Linux技术交流区 ARM9之家论坛

 WUCANADA 2013-03-12



static const char* getCMOSCameraDeviceName()
{
    const char* const devInfoNames[DEVICE_MAX] = {
        "/sys/class/video4linux/video0/name"
        , "/sys/class/video4linux/video2/name"};

    const char* const devNames[DEVICE_MAX] = {
        "/dev/video0"
        , "/dev/video2"};

    FILE* f;
    int i;
    for (i=0; i<DEVICE_MAX;i++) {
        f = fopen( devInfoNames, "r" );
        if (f == NULL) {
            continue;
        }

        char buff[256] = {0};
        int ret = 0;

        if (fread(buff, 1, 255, f) <= 0) {
            continue;
        }
        fclose( f );

        const char* fstr = "s3c-fimc";
        if (strstr(buff, fstr) != NULL) {
            break;
        }
    }
    if (i>=DEVICE_MAX) {
        return 0;
    }
    return devNames;
}

static const char* getUSBCameraDeviceName()
{
    const char* const devInfoNames[2] = {"/sys/class/video4linux/video0/name"
        , "/sys/class/video4linux/video3/name"};

    const char* const devNames[2] = {"/dev/video0"
        , "/dev/video3"};

    FILE* f;
    int i;
    for (i=0; i<2; i++) {
        f = fopen( devInfoNames, "r" );
        if (f == NULL) {
            continue;
        }
        char buff[256] = {0};
        int ret = 0;

        if (fread(buff, 1, 255, f) <= 0) {
            continue;
        }
        fclose( f );
        if (strstr(buff, "s3c-fimc") == NULL) {
            break;
        }
    }
    if (i>=2) {
        return 0;
    }
    return devNames;
}


用的是TINY210  麻烦问问,就是友善 说cmos摄像头的驱动是添加移植的,那那个驱动库文件在哪儿呢?···恩··写程序时该去如何调用,驱动cmos摄像头呢···卡几天了
···  

mindee 2012-05-01 17:35
这个就是标准的V4L2接口驱动,可以参考V4L2编程

yuhero 2012-05-02 10:50
恩!感谢版主!现在正在研究资料当中!但····还是没搞懂手册上说的cmos驱动“友善之臂添加移植”是什么意思呢?到底能不能调用呢?

casiame 2012-06-01 19:28
同样遇到楼主的问题,不知怎么解决,虽说是用V4L2来写,但CCD的摄像头设备名是什么啊,不管怎样都要调用open的啊,是/dev/video0 吗?下面有好多个video设备啊,video0、video1、video14、video2、video21、video22,我是想要CCD,为什 么不管打开那个设备号,都不会出现下面这些信息呢,这是我用友善自带的CMOS摄像头程序打开时出来的信息,是设备号不对呢,还是在open之前还需进行 其他操作呢?????急切想知道答案,望版主一定回复啊!!!!!!!!!!!!!


[ 4996.598181] tvp5150 0-005c: chip found @ 0xb8 (s3c2410-i2c)
[ 4996.665711] tvp5150 0-005c: tvp5150am1 detected.
[ 4996.905377] tvp5150: power ON
[ 4996.905415] tvp5150 0-005c: camera initialization start (00000000)

casiame 2012-06-04 13:46
/dev下的这些设备哪一个是CMOS呢?

CEC                 ptypa               tty47
HPD                 ptypb               tty48
adc                 ptypc               tty49
alarm               ptypd               tty5
android_adb         ptype               tty50
android_adb_enable  ptypf               tty51
apm_bios            pvrsrvkm            tty52
ashmem              pwm                 tty53
audio               random              tty54
backlight-1wire     root                tty55
buttons             rtc                 tty56
console             rtc0                tty57
cpu_dma_latency     s3c-jpg             tty58
device-mapper       s3c-mem             tty59
dsp                 s3c-mfc             tty6
fb0                 s3c_bc              tty60
fb1                 sdcard              tty61
fb2                 sec-g2d             tty62
fb3                 shm                 tty63
fb4                 snd                 tty7
full                sound               tty8
i2c                 touchscreen-1wire   tty9
i2c-2               tty                 ttyGS0
input               tty0                ttySAC0
kmem                tty1                ttySAC1
kmsg                tty10               ttySAC2
leds                tty11               ttySAC3
log                 tty12               ttyp0
loop                tty13               ttyp1
mem                 tty14               ttyp2
mixer               tty15               ttyp3
mmcblk0             tty16               ttyp4
mtd0                tty17               ttyp5
mtd0ro              tty18               ttyp6
mtd1                tty19               ttyp7
mtd1ro              tty2                ttyp8
mtd2                tty20               ttyp9
mtd2ro              tty21               ttypa
mtd3                tty22               ttypb
mtd3ro              tty23               ttypc
mtd4                tty24               ttypd
mtd4ro              tty25               ttype
mtdblock0           tty26               ttypf
mtdblock1           tty27               urandom
mtdblock2           tty28               usbdev1.1
mtdblock3           tty29               usbdev1.2
mtdblock4           tty3                usbdev2.1
mtp_usb             tty30               vcs
network_latency     tty31               vcs1
network_throughput  tty32               vcs2
null                tty33               vcs3
ppp                 tty34               vcs4
psaux               tty35               vcsa
ptmx                tty36               vcsa1
pts                 tty37               vcsa2
ptyp0               tty38               vcsa3
ptyp1               tty39               vcsa4
ptyp2               tty4                video0
ptyp3               tty40               video1
ptyp4               tty41               video14
ptyp5               tty42               video2
ptyp6               tty43               video21
ptyp7               tty44               video22
ptyp8               tty45               watchdog
ptyp9               tty46               zero

kasim 2012-06-04 15:06
我手上没有友善之臂的CMOS摄像头测试程序源代码,不过我想你可以试试看下面的方法:
1. 打开友善之臂的CMOS摄像头测试程序,并保持程序运行不要退出
2.在终端命令行上用"ps"命令找出测试程序的进程号
3.在终端命令行上用

ls -l /proc/<测试程序进程号>/fd

列出测试程序所有的文件描述符及其对应的文件。这样只要测试程序打开了摄像头设备文件并且还没有关闭,应该可以看到对应的设备节点文件。

casiame 2012-06-04 17:45
感谢版主的回复,但还是没明白如何对cmos进行操作,望版主解释一下cmos-camera的执行流程。
我采用版主的建议,查到设备号确实是/dev/video0,但我自己调用open的时候就无法打开这个设备,不知道在打开设备之前还需进行什么操作才能使video0可用????
以下是执行ls fd得到的信息:
lrwx------    1 root     root            64 Feb 10 13:28 6 -> /dev/input/mice
lrwx------    1 root     root            64 Feb 10 13:28 7 -> /dev/tty1
lrwx------    1 root     root            64 Feb 10 13:28 8 -> /dev/fb0
lrwx------    1 root     root            64 Feb 10 13:28 9 -> /dev/video0

以下是我在用open时出现的信息:
[ 2924.190926] s3c-fimc-0 : fimc_s_fmt_vid_capture: No capture device.
select timeout

而如果用cmos-camera测试程序时信息是:
[  160.550433] tvp5150 0-005c: chip found @ 0xb8 (s3c2410-i2c)
[  160.619108] tvp5150 0-005c: tvp5150am1 detected.
[  160.913631] tvp5150: power ON
[  160.913669] tvp5150 0-005c: camera initialization start (00000000)

是tvp5150的驱动模块没有加载吗?

casiame 2012-06-04 17:47
可是我用lsmod得到的信息显示tvp5150已经载入到系统中了啊
# lsmod
rtl8192cu 414009 0 - Live 0xbf018000
tvp5150_tiny210 14147 0 - Live 0xbf00f000
snd_soc_mini210_wm8960 2936 0 - Live 0xbf009000
snd_soc_wm8960 15882 1 snd_soc_mini210_wm8960, Live 0xbf000000

casiame 2012-06-09 17:14
版主给个回复吧
cmos摄像头的源码是怎样的,一直没想通为什么测试程序可以,而自己写的就不行。
我想用tvp5150的模拟摄像头,把 跳线接到CCD端,但调用fd=open("\dev\video0", O_RDRW, 0)后,再调用ioctl(fd, VIDEOC_QUERYCAP, &cap),此时得到的信息是:Capability Informations:
[  229.056706] s3c-fimc-0 : fimc_g_fmt_vid_capture: no capture device info
card: s3c-fimc0
bus_info: FIMC AHB-bus
version: 00000000
capabilities: 04000007

跟自带的测试程序出来的信息不一样
[  160.550433] tvp5150 0-005c: chip found @ 0xb8 (s3c2410-i2c)
[  160.619108] tvp5150 0-005c: tvp5150am1 detected.
[  160.913631] tvp5150: power ON
[  160.913669] tvp5150 0-005c: camera initialization start (00000000)

感觉好像是调用的驱动不对,没有调用tvp5150_tiny210.ko中的函数,但这个模块已经加载了啊,难道在应用程序中的open之前需要进行其他的操作吗?恳请高手指教啊!!!!!!

xiaoxionggui 2012-06-18 14:45
楼主 我也遇到和你一样的问题 加我一起讨论下哈 qq:437799365

xiaoxionggui 2012-06-18 14:47
哥们 你调出来了没  貌似这个前面肯定要运行点什么    测试程序运行时 open就说设备忙  测试程序退出了 就说没有这个设备

ke123456le 2012-06-25 10:37
我也遇到同样的问题!!

adc0809 2012-07-10 21:52
对应这个摄像头的问题,我也研究了几天了,发现原来友善对内核fimc驱动做了修改 ,删除了一个重要的函数static int fimc_configure_subdev(struct    platform_device    *pdev, int id)
导致驱动注册不成功

haa14618 2012-07-17 17:29
要如何解決勒?

awayfar 2012-08-29 19:58
请问楼上各位解决这个问题了吗?谢谢:)

edshieh 2012-10-03 15:40
我open了/dev/video0也看不到這些訊息

[ 4996.598181] tvp5150 0-005c: chip found @ 0xb8 (s3c2410-i2c)
[ 4996.665711] tvp5150 0-005c: tvp5150am1 detected.
[ 4996.905377] tvp5150: power ON
[ 4996.905415] tvp5150 0-005c: camera initialization start (00000000)


    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多