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.
 
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_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.
 

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 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
 

Detailed Description

Driver for Syntek USB video camera.

Author
Nicolas VIVIEN
Date
2006-10-23
Version
v2.0.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
2009-03-25 15:13:05 +0100 (mer 25 mar 2009)
Revision
84
Author
nicklas79
HeadURL
https://syntekdriver.svn.sourceforge.net/svnroot/syntekdriver/tags/2.1.0/stk11xx-usb.c

Definition in file stk11xx-usb.c.

Function Documentation

◆ MODULE_DEVICE_TABLE()

MODULE_DEVICE_TABLE ( usb  ,
stk11xx_table   
)

Define the supported devices

◆ usb_stk11xx_default_settings()

static int usb_stk11xx_default_settings ( struct usb_stk11xx dev)
static

Set the default value about the video settings.

Parameters
dev
Returns
0 if all is OK

This function permits to set the video settings for each video camera model.

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

References usb_stk11xx::webcam_model.

◆ usb_stk11xx_disconnect()

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 915 of file stk11xx-usb.c.

◆ usb_stk11xx_exit()

static void __exit usb_stk11xx_exit ( void  )
static

Close the driver.

This function is called at last when you unload the driver.

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

References STK_INFO, and usb_stk11xx_driver.

◆ usb_stk11xx_init()

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 1092 of file stk11xx-usb.c.

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

◆ usb_stk11xx_isoc_cleanup()

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 431 of file stk11xx-usb.c.

References MAX_ISO_BUFS, and STK_DEBUG.

Referenced by v4l_stk11xx_release().

◆ usb_stk11xx_isoc_handler()

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 243 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().

◆ 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 124 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().

◆ usb_stk11xx_probe()

static int usb_stk11xx_probe ( struct usb_interface *  interface,
const struct usb_device_id *  id 
)
static

Load the driver.

Parameters
interface
id
Returns
0 if all is OK

This function detects the device and allocate the buffers for the device and the video interface.

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

References STK_DEBUG, STK_INFO, USB_STK_A311_PRODUCT_ID, and USB_SYNTEK1_VENDOR_ID.

◆ usb_stk11xx_read_registry()

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 572 of file stk11xx-usb.c.

References STK_ERROR, and usb_stk11xx::udev.

Referenced by 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_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().

◆ usb_stk11xx_set_configuration()

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 506 of file stk11xx-usb.c.

References STK_DEBUG, STK_ERROR, and usb_stk11xx::udev.

◆ usb_stk11xx_set_feature()

int usb_stk11xx_set_feature ( struct usb_stk11xx dev,
int  index 
)

Send the message SET_FEATURE and choose the interface.

Parameters
devDevice structure
indexChoice of the interface
Returns
0 if all is OK

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

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

References STK_DEBUG, STK_ERROR, and usb_stk11xx::udev.

Referenced by dev_stk6a31_init_camera(), dev_stk6a31_initialize_device(), dev_stk6a33_init_camera(), dev_stk6a33_initialize_device(), dev_stk6a51_init_camera(), dev_stk6a51_initialize_device(), dev_stk6a54_initialize_device(), dev_stk6d51_initialize_device(), dev_stka311_init_camera(), dev_stka311_initialize_device(), dev_stka821_init_camera(), and dev_stka821_initialize_device().

◆ usb_stk11xx_write_registry()

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 540 of file stk11xx-usb.c.

References STK_ERROR, and usb_stk11xx::udev.

Referenced by 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_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

brightness = -1
static

Module parameter to set the brightness

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

Referenced by usb_stk11xx_init().

◆ colour

colour = -1
static

Module parameter to set the colour

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

Referenced by usb_stk11xx_init().

◆ contrast

contrast = -1
static

Module parameter to set the contrast

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

Referenced by usb_stk11xx_init().

◆ default_brightness

default_brightness = -1
static

Set brightness

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

Referenced by usb_stk11xx_init().

◆ default_colour

default_colour = -1
static

Set colour

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

Referenced by usb_stk11xx_init().

◆ default_contrast

default_contrast = -1
static

Set contrast

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

Referenced by usb_stk11xx_init().

◆ default_fps

default_fps = -1
static

Number of frame per second by default

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

Referenced by usb_stk11xx_init().

◆ default_hflip

default_hflip = -1
static

Enable / Disable horizontal flip image

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

Referenced by usb_stk11xx_init().

◆ default_vflip

default_vflip = -1
static

Enable / Disable vertical flip image

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

Referenced by usb_stk11xx_init().

◆ default_whiteness

default_whiteness = -1
static

Set whiteness

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

Referenced by usb_stk11xx_init().

◆ fps

fps
static

Module parameter to set frame per second

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

Referenced by usb_stk11xx_init().

◆ hflip

hflip = -1
static

Module parameter to enable/disable the horizontal flip process

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

Referenced by stk11xx_b2bgr24(), stk11xx_b2bgr32(), stk11xx_b2rgb24(), stk11xx_b2rgb32(), stk11xx_b2uyvy(), stk11xx_b2yuyv(), and usb_stk11xx_init().

◆ stk11xx_table

stk11xx_table
static
Initial value:

Define all the hotplug supported devices by this driver

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

◆ usb_stk11xx_driver

usb_stk11xx_driver
static
Initial value:
= {
.name = "usb_stk11xx_driver",
.disconnect = usb_stk11xx_disconnect,
.id_table = stk11xx_table,
}

This variable contains some callback

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

Referenced by usb_stk11xx_exit(), and usb_stk11xx_init().

◆ vflip

vflip = -1
static

Module parameter to enable/disable the vertical flip process

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

Referenced by stk11xx_b2bgr24(), stk11xx_b2bgr32(), stk11xx_b2rgb24(), stk11xx_b2rgb32(), stk11xx_b2uyvy(), stk11xx_b2yuyv(), and usb_stk11xx_init().

◆ whiteness

whiteness = -1
static

Module parameter to set the whiteness

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

Referenced by usb_stk11xx_init().

USB_STK_A311_PRODUCT_ID
#define USB_STK_A311_PRODUCT_ID
Definition: stk11xx.h:48
USB_STK_6A33_PRODUCT_ID
#define USB_STK_6A33_PRODUCT_ID
Definition: stk11xx.h:51
USB_STK_6A51_PRODUCT_ID
#define USB_STK_6A51_PRODUCT_ID
Definition: stk11xx.h:52
usb_stk11xx_probe
static int usb_stk11xx_probe(struct usb_interface *interface, const struct usb_device_id *id)
Load the driver.
Definition: stk11xx-usb.c:682
USB_STK_6D51_PRODUCT_ID
#define USB_STK_6D51_PRODUCT_ID
Definition: stk11xx.h:54
USB_SYNTEK1_VENDOR_ID
#define USB_SYNTEK1_VENDOR_ID
Definition: stk11xx.h:45
USB_STK_6A31_PRODUCT_ID
#define USB_STK_6A31_PRODUCT_ID
Definition: stk11xx.h:50
USB_STK_6A54_PRODUCT_ID
#define USB_STK_6A54_PRODUCT_ID
Definition: stk11xx.h:53
usb_stk11xx_disconnect
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:915
USB_STK_0501_PRODUCT_ID
#define USB_STK_0501_PRODUCT_ID
Definition: stk11xx.h:56
USB_SYNTEK2_VENDOR_ID
#define USB_SYNTEK2_VENDOR_ID
Definition: stk11xx.h:46
USB_STK_A821_PRODUCT_ID
#define USB_STK_A821_PRODUCT_ID
Definition: stk11xx.h:49
stk11xx_table
static struct usb_device_id stk11xx_table[]
Definition: stk11xx-usb.c:97