stk11xx-v4l.c File Reference

Driver for Syntek USB video camera. More...

#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/kref.h>
#include <linux/vmalloc.h>
#include <linux/usb.h>
#include <media/v4l2-common.h>
#include "stk11xx.h"

Go to the source code of this file.

Defines

#define STK11XX_PERCENT(x, y)   ( ((int)x * (int)y) / 100)

Functions

int v4l_stk11xx_select_video_mode (struct usb_stk11xx *dev, int width, int height)
 Select a video mode.
static int v4l_stk11xx_open (struct inode *inode, struct file *fp)
 Open the video device.
static int v4l_stk11xx_release (struct inode *inode, struct file *fp)
 Release an opened file.
static ssize_t v4l_stk11xx_read (struct file *fp, char __user *buf, size_t count, loff_t *f_pos)
 Read the video device.
static unsigned int v4l_stk11xx_poll (struct file *fp, poll_table *wait)
 Polling function.
static int v4l_stk11xx_mmap (struct file *fp, struct vm_area_struct *vma)
 Memory map.
static int v4l_stk11xx_do_ioctl (struct inode *inode, struct file *fp, unsigned int cmd, void __user *arg)
 Manage IOCTL.
static int v4l_stk11xx_ioctl (struct inode *inode, struct file *fp, unsigned int cmd, unsigned long arg)
 Manage IOCTL.
int v4l_stk11xx_register_video_device (struct usb_stk11xx *dev)
 Register the video device.
int v4l_stk11xx_unregister_video_device (struct usb_stk11xx *dev)
 Unregister the video device.

Variables

static struct
file_operations 
v4l_stk11xx_fops
struct stk11xx_coord stk11xx_image_sizes [STK11XX_NBR_SIZES]
static struct
v4l2_queryctrl 
stk11xx_controls []
static struct
file_operations 
v4l_stk11xx_fops


Detailed Description

Driver for Syntek USB video camera.

Author:
Nicolas VIVIEN
Date:
2006-10-23
Version:
v1.0.0
Note:
Copyright (C) Nicolas VIVIEN
Licences
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

SubVersion
Date
Revision
Author
HeadURL

Definition in file stk11xx-v4l.c.


Define Documentation

#define STK11XX_PERCENT ( x,
 )     ( ((int)x * (int)y) / 100)

Calculate a value from a percent

Definition at line 54 of file stk11xx-v4l.c.

Referenced by v4l_stk11xx_open().


Function Documentation

static int v4l_stk11xx_do_ioctl ( struct inode *  inode,
struct file *  fp,
unsigned int  cmd,
void __user *  arg 
) [static]

Manage IOCTL.

Parameters:
inode Inode pointer
fp File pointer
cmd Command
arg Arguments of the command
Returns:
0 if all is OK
This function permits to manage all the IOCTL from the application.

Definition at line 543 of file stk11xx-v4l.c.

References stk11xx_video::brightness, stk11xx_video::colour, stk11xx_video::contrast, stk11xx_video::depth, dev_stk11xx_camera_asleep(), dev_stk11xx_camera_off(), dev_stk11xx_camera_on(), dev_stk11xx_camera_settings(), dev_stk11xx_init_camera(), dev_stk11xx_reconf_camera(), dev_stk11xx_start_stream(), dev_stk11xx_stop_stream(), DRIVER_VERSION_NUM, usb_stk11xx::error_status, usb_stk11xx::fill_image, usb_stk11xx::full_frames, stk11xx_video::hue, usb_stk11xx::image_size, usb_stk11xx::image_used, usb_stk11xx::len_per_image, usb_stk11xx::nbuffers, stk11xx_video::palette, STK11XX_1280x1024, STK11XX_640x480, STK11XX_80x60, stk11xx_clear_buffers(), stk11xx_controls, stk11xx_handle_frame(), STK11XX_NBR_SIZES, stk11xx_next_image(), STK11XX_PALETTE_BGR24, STK11XX_PALETTE_BGR32, STK11XX_PALETTE_RGB24, STK11XX_PALETTE_RGB32, STK11XX_SXGA, STK11XX_VGA, STK_DEBUG, STK_ERROR, usb_stk11xx::udev, usb_stk11xx_isoc_cleanup(), usb_stk11xx_isoc_init(), v4l_stk11xx_select_video_mode(), usb_stk11xx::vdev, usb_stk11xx::view, usb_stk11xx::vsettings, usb_stk11xx::wait_frame, usb_stk11xx::webcam_type, stk11xx_video::whiteness, stk11xx_coord::x, and stk11xx_coord::y.

Referenced by v4l_stk11xx_ioctl().

static int v4l_stk11xx_ioctl ( struct inode *  inode,
struct file *  fp,
unsigned int  cmd,
unsigned long  arg 
) [static]

Manage IOCTL.

Parameters:
inode Inode pointer
fp File pointer
cmd Command
arg Arguements of the command
Returns:
0 if all is OK
This function permits to manage all the IOCTL from the application.

Definition at line 1489 of file stk11xx-v4l.c.

References STK_DEBUG, and v4l_stk11xx_do_ioctl().

static int v4l_stk11xx_mmap ( struct file *  fp,
struct vm_area_struct *  vma 
) [static]

Memory map.

Parameters:
fp File pointer
vma VMA structure
Returns:
0 if all is OK
This function permits to map a memory space.

Definition at line 462 of file stk11xx-v4l.c.

References usb_stk11xx::image_data, usb_stk11xx::images, usb_stk11xx::len_per_image, usb_stk11xx::nbuffers, stk11xx_image_buf::offset, STK11XX_MAX_IMAGES, STK_ERROR, and STK_STREAM.

static int v4l_stk11xx_open ( struct inode *  inode,
struct file *  fp 
) [static]

Open the video device.

Parameters:
inode Pointer on an inode
fp File pointer
Returns:
0 if all is OK
This function permits to open a video device (/dev/videoX)

Definition at line 207 of file stk11xx-v4l.c.

References stk11xx_video::brightness, stk11xx_video::colour, stk11xx_video::contrast, stk11xx_video::depth, dev_stk11xx_camera_on(), dev_stk11xx_camera_settings(), dev_stk11xx_init_camera(), dev_stk11xx_reconf_camera(), dev_stk11xx_start_stream(), usb_stk11xx::error_status, stk11xx_video::hue, stk11xx_video::palette, stk11xx_allocate_buffers(), stk11xx_free_buffers(), STK11XX_PALETTE_BGR24, STK11XX_PERCENT, stk11xx_reset_buffers(), STK_DEBUG, STK_ERROR, usb_stk11xx_isoc_cleanup(), usb_stk11xx_isoc_init(), v4l_stk11xx_select_video_mode(), usb_stk11xx::vframes_dumped, usb_stk11xx::vframes_error, usb_stk11xx::visoc_errors, usb_stk11xx::vopen, usb_stk11xx::vsettings, and stk11xx_video::whiteness.

static unsigned int v4l_stk11xx_poll ( struct file *  fp,
poll_table *  wait 
) [static]

Polling function.

Parameters:
fp File pointer
wait 
Returns:
0 if all is OK

Definition at line 424 of file stk11xx-v4l.c.

References usb_stk11xx::error_status, usb_stk11xx::full_frames, STK_STREAM, and usb_stk11xx::wait_frame.

static ssize_t v4l_stk11xx_read ( struct file *  fp,
char __user *  buf,
size_t  count,
loff_t *  f_pos 
) [static]

Read the video device.

Parameters:
fp File pointer
Return values:
buf Buffer in user space
count 
f_pos 
Returns:
Count value
This function is called by the application is reading the video device.

Definition at line 336 of file stk11xx-v4l.c.

References usb_stk11xx::error_status, usb_stk11xx::fill_image, usb_stk11xx::full_frames, usb_stk11xx::image_data, usb_stk11xx::image_read_pos, usb_stk11xx::image_size, usb_stk11xx::images, stk11xx_image_buf::offset, stk11xx_handle_frame(), stk11xx_next_image(), STK_STREAM, and usb_stk11xx::wait_frame.

int v4l_stk11xx_register_video_device ( struct usb_stk11xx dev  ) 

Register the video device.

Parameters:
dev Device structure
Returns:
0 if all is OK
This function permits to register the USB device to the video device.

Definition at line 1524 of file stk11xx-v4l.c.

Referenced by usb_stk11xx_probe().

static int v4l_stk11xx_release ( struct inode *  inode,
struct file *  fp 
) [static]

Release an opened file.

Parameters:
inode Pointer on inode
fp File pointer
Returns:
0 if all is OK
This function permits to release an opened file with the 'open' method.

Definition at line 292 of file stk11xx-v4l.c.

References dev_stk11xx_camera_asleep(), dev_stk11xx_camera_off(), dev_stk11xx_stop_stream(), stk11xx_free_buffers(), STK_ERROR, usb_stk11xx_isoc_cleanup(), and usb_stk11xx::vopen.

int v4l_stk11xx_select_video_mode ( struct usb_stk11xx dev,
int  width,
int  height 
)

Select a video mode.

Parameters:
dev 
width Width of wished resolution
height Height of wished resolution
Returns:
0 if all is OK
This function permits to check and select a video mode.

Definition at line 114 of file stk11xx-v4l.c.

Referenced by v4l_stk11xx_do_ioctl(), and v4l_stk11xx_open().

int v4l_stk11xx_unregister_video_device ( struct usb_stk11xx dev  ) 

Unregister the video device.

Parameters:
dev Device structure
Returns:
0 if all is OK
This function permits to unregister the video device.

Definition at line 1559 of file stk11xx-v4l.c.

Referenced by usb_stk11xx_disconnect().


Variable Documentation

stk11xx_controls [static]

Initial value:

 {
    {
        .id      = V4L2_CID_BRIGHTNESS,
        .type    = V4L2_CTRL_TYPE_INTEGER,
        .name    = "Brightness",
        .minimum = 0,
        .maximum = 0xFFFF,
        .step    = 1,
        .default_value = 0xFF00,
    },
    {
        .id      = V4L2_CID_CONTRAST,
        .type    = V4L2_CTRL_TYPE_INTEGER,
        .name    = "Contrast",
        .minimum = 0,
        .maximum = 0xFFFF,
        .step    = 1,
        .default_value = 0xFF00,
    },
}
List of all V4Lv2 controls supported by the driver

Definition at line 81 of file stk11xx-v4l.c.

Referenced by v4l_stk11xx_do_ioctl().

struct stk11xx_coord stk11xx_image_sizes[STK11XX_NBR_SIZES]

Initial value:

 {
    {   80,   60 },
    {  128,   96 },
    {  160,  120 },
    {  213,  160 },
    {  320,  240 },
    {  640,  480 },
    {  800,  600 },
    { 1024,  768 },
    { 1280, 1024 }
}
List of all resolutions supported by the driver

Definition at line 64 of file stk11xx-v4l.c.

struct file_operations v4l_stk11xx_fops [static]

Initial value:

 {
    .owner = THIS_MODULE,
    .open = v4l_stk11xx_open,
    .release = v4l_stk11xx_release,
    .read = v4l_stk11xx_read,
    .poll = v4l_stk11xx_poll,
    .mmap = v4l_stk11xx_mmap,
    .ioctl = v4l_stk11xx_ioctl,
    .llseek = no_llseek
}

Definition at line 1575 of file stk11xx-v4l.c.

v4l_stk11xx_fops [static]

This variable contains some callback

Definition at line 57 of file stk11xx-v4l.c.

Referenced by v4l_stk11xx_register_video_device().


Generated on Mon Oct 29 16:20:29 2007 for SyntekUSBVideoCamera by  doxygen 1.5.3