V4L2初识(三)-------分析vivi.c 虚拟视频驱动

1、分配video_device结构体

2、设置

3、注册  video_register_device

分析vivi.c:

vivi_create_instance()

  v4l2_device_register()

   video_device_alloc()

   video_register_device()

    __video_register_device()//在上一篇博客中,这个函数已经简要的分析,在此不再赘述。

static int __init vivi_init(void)
{

  if (n_devs <= 0)
  n_devs = 1;

  for (i = 0; i < n_devs; i++) {
    ret = vivi_create_instance(i);
    if (ret) {
    /* If some instantiations succeeded, keep driver */
    if (i)
      ret = 0;
    break;
    }
  }

}

猜你喜欢

转载自www.cnblogs.com/-glb/p/10292951.html