et61x251.txt 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. ET61X[12]51 PC Camera Controllers
  2. Driver for Linux
  3. =================================
  4. - Documentation -
  5. Index
  6. =====
  7. 1. Copyright
  8. 2. Disclaimer
  9. 3. License
  10. 4. Overview and features
  11. 5. Module dependencies
  12. 6. Module loading
  13. 7. Module parameters
  14. 8. Optional device control through "sysfs"
  15. 9. Supported devices
  16. 10. Notes for V4L2 application developers
  17. 11. Contact information
  18. 1. Copyright
  19. ============
  20. Copyright (C) 2006-2007 by Luca Risolia <luca.risolia@studio.unibo.it>
  21. 2. Disclaimer
  22. =============
  23. Etoms is a trademark of Etoms Electronics Corp.
  24. This software is not developed or sponsored by Etoms Electronics.
  25. 3. License
  26. ==========
  27. This program is free software; you can redistribute it and/or modify
  28. it under the terms of the GNU General Public License as published by
  29. the Free Software Foundation; either version 2 of the License, or
  30. (at your option) any later version.
  31. This program is distributed in the hope that it will be useful,
  32. but WITHOUT ANY WARRANTY; without even the implied warranty of
  33. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  34. GNU General Public License for more details.
  35. You should have received a copy of the GNU General Public License
  36. along with this program; if not, write to the Free Software
  37. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  38. 4. Overview and features
  39. ========================
  40. This driver supports the video interface of the devices mounting the ET61X151
  41. or ET61X251 PC Camera Controllers.
  42. It's worth to note that Etoms Electronics has never collaborated with the
  43. author during the development of this project; despite several requests,
  44. Etoms Electronics also refused to release enough detailed specifications of
  45. the video compression engine.
  46. The driver relies on the Video4Linux2 and USB core modules. It has been
  47. designed to run properly on SMP systems as well.
  48. The latest version of the ET61X[12]51 driver can be found at the following URL:
  49. http://www.linux-projects.org/
  50. Some of the features of the driver are:
  51. - full compliance with the Video4Linux2 API (see also "Notes for V4L2
  52. application developers" paragraph);
  53. - available mmap or read/poll methods for video streaming through isochronous
  54. data transfers;
  55. - automatic detection of image sensor;
  56. - support for any window resolutions and optional panning within the maximum
  57. pixel area of image sensor;
  58. - image downscaling with arbitrary scaling factors from 1 and 2 in both
  59. directions (see "Notes for V4L2 application developers" paragraph);
  60. - two different video formats for uncompressed or compressed data in low or
  61. high compression quality (see also "Notes for V4L2 application developers"
  62. paragraph);
  63. - full support for the capabilities of every possible image sensors that can
  64. be connected to the ET61X[12]51 bridges, including, for instance, red, green,
  65. blue and global gain adjustments and exposure control (see "Supported
  66. devices" paragraph for details);
  67. - use of default color settings for sunlight conditions;
  68. - dynamic I/O interface for both ET61X[12]51 and image sensor control (see
  69. "Optional device control through 'sysfs'" paragraph);
  70. - dynamic driver control thanks to various module parameters (see "Module
  71. parameters" paragraph);
  72. - up to 64 cameras can be handled at the same time; they can be connected and
  73. disconnected from the host many times without turning off the computer, if
  74. the system supports hotplugging;
  75. - no known bugs.
  76. 5. Module dependencies
  77. ======================
  78. For it to work properly, the driver needs kernel support for Video4Linux and
  79. USB.
  80. The following options of the kernel configuration file must be enabled and
  81. corresponding modules must be compiled:
  82. # Multimedia devices
  83. #
  84. CONFIG_VIDEO_DEV=m
  85. To enable advanced debugging functionality on the device through /sysfs:
  86. # Multimedia devices
  87. #
  88. CONFIG_VIDEO_ADV_DEBUG=y
  89. # USB support
  90. #
  91. CONFIG_USB=m
  92. In addition, depending on the hardware being used, the modules below are
  93. necessary:
  94. # USB Host Controller Drivers
  95. #
  96. CONFIG_USB_EHCI_HCD=m
  97. CONFIG_USB_UHCI_HCD=m
  98. CONFIG_USB_OHCI_HCD=m
  99. And finally:
  100. # USB Multimedia devices
  101. #
  102. CONFIG_USB_ET61X251=m
  103. 6. Module loading
  104. =================
  105. To use the driver, it is necessary to load the "et61x251" module into memory
  106. after every other module required: "videodev", "v4l2_common", "compat_ioctl32",
  107. "usbcore" and, depending on the USB host controller you have, "ehci-hcd",
  108. "uhci-hcd" or "ohci-hcd".
  109. Loading can be done as shown below:
  110. [root@localhost home]# modprobe et61x251
  111. At this point the devices should be recognized. You can invoke "dmesg" to
  112. analyze kernel messages and verify that the loading process has gone well:
  113. [user@localhost home]$ dmesg
  114. 7. Module parameters
  115. ====================
  116. Module parameters are listed below:
  117. -------------------------------------------------------------------------------
  118. Name: video_nr
  119. Type: short array (min = 0, max = 64)
  120. Syntax: <-1|n[,...]>
  121. Description: Specify V4L2 minor mode number:
  122. -1 = use next available
  123. n = use minor number n
  124. You can specify up to 64 cameras this way.
  125. For example:
  126. video_nr=-1,2,-1 would assign minor number 2 to the second
  127. registered camera and use auto for the first one and for every
  128. other camera.
  129. Default: -1
  130. -------------------------------------------------------------------------------
  131. Name: force_munmap
  132. Type: bool array (min = 0, max = 64)
  133. Syntax: <0|1[,...]>
  134. Description: Force the application to unmap previously mapped buffer memory
  135. before calling any VIDIOC_S_CROP or VIDIOC_S_FMT ioctl's. Not
  136. all the applications support this feature. This parameter is
  137. specific for each detected camera.
  138. 0 = do not force memory unmapping
  139. 1 = force memory unmapping (save memory)
  140. Default: 0
  141. -------------------------------------------------------------------------------
  142. Name: frame_timeout
  143. Type: uint array (min = 0, max = 64)
  144. Syntax: <n[,...]>
  145. Description: Timeout for a video frame in seconds. This parameter is
  146. specific for each detected camera. This parameter can be
  147. changed at runtime thanks to the /sys filesystem interface.
  148. Default: 2
  149. -------------------------------------------------------------------------------
  150. Name: debug
  151. Type: ushort
  152. Syntax: <n>
  153. Description: Debugging information level, from 0 to 3:
  154. 0 = none (use carefully)
  155. 1 = critical errors
  156. 2 = significant information
  157. 3 = more verbose messages
  158. Level 3 is useful for testing only, when only one device
  159. is used at the same time. It also shows some more information
  160. about the hardware being detected. This module parameter can be
  161. changed at runtime thanks to the /sys filesystem interface.
  162. Default: 2
  163. -------------------------------------------------------------------------------
  164. 8. Optional device control through "sysfs"
  165. ==========================================
  166. If the kernel has been compiled with the CONFIG_VIDEO_ADV_DEBUG option enabled,
  167. it is possible to read and write both the ET61X[12]51 and the image sensor
  168. registers by using the "sysfs" filesystem interface.
  169. There are four files in the /sys/class/video4linux/videoX directory for each
  170. registered camera: "reg", "val", "i2c_reg" and "i2c_val". The first two files
  171. control the ET61X[12]51 bridge, while the other two control the sensor chip.
  172. "reg" and "i2c_reg" hold the values of the current register index where the
  173. following reading/writing operations are addressed at through "val" and
  174. "i2c_val". Their use is not intended for end-users, unless you know what you
  175. are doing. Remember that you must be logged in as root before writing to them.
  176. As an example, suppose we were to want to read the value contained in the
  177. register number 1 of the sensor register table - which is usually the product
  178. identifier - of the camera registered as "/dev/video0":
  179. [root@localhost #] cd /sys/class/video4linux/video0
  180. [root@localhost #] echo 1 > i2c_reg
  181. [root@localhost #] cat i2c_val
  182. Note that if the sensor registers cannot be read, "cat" will fail.
  183. To avoid race conditions, all the I/O accesses to the files are serialized.
  184. 9. Supported devices
  185. ====================
  186. None of the names of the companies as well as their products will be mentioned
  187. here. They have never collaborated with the author, so no advertising.
  188. From the point of view of a driver, what unambiguously identify a device are
  189. its vendor and product USB identifiers. Below is a list of known identifiers of
  190. devices mounting the ET61X[12]51 PC camera controllers:
  191. Vendor ID Product ID
  192. --------- ----------
  193. 0x102c 0x6151
  194. 0x102c 0x6251
  195. 0x102c 0x6253
  196. 0x102c 0x6254
  197. 0x102c 0x6255
  198. 0x102c 0x6256
  199. 0x102c 0x6257
  200. 0x102c 0x6258
  201. 0x102c 0x6259
  202. 0x102c 0x625a
  203. 0x102c 0x625b
  204. 0x102c 0x625c
  205. 0x102c 0x625d
  206. 0x102c 0x625e
  207. 0x102c 0x625f
  208. 0x102c 0x6260
  209. 0x102c 0x6261
  210. 0x102c 0x6262
  211. 0x102c 0x6263
  212. 0x102c 0x6264
  213. 0x102c 0x6265
  214. 0x102c 0x6266
  215. 0x102c 0x6267
  216. 0x102c 0x6268
  217. 0x102c 0x6269
  218. The following image sensors are supported:
  219. Model Manufacturer
  220. ----- ------------
  221. TAS5130D1B Taiwan Advanced Sensor Corporation
  222. All the available control settings of each image sensor are supported through
  223. the V4L2 interface.
  224. 10. Notes for V4L2 application developers
  225. =========================================
  226. This driver follows the V4L2 API specifications. In particular, it enforces two
  227. rules:
  228. - exactly one I/O method, either "mmap" or "read", is associated with each
  229. file descriptor. Once it is selected, the application must close and reopen the
  230. device to switch to the other I/O method;
  231. - although it is not mandatory, previously mapped buffer memory should always
  232. be unmapped before calling any "VIDIOC_S_CROP" or "VIDIOC_S_FMT" ioctl's.
  233. The same number of buffers as before will be allocated again to match the size
  234. of the new video frames, so you have to map the buffers again before any I/O
  235. attempts on them.
  236. Consistently with the hardware limits, this driver also supports image
  237. downscaling with arbitrary scaling factors from 1 and 2 in both directions.
  238. However, the V4L2 API specifications don't correctly define how the scaling
  239. factor can be chosen arbitrarily by the "negotiation" of the "source" and
  240. "target" rectangles. To work around this flaw, we have added the convention
  241. that, during the negotiation, whenever the "VIDIOC_S_CROP" ioctl is issued, the
  242. scaling factor is restored to 1.
  243. This driver supports two different video formats: the first one is the "8-bit
  244. Sequential Bayer" format and can be used to obtain uncompressed video data
  245. from the device through the current I/O method, while the second one provides
  246. "raw" compressed video data (without frame headers not related to the
  247. compressed data). The current compression quality may vary from 0 to 1 and can
  248. be selected or queried thanks to the VIDIOC_S_JPEGCOMP and VIDIOC_G_JPEGCOMP
  249. V4L2 ioctl's.
  250. 11. Contact information
  251. =======================
  252. The author may be contacted by e-mail at <luca.risolia@studio.unibo.it>.
  253. GPG/PGP encrypted e-mail's are accepted. The GPG key ID of the author is
  254. 'FCE635A4'; the public 1024-bit key should be available at any keyserver;
  255. the fingerprint is: '88E8 F32F 7244 68BA 3958 5D40 99DA 5D2A FCE6 35A4'.