📄 sn9c102.txt
字号:
SN9C10x PC Camera Controllers Driver for Linux ============================= - Documentation -Index=====1. Copyright2. Disclaimer3. License4. Overview and features5. Driver installation6. Module loading7. Module parameters8. Optional device control through "sysfs"9. Supported devices10. How to add plug-in's for new image sensors11. Notes for V4L2 application developers12. Video frame formats13. Contact information14. Credits1. Copyright============Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it>2. Disclaimer=============SONiX is a trademark of SONiX Technology Company Limited, inc.This software is not sponsored or developed by SONiX.3. License==========This program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2 of the License, or(at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.4. Overview and features========================This driver attempts to support the video and audio streaming capabilities ofthe devices mounting the SONiX SN9C101, SN9C102 and SN9C103 PC CameraControllers.It's worth to note that SONiX has never collaborated with the author during thedevelopment of this project, despite several requests for enough detailedspecifications of the register tables, compression engine and video data formatof the above chips. Nevertheless, these informations are no longer necessary,becouse all the aspects related to these chips are known and have beendescribed in detail in this documentation.The driver relies on the Video4Linux2 and USB core modules of the official andstable Linux kernels, version 2.6.10 or greater. It has been designed to run properly on SMP systems as well.The latest version of the SN9C10x driver can be found at the following URL:http://www.linux-projects.org/Some of the features of the driver are:- full compliance with the Video4Linux2 API (see also "Notes for V4L2 application developers" paragraph);- available mmap or read/poll methods for video streaming through isochronous data transfers;- automatic detection of image sensor;- support for any window resolutions and optional panning within the maximum pixel area of image sensor;- image downscaling with arbitrary scaling factors from 1, 2 and 4 in both directions (see "Notes for V4L2 application developers" paragraph);- two different video formats for uncompressed or compressed data in low or high compression quality (see also "Notes for V4L2 application developers" and "Video frame formats" paragraphs);- full support for the capabilities of many of the possible image sensors that can be connected to the SN9C10x bridges, including, for istance, red, green, blue and global gain adjustments and exposure (see "Supported devices" paragraph for details);- use of default color settings for sunlight conditions;- dynamic I/O interface for both SN9C10x and image sensor control and monitoring (see "Optional device control through 'sysfs'" paragraph);- dynamic driver control thanks to various module parameters (see "Module parameters" paragraph);- up to 64 cameras can be handled at the same time; they can be connected and disconnected from the host many times without turning off the computer, if your system supports hotplugging;- no known bugs.5. Driver installation======================As noted above, kernel 2.6.10 is the minimum for this driver; for it to workproperly, the driver needs kernel support for Video4Linux and USB.The following options of the kernel configuration file must be enabled andcorresponding modules must be compiled: # Multimedia devices # CONFIG_VIDEO_DEV=m # USB support # CONFIG_USB=mIn addition, depending on the hardware being used, the modules below arenecessary: # USB Host Controller Drivers # CONFIG_USB_EHCI_HCD=m CONFIG_USB_UHCI_HCD=m CONFIG_USB_OHCI_HCD=mMoving along to the SN9C10x driver: after having downloaded the package,decompress and compile: [user@localhost home]$ tar xvzf sn9c102-x.x.tar.gz [user@localhost home]$ cd sn9c102-x.x(where "x.x" has to be substituted with the right version of the module justdownloaded)It is necessary to properly configure your particular kernel source tree beforecompiling the driver. The modular building process is used; therefore you musthave read and write access to your kernel source tree. If not, log in as rootbefore running the following commands: [user@localhost sn9c102-x.x]$ make clean [user@localhost sn9c102-x.x]$ make modulesIf the commands fail, control the Makefile and change the path to the kernelsource tree or to any other files, according to your system configuration;then run the previous commands again.If everything went well, the SN9C10x driver can be used either immediatly(skip to the next paragraph) or be installed.The driver will be installed in the default directory reserved for modulesbeing built outside the kernel. This means that the possible version of thedriver present in the official Linux kernel tree will not be overwritten duringthe installation process.To install the driver, run as root: [root@localhost sn9c102-x.x]# make modules_install6. Module loading=================To use the driver, it is necessary to load the "sn9c102" module into memoryafter every other module required: "videodev", "usbcore" and, depending onthe USB host controller you have, "ehci-hcd", "uhci-hcd" or "ohci-hcd".Loading can be done as shown below.If the SN9C10x driver has been installed as shown in the previous paragraph: [root@localhost home]# modprobe sn9c102otherwise, if you have not installed the driver, but have just compiled it,run "insmod" indicating the path to the module; for example: [root@localhost sn9c102-x.x]# insmod ./sn9c102.koAt this point the devices should be recognized. You can invoke "dmesg" toanalyze kernel messages and verify that the loading process has gone well: [user@localhost home]$ dmesg7. Module parameters====================Module parameters are listed below:-------------------------------------------------------------------------------Name: video_nrType: int array (min = 0, max = 64)Syntax: <-1|n[,...]> Description: Specify V4L2 minor mode number: -1 = use next available n = use minor number n You can specify up to 64 cameras this way. For example: video_nr=-1,2,-1 would assign minor number 2 to the second recognized camera and use auto for the first one and for every other camera.Default: -1-------------------------------------------------------------------------------Name: force_munmap;Type: bool array (min = 0, max = 64)Syntax: <0|1[,...]> Description: Force the application to unmap previously mapped buffer memory before calling any VIDIOC_S_CROP or VIDIOC_S_FMT ioctl's. Not all the applications support this feature. This parameter is specific for each detected camera. 0 = do not force memory unmapping" 1 = force memory unmapping (save memory)"Default: 0-------------------------------------------------------------------------------Name: debugType: intSyntax: <n> Description: Debugging information level, from 0 to 3: 0 = none (use carefully) 1 = critical errors 2 = significant informations 3 = more verbose messages Level 3 is useful for testing only, when only one device is used. It also shows some more informations about the hardware being detected. This parameter can be changed at runtime thanks to the /sys filesystem.Default: 2-------------------------------------------------------------------------------8. Optional device control through "sysfs" [1]==========================================It is possible to read and write both the SN9C10x and the image sensorregisters by using the "sysfs" filesystem interface.Every time a supported device is recognized, a write-only file named "green" iscreated in the /sys/class/video4linux/videoX directory. You can set the greenchannel's gain by writing the desired value to it. The value may range from 0to 15 for SN9C101 or SN9C102 bridges, from 0 to 127 for SN9C103 bridges.Similarly, only for SN9C103 controllers, blue and red gain control files areavailable in the same directory, for which accepted values may range from 0 to127.There are other four entries in the directory above for each registered camera:"reg", "val", "i2c_reg" and "i2c_val". The first two files control theSN9C10x bridge, while the other two control the sensor chip. "reg" and"i2c_reg" hold the values of the current register index where the followingreading/writing operations are addressed at through "val" and "i2c_val". Theiruse is not intended for end-users. Note that "i2c_reg" and "i2c_val" will notbe created if the sensor does not actually support the standard I2C protocol orits registers are not 8-bit long. Also, remember that you must be logged in asroot before writing to them.As an example, suppose we were to want to read the value contained in theregister number 1 of the sensor register table - which is usually the productidentifier - of the camera registered as "/dev/video0": [root@localhost #] cd /sys/class/video4linux/video0 [root@localhost #] echo 1 > i2c_reg
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -