More on Writing Device Drivers for Video Capture Devices
Last month I began to develop a very simple camera driver as an illustration of Linux’s video-capture interface. What we need to do now is to provide the functions to control the use of the device and to query its facilities. As with the radio driver, the major control interface is via the ioctl() function (Listing One). Video-capture devices support the same tuner calls as radio devices, and also support additional calls to control how the video functions are handled. In this simple example the card has no tuners, to avoid making the code complex.
Last month I began to develop a very simple camera driver as an illustration of Linux’s video-capture interface. What we need to do now is to provide the functions to control the use of the device and to query its facilities. As with the radio driver, the major control interface is via the ioctl() function (Listing One). Video-capture devices support the same tuner calls as radio devices, and also support additional calls to control how the video functions are handled. In this simple example the card has no tuners, to avoid making the code complex.
The first ioctl we must support (required by all video-capture and radio devices) is VIDIOCGCAP. This behaves exactly the same as with a radio device. This time, however, we report the extra capabilities we outlined earlier when defining our video_dev structure.
We now set the video flags saying that we support overlay, capture, scaling, and chromakey. We also report size limits — our smallest image is 16×16 pixels, our largest is 640×480.
…
Please log in to view this content.
Not Yet a Member?
Register with LinuxMagazine.com and get free access to the entire archive, including: