SyntekUSBVideoCamera
Functions | Variables
stk11xx-usb.c File Reference

Driver for Syntek USB video camera. More...

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

Go to the source code of this file.

Functions

 MODULE_DEVICE_TABLE (usb, stk11xx_table)
 
int usb_stk11xx_isoc_init (struct usb_stk11xx *dev)
 Initilize an isochronous pipe. More...
 
void usb_stk11xx_isoc_handler (struct urb *urb)
 ISOC handler. More...
 
void usb_stk11xx_isoc_cleanup (struct usb_stk11xx *dev)
 Clean-up all the ISOC buffers. More...
 
int usb_stk11xx_set_feature (struct usb_stk11xx *dev, int index)
 Send the message SET_FEATURE and choose the interface. More...
 
int usb_stk11xx_set_configuration (struct usb_stk11xx *dev)
 Send the message SET_CONFIGURATION. More...
 
int usb_stk11xx_write_registry (struct usb_stk11xx *dev, __u16 index, __u16 value)
 Write a 16-bits value to a 16-bits register. More...
 
int usb_stk11xx_read_registry (struct usb_stk11xx *dev, __u16 index, int *value)
 Read a 16-bits value from a 16-bits register. More...
 
static int usb_stk11xx_default_settings (struct usb_stk11xx *dev)
 Set the default value about the video settings. More...
 
static int usb_stk11xx_probe (struct usb_interface *interface, const struct usb_device_id *id)
 Load the driver. More...
 
static void usb_stk11xx_disconnect (struct usb_interface *interface)
 This function is called when the device is disconnected or when the kernel module is unloaded. More...
 
 module_param (fps, int, 0444)
 Module frame per second parameter.
 
 module_param (hflip, int, 0444)
 Module horizontal flip process.
 
 module_param (vflip, int, 0444)
 Module vertical flip process.
 
 module_param (brightness, int, 0444)
 Module brightness.
 
 module_param (whiteness, int, 0444)
 Module whiteness.
 
 module_param (contrast, int, 0444)
 Module contrast.
 
 module_param (colour, int, 0444)
 Module colour.
 
 module_param (norm, int, 0444)
 Module norm.
 
static int __init usb_stk11xx_init (void)
 Initialize the driver. More...
 
static void __exit usb_stk11xx_exit (void)
 Close the driver. More...
 
 module_init (usb_stk11xx_init)
 Module initialize.
 
 module_exit (usb_stk11xx_exit)
 Module exit.
 
 MODULE_PARM_DESC (fps,"Frames per second [5-30]")
 Description of 'fps' parameter.
 
 MODULE_PARM_DESC (hflip,"Horizontal image flip")
 Description of 'hflip' parameter.
 
 MODULE_PARM_DESC (vflip,"Vertical image flip")
 Description of 'vflip' parameter.
 
 MODULE_PARM_DESC (brightness,"Brightness setting")
 Description of 'brightness' parameter.
 
 MODULE_PARM_DESC (whiteness,"Whiteness setting")
 Description of 'whiteness' parameter.
 
 MODULE_PARM_DESC (colour,"Colour setting")
 Description of 'colour' parameter.
 
 MODULE_PARM_DESC (contrast,"Contrast setting")
 Description of 'contrast' parameter.
 
 MODULE_PARM_DESC (norm,"Norm setting (0=NTSC, 1=PAL)")
 Description of 'default_norm' parameter.
 
 MODULE_LICENSE ("GPL")
 Driver is under licence GPL.
 
 MODULE_AUTHOR (DRIVER_AUTHOR)
 Driver is written by Nicolas VIVIEN.
 
 MODULE_DESCRIPTION (DRIVER_DESC)
 Define the description of the driver.
 
 MODULE_SUPPORTED_DEVICE (DRIVER_SUPPORT)
 List of supported device.
 
 MODULE_VERSION (DRIVER_VERSION)
 Define the version of the driver.
 
 MODULE_INFO (url, DRIVER_URL)
 Driver homepage URL.
 

Variables

static int default_fps = -1
 
static int default_hflip = -1
 
static int default_vflip = -1
 
static int default_brightness = -1
 
static int default_whiteness = -1
 
static int default_contrast = -1
 
static int default_colour = -1
 
static int default_norm = -1
 
static struct usb_device_id stk11xx_table []
 
static struct usb_driver usb_stk11xx_driver
 
static int fps
 
static int hflip = -1
 
static int vflip = -1
 
static int brightness = -1
 
static int whiteness = -1
 
static int contrast = -1
 
static int colour = -1
 
static int norm = -1
 

Detailed Description

Driver for Syntek USB video camera.

Author
Nicolas VIVIEN
Date
2006-10-23
Version
v2.2.x
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-usb.c.

Function Documentation

MODULE_DEVICE_TABLE ( usb  ,
stk11xx_table   
)

Define the supported devices

static int usb_stk11xx_default_settings ( struct usb_stk11xx dev)
static
static void usb_stk11xx_disconnect ( struct usb_interface *  interface)
static

This function is called when the device is disconnected or when the kernel module is unloaded.

Parameters
interface

Definition at line 973 of file stk11xx-usb.c.

References stk11xx_remove_sysfs_files(), STK_INFO, v4l_stk11xx_unregister_video_device(), usb_stk11xx::vdev, usb_stk11xx::vopen, and usb_stk11xx::wait_frame.

static void __exit usb_stk11xx_exit ( void  )
static
static int __init usb_stk11xx_init ( void  )
static

Initialize the driver.

Returns
0 if all is OK

This function is called at first. This function permits to define the default values from the command line.

Definition at line 1143 of file stk11xx-usb.c.

References brightness, colour, contrast, default_brightness, default_colour, default_contrast, default_fps, default_hflip, default_norm, default_vflip, default_whiteness, DRIVER_AUTHOR, DRIVER_DESC, DRIVER_URL, DRIVER_VERSION, DRIVER_YEAR, fps, hflip, norm, STK_DEBUG, STK_ERROR, STK_INFO, usb_stk11xx_driver, vflip, and whiteness.

Referenced by usb_stk11xx_exit().

void usb_stk11xx_isoc_cleanup ( struct usb_stk11xx dev)

Clean-up all the ISOC buffers.

Parameters
devDevice structure

This function permits to clean-up all the ISOC buffers.

Definition at line 449 of file stk11xx-usb.c.

References MAX_ISO_BUFS, and STK_DEBUG.

Referenced by v4l_stk11xx_do_ioctl(), v4l_stk11xx_open(), and v4l_stk11xx_release().

void usb_stk11xx_isoc_handler ( struct urb *  urb)

ISOC handler.

Parameters
urbURB structure

This function is called as an URB transfert is complete (Isochronous pipe). So, the traitement is done in interrupt time, so it has be fast, not crash, ans not stall. Neat.

Definition at line 252 of file stk11xx-usb.c.

References stk11xx_next_frame(), STK_DEBUG, STK_ERROR, STK_STREAM, usb_stk11xx::udev, usb_stk11xx::vframes_dumped, usb_stk11xx::vframes_error, usb_stk11xx::visoc_errors, and usb_stk11xx::wait_frame.

Referenced by usb_stk11xx_isoc_init().

int usb_stk11xx_isoc_init ( struct usb_stk11xx dev)

Initilize an isochronous pipe.

Parameters
devDevice structure
Returns
0 if all is OK

This function permits to initialize an URB transfert (or isochronous pipe).

Definition at line 133 of file stk11xx-usb.c.

References ISO_BUFFER_SIZE, ISO_FRAMES_PER_DESC, ISO_MAX_FRAME_SIZE, usb_stk11xx::isoc_in_endpointAddr, usb_stk11xx::isoc_in_size, MAX_ISO_BUFS, STK_DEBUG, STK_ERROR, usb_stk11xx::udev, and usb_stk11xx_isoc_handler().

Referenced by v4l_stk11xx_do_ioctl(), and v4l_stk11xx_open().

static int usb_stk11xx_probe ( struct usb_interface *  interface,
const struct usb_device_id *  id 
)
static
int usb_stk11xx_read_registry ( struct usb_stk11xx dev,
__u16  index,
int *  value 
)

Read a 16-bits value from a 16-bits register.

Parameters
dev
index
value
Returns
0 if all is OK

This function permits to read a 16-bits value from a 16-bits register on the USB bus.

Definition at line 590 of file stk11xx-usb.c.

References STK_ERROR, and usb_stk11xx::udev.

Referenced by dev_stk0408_camera_asleep(), dev_stk0408_configure_device(), dev_stk0408_init_camera(), dev_stk0408_initialize_device(), dev_stk0408_start_stream(), dev_stk0408_stop_stream(), dev_stk0500_camera_asleep(), dev_stk0500_configure_device(), dev_stk0500_sensor_settings(), dev_stk0500_set_camera_quality(), dev_stk0500_start_stream(), dev_stk0500_stop_stream(), dev_stk11xx_check_device(), dev_stk11xx_watchdog_camera(), dev_stk6a31_camera_asleep(), dev_stk6a31_camera_settings(), dev_stk6a31_configure_device(), dev_stk6a31_sensor_settings(), dev_stk6a31_set_camera_quality(), dev_stk6a31_start_stream(), dev_stk6a33_camera_asleep(), dev_stk6a33_camera_settings(), dev_stk6a33_configure_device(), dev_stk6a33_initialize_device(), dev_stk6a33_sensor_settings(), dev_stk6a33_set_camera_quality(), dev_stk6a33_start_stream(), dev_stk6a33_stop_stream(), dev_stk6a51_camera_asleep(), dev_stk6a51_configure_device(), dev_stk6a51_initialize_device(), dev_stk6a51_sensor_settings(), dev_stk6a51_set_camera_quality(), dev_stk6a51_start_stream(), dev_stk6a54_camera_asleep(), dev_stk6a54_configure_device(), dev_stk6a54_initialize_device(), dev_stk6a54_sensor_settings(), dev_stk6d51_camera_asleep(), dev_stk6d51_configure_device(), dev_stk6d51_initialize_device(), dev_stk6d51_sensor_settings(), dev_stk6d51_set_camera_quality(), dev_stka311_camera_asleep(), dev_stka311_configure_device(), dev_stka311_init_camera(), dev_stka311_initialize_device(), dev_stka311_sensor_settings(), dev_stka311_start_stream(), dev_stka311_stop_stream(), dev_stka821_camera_asleep(), dev_stka821_camera_settings(), dev_stka821_configure_device(), dev_stka821_initialize_device(), dev_stka821_sensor_settings(), dev_stka821_set_camera_quality(), dev_stka821_start_stream(), and dev_stka821_stop_stream().

int usb_stk11xx_set_configuration ( struct usb_stk11xx dev)

Send the message SET_CONFIGURATION.

Parameters
devDevice structure
Returns
0 if all is OK

This function permits to send the message SET_CONFIGURATION on the USB bus.

Definition at line 524 of file stk11xx-usb.c.

References STK_DEBUG, STK_ERROR, and usb_stk11xx::udev.

int usb_stk11xx_set_feature ( struct usb_stk11xx dev,
int  index 
)
int usb_stk11xx_write_registry ( struct usb_stk11xx dev,
__u16  index,
__u16  value 
)

Write a 16-bits value to a 16-bits register.

Parameters
dev
index
value
Returns
0 if all is OK

This function permits to write a 16-bits value to a 16-bits register on the USB bus.

Definition at line 558 of file stk11xx-usb.c.

References STK_ERROR, and usb_stk11xx::udev.

Referenced by dev_stk0408_camera_asleep(), dev_stk0408_configure_device(), dev_stk0408_initialize_device(), dev_stk0408_set_camera_quality(), dev_stk0408_start_stream(), dev_stk0408_stop_stream(), dev_stk0500_camera_asleep(), dev_stk0500_configure_device(), dev_stk0500_init_camera(), dev_stk0500_initialize_device(), dev_stk0500_sensor_settings(), dev_stk0500_set_camera_quality(), dev_stk0500_start_stream(), dev_stk0500_stop_stream(), dev_stk6a31_camera_asleep(), dev_stk6a31_camera_settings(), dev_stk6a31_configure_device(), dev_stk6a31_init_camera(), dev_stk6a31_initialize_device(), dev_stk6a31_sensor_settings(), dev_stk6a31_set_camera_quality(), dev_stk6a31_start_stream(), dev_stk6a33_camera_asleep(), dev_stk6a33_camera_settings(), dev_stk6a33_configure_device(), dev_stk6a33_init_camera(), dev_stk6a33_initialize_device(), dev_stk6a33_sensor_settings(), dev_stk6a33_set_camera_quality(), dev_stk6a33_start_stream(), dev_stk6a33_stop_stream(), dev_stk6a51_camera_asleep(), dev_stk6a51_configure_device(), dev_stk6a51_init_camera(), dev_stk6a51_initialize_device(), dev_stk6a51_sensor_settings(), dev_stk6a51_set_camera_quality(), dev_stk6a51_start_stream(), dev_stk6a54_camera_asleep(), dev_stk6a54_configure_device(), dev_stk6a54_initialize_device(), dev_stk6a54_sensor_settings(), dev_stk6d51_camera_asleep(), dev_stk6d51_configure_device(), dev_stk6d51_initialize_device(), dev_stk6d51_sensor_settings(), dev_stk6d51_set_camera_quality(), dev_stka311_camera_asleep(), dev_stka311_configure_device(), dev_stka311_init_camera(), dev_stka311_initialize_device(), dev_stka311_sensor_settings(), dev_stka311_set_camera_fps(), dev_stka311_set_camera_quality(), dev_stka311_start_stream(), dev_stka311_stop_stream(), dev_stka821_camera_asleep(), dev_stka821_camera_settings(), dev_stka821_configure_device(), dev_stka821_init_camera(), dev_stka821_initialize_device(), dev_stka821_sensor_settings(), dev_stka821_set_camera_quality(), dev_stka821_start_stream(), and dev_stka821_stop_stream().

Variable Documentation

brightness = -1
static

Module parameter to set the brightness

Definition at line 1097 of file stk11xx-usb.c.

Referenced by stk11xx_correct_brightness(), store_vflip(), usb_stk11xx_exit(), and usb_stk11xx_init().

colour = -1
static

Module parameter to set the colour

Definition at line 1115 of file stk11xx-usb.c.

Referenced by store_vflip(), usb_stk11xx_exit(), and usb_stk11xx_init().

contrast = -1
static

Module parameter to set the contrast

Definition at line 1109 of file stk11xx-usb.c.

Referenced by store_vflip(), usb_stk11xx_exit(), and usb_stk11xx_init().

default_brightness = -1
static

Set brightness

Definition at line 72 of file stk11xx-usb.c.

Referenced by usb_stk11xx_default_settings(), and usb_stk11xx_init().

default_colour = -1
static

Set colour

Definition at line 90 of file stk11xx-usb.c.

Referenced by usb_stk11xx_default_settings(), and usb_stk11xx_init().

default_contrast = -1
static

Set contrast

Definition at line 84 of file stk11xx-usb.c.

Referenced by usb_stk11xx_default_settings(), and usb_stk11xx_init().

default_fps = -1
static

Number of frame per second by default

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

Referenced by usb_stk11xx_default_settings(), and usb_stk11xx_init().

default_hflip = -1
static

Enable / Disable horizontal flip image

Definition at line 60 of file stk11xx-usb.c.

Referenced by usb_stk11xx_default_settings(), and usb_stk11xx_init().

default_norm = -1
static

Set norm

Definition at line 96 of file stk11xx-usb.c.

Referenced by usb_stk11xx_default_settings(), and usb_stk11xx_init().

default_vflip = -1
static

Enable / Disable vertical flip image

Definition at line 66 of file stk11xx-usb.c.

Referenced by usb_stk11xx_default_settings(), and usb_stk11xx_init().

default_whiteness = -1
static

Set whiteness

Definition at line 78 of file stk11xx-usb.c.

Referenced by usb_stk11xx_default_settings(), and usb_stk11xx_init().

fps
static

Module parameter to set frame per second

Definition at line 1079 of file stk11xx-usb.c.

Referenced by store_vflip(), usb_stk11xx_exit(), and usb_stk11xx_init().

hflip = -1
static

Module parameter to enable/disable the horizontal flip process

Definition at line 1085 of file stk11xx-usb.c.

Referenced by dev_stk0408_stop_stream(), store_vflip(), usb_stk11xx_exit(), and usb_stk11xx_init().

norm = -1
static

Module parameter to set the norm

Definition at line 1121 of file stk11xx-usb.c.

Referenced by usb_stk11xx_exit(), and usb_stk11xx_init().

stk11xx_table
static
Initial value:
= {
{ }
}
#define USB_STK_6A51_PRODUCT_ID
Definition: stk11xx.h:55
#define USB_STK_0408_PRODUCT_ID
Definition: stk11xx.h:59
#define USB_SYNTEK1_VENDOR_ID
Definition: stk11xx.h:47
#define USB_STK_6A33_PRODUCT_ID
Definition: stk11xx.h:54
#define USB_STK_6A31_PRODUCT_ID
Definition: stk11xx.h:53
#define USB_STK_AA11_PRODUCT_ID
Definition: stk11xx.h:52
#define USB_STK_6D51_PRODUCT_ID
Definition: stk11xx.h:57
#define USB_STK_0500_PRODUCT_ID
Definition: stk11xx.h:60
#define USB_STK_6A54_PRODUCT_ID
Definition: stk11xx.h:56
#define USB_STK_0501_PRODUCT_ID
Definition: stk11xx.h:61
#define USB_SYNTEK2_VENDOR_ID
Definition: stk11xx.h:48
#define USB_STK_A821_PRODUCT_ID
Definition: stk11xx.h:51
#define USB_STK_A311_PRODUCT_ID
Definition: stk11xx.h:50

Define all the hotplug supported devices by this driver

Definition at line 103 of file stk11xx-usb.c.

usb_stk11xx_driver
static
Initial value:
= {
.name = "usb_stk11xx_driver",
.disconnect = usb_stk11xx_disconnect,
.id_table = stk11xx_table,
}
static struct usb_device_id stk11xx_table[]
Definition: stk11xx-usb.c:103
static int usb_stk11xx_probe(struct usb_interface *interface, const struct usb_device_id *id)
Load the driver.
Definition: stk11xx-usb.c:716
static void usb_stk11xx_disconnect(struct usb_interface *interface)
This function is called when the device is disconnected or when the kernel module is unloaded...
Definition: stk11xx-usb.c:973

This variable contains some callback

Definition at line 1065 of file stk11xx-usb.c.

Referenced by usb_stk11xx_exit(), and usb_stk11xx_init().

vflip = -1
static

Module parameter to enable/disable the vertical flip process

Definition at line 1091 of file stk11xx-usb.c.

Referenced by dev_stk0408_stop_stream(), store_vflip(), usb_stk11xx_exit(), and usb_stk11xx_init().

whiteness = -1
static

Module parameter to set the whiteness

Definition at line 1103 of file stk11xx-usb.c.

Referenced by usb_stk11xx_exit(), and usb_stk11xx_init().