Discussion on Linux UVC camera driver __linux

Source: Internet
Author: User

This paper is based on AM6C platform Linux3.0.8 kernel.

1.drivers/media/video/uvc/makefile

Uvcvideo-objs  : = uvc_driver.o uvc_queue.o uvc_v4l2.o uvc_video.o uvc_ctrl.o \
          uvc_status.o UVC_ISIGHT.O
obj-$ (Config_usb_video_class) + + UVCVIDEO.O

2.drivers/media/video/uvc/uvc_driver.c

Module_init (Uvc_init);
  static int __init uvc_init (void) {... result = Usb_register (&uvc_driver.driver);

......
}                                                                                                                 
        struct Uvc_driver uvc_driver = {. Driver = {. Name = "Uvcvideo",. Probe = Uvc_probe, . Discon Nect = Uvc_disconnect,. Suspend = Uvc_suspend,. Resume = Uvc_resume,. Reset_resume = Uvc_

Reset_resume,. id_table = Uvc_ids,. supports_autosuspend = 1,},};
  static int uvc_probe (struct usb_interface *intf,const struct usb_device_id) {... *id (dev);

......
}
  static int uvc_register_chains (struct uvc_device *dev) {... ret = uvc_register_terms (dev, chain);

......
} static int uvc_register_terms (struct uvc_device *dev,struct uvc_video_chain *chain) {... ret = Uvc_register_video (d
  EV, stream);

......
} static int Uvc_registEr_video (struct uvc_device *dev,struct uvc_streaming *stream) {... vdev = Video_device_alloc ();
  ... vdev->v4l2_dev = &dev->vdev;
  Vdev->fops = &uvc_fops;
  Vdev->release = Uvc_release;
  ... ret = Video_register_device (Vdev, Vfl_type_grabber,-1); ......
}

3.drivers/media/video/uvc/uvc_v4l2.c

const struct V4l2_file_operations uvc_fops = {. Owner = This_module,. Open = Uvc_v4l2_open,. Releas                                                                                                            
    E = Uvc_v4l2_release,. Unlocked_ioctl = Uvc_v4l2_ioctl, . Read = Uvc_v4l2_read,. mmap = Uvc_v4l2_mmap,. po

ll = Uvc_v4l2_poll, #ifndef config_mmu. Get_unmapped_area = Uvc_v4l2_get_unmapped_area, #endif}; Static long uvc_v4l2_ioctl (struct file *file,unsigned int cmd, unsigned long arg) {... return video_usercopy (file,
CMD, ARG, UVC_V4L2_DO_IOCTL); Static long uvc_v4l2_do_ioctl (struct file *file, unsigned int cmd, void *arg) {... switch (cmd) {case Vidio
    C_querycap: ... case vidioc_queryctrl:case vidioc_g_ctrl:case vidioc_s_ctrl:case vidioc_querymenu:  Case Vidioc_g_ext_ctrls:case Vidioc_s_ext_ctrls:case vidioc_try_ext_ctrls:case vidioc_enuminput:case Vidioc_g_input:case vidioc_s_input:case vidioc_enum_fmt:case vidioc_try_fmt:case vidioc_s_fmt:case VIDI Oc_g_fmt:case vidioc_enum_framesizes:case vidioc_enum_frameintervals:case vidioc_g_parm:case VIDIOC_S_ Parm:case vidioc_cropcap:case vidioc_g_crop:case vidioc_s_crop:case vidioc_reqbufs:case VIDIOC_QU Erybuf:case vidioc_qbuf:case vidioc_dqbuf:case vidioc_streamon:case vidioc_streamoff:case VIDIOC_ Enumstd:case vidioc_querystd:case vidioc_g_std:case vidioc_s_std:case vidioc_overlay:case VIDIOC _enumaudio:case vidioc_enumaudout:case vidioc_enumoutput:case __uvcioc_ctrl_add:case __UVCIOC_CTRL_MAP _old:case __uvcioc_ctrl_map:case uvcioc_ctrl_map:case __uvcioc_ctrl_get:case __UVCIOC_CTRL_SET:CA
  Se uvcioc_ctrl_query: ...} ......
}






Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.