xref: /OK3568_Linux_fs/kernel/Documentation/admin-guide/media/philips.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593SmuzhiyunPhilips webcams (pwc driver)
4*4882a593Smuzhiyun============================
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunThis file contains some additional information for the Philips and OEM webcams.
7*4882a593SmuzhiyunE-mail: webcam@smcc.demon.nl                        Last updated: 2004-01-19
8*4882a593SmuzhiyunSite: http://www.smcc.demon.nl/webcam/
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunAs of this moment, the following cameras are supported:
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun * Philips PCA645
13*4882a593Smuzhiyun * Philips PCA646
14*4882a593Smuzhiyun * Philips PCVC675
15*4882a593Smuzhiyun * Philips PCVC680
16*4882a593Smuzhiyun * Philips PCVC690
17*4882a593Smuzhiyun * Philips PCVC720/40
18*4882a593Smuzhiyun * Philips PCVC730
19*4882a593Smuzhiyun * Philips PCVC740
20*4882a593Smuzhiyun * Philips PCVC750
21*4882a593Smuzhiyun * Askey VC010
22*4882a593Smuzhiyun * Creative Labs Webcam 5
23*4882a593Smuzhiyun * Creative Labs Webcam Pro Ex
24*4882a593Smuzhiyun * Logitech QuickCam 3000 Pro
25*4882a593Smuzhiyun * Logitech QuickCam 4000 Pro
26*4882a593Smuzhiyun * Logitech QuickCam Notebook Pro
27*4882a593Smuzhiyun * Logitech QuickCam Zoom
28*4882a593Smuzhiyun * Logitech QuickCam Orbit
29*4882a593Smuzhiyun * Logitech QuickCam Sphere
30*4882a593Smuzhiyun * Samsung MPC-C10
31*4882a593Smuzhiyun * Samsung MPC-C30
32*4882a593Smuzhiyun * Sotec Afina Eye
33*4882a593Smuzhiyun * AME CU-001
34*4882a593Smuzhiyun * Visionite VCS-UM100
35*4882a593Smuzhiyun * Visionite VCS-UC300
36*4882a593Smuzhiyun
37*4882a593SmuzhiyunThe main webpage for the Philips driver is at the address above. It contains
38*4882a593Smuzhiyuna lot of extra information, a FAQ, and the binary plugin 'PWCX'. This plugin
39*4882a593Smuzhiyuncontains decompression routines that allow you to use higher image sizes and
40*4882a593Smuzhiyunframerates; in addition the webcam uses less bandwidth on the USB bus (handy
41*4882a593Smuzhiyunif you want to run more than 1 camera simultaneously). These routines fall
42*4882a593Smuzhiyununder a NDA, and may therefore not be distributed as source; however, its use
43*4882a593Smuzhiyunis completely optional.
44*4882a593Smuzhiyun
45*4882a593SmuzhiyunYou can build this code either into your kernel, or as a module. I recommend
46*4882a593Smuzhiyunthe latter, since it makes troubleshooting a lot easier. The built-in
47*4882a593Smuzhiyunmicrophone is supported through the USB Audio class.
48*4882a593Smuzhiyun
49*4882a593SmuzhiyunWhen you load the module you can set some default settings for the
50*4882a593Smuzhiyuncamera; some programs depend on a particular image-size or -format and
51*4882a593Smuzhiyundon't know how to set it properly in the driver. The options are:
52*4882a593Smuzhiyun
53*4882a593Smuzhiyunsize
54*4882a593Smuzhiyun   Can be one of 'sqcif', 'qsif', 'qcif', 'sif', 'cif' or
55*4882a593Smuzhiyun   'vga', for an image size of resp. 128x96, 160x120, 176x144,
56*4882a593Smuzhiyun   320x240, 352x288 and 640x480 (of course, only for those cameras that
57*4882a593Smuzhiyun   support these resolutions).
58*4882a593Smuzhiyun
59*4882a593Smuzhiyunfps
60*4882a593Smuzhiyun   Specifies the desired framerate. Is an integer in the range of 4-30.
61*4882a593Smuzhiyun
62*4882a593Smuzhiyunfbufs
63*4882a593Smuzhiyun   This parameter specifies the number of internal buffers to use for storing
64*4882a593Smuzhiyun   frames from the cam. This will help if the process that reads images from
65*4882a593Smuzhiyun   the cam is a bit slow or momentarily busy. However, on slow machines it
66*4882a593Smuzhiyun   only introduces lag, so choose carefully. The default is 3, which is
67*4882a593Smuzhiyun   reasonable. You can set it between 2 and 5.
68*4882a593Smuzhiyun
69*4882a593Smuzhiyunmbufs
70*4882a593Smuzhiyun   This is an integer between 1 and 10. It will tell the module the number of
71*4882a593Smuzhiyun   buffers to reserve for mmap(), VIDIOCCGMBUF, VIDIOCMCAPTURE and friends.
72*4882a593Smuzhiyun   The default is 2, which is adequate for most applications (double
73*4882a593Smuzhiyun   buffering).
74*4882a593Smuzhiyun
75*4882a593Smuzhiyun   Should you experience a lot of 'Dumping frame...' messages during
76*4882a593Smuzhiyun   grabbing with a tool that uses mmap(), you might want to increase if.
77*4882a593Smuzhiyun   However, it doesn't really buffer images, it just gives you a bit more
78*4882a593Smuzhiyun   slack when your program is behind. But you need a multi-threaded or
79*4882a593Smuzhiyun   forked program to really take advantage of these buffers.
80*4882a593Smuzhiyun
81*4882a593Smuzhiyun   The absolute maximum is 10, but don't set it too high!  Every buffer takes
82*4882a593Smuzhiyun   up 460 KB of RAM, so unless you have a lot of memory setting this to
83*4882a593Smuzhiyun   something more than 4 is an absolute waste.  This memory is only
84*4882a593Smuzhiyun   allocated during open(), so nothing is wasted when the camera is not in
85*4882a593Smuzhiyun   use.
86*4882a593Smuzhiyun
87*4882a593Smuzhiyunpower_save
88*4882a593Smuzhiyun   When power_save is enabled (set to 1), the module will try to shut down
89*4882a593Smuzhiyun   the cam on close() and re-activate on open(). This will save power and
90*4882a593Smuzhiyun   turn off the LED. Not all cameras support this though (the 645 and 646
91*4882a593Smuzhiyun   don't have power saving at all), and some models don't work either (they
92*4882a593Smuzhiyun   will shut down, but never wake up). Consider this experimental. By
93*4882a593Smuzhiyun   default this option is disabled.
94*4882a593Smuzhiyun
95*4882a593Smuzhiyuncompression (only useful with the plugin)
96*4882a593Smuzhiyun   With this option you can control the compression factor that the camera
97*4882a593Smuzhiyun   uses to squeeze the image through the USB bus. You can set the
98*4882a593Smuzhiyun   parameter between 0 and 3::
99*4882a593Smuzhiyun
100*4882a593Smuzhiyun     0 = prefer uncompressed images; if the requested mode is not available
101*4882a593Smuzhiyun	 in an uncompressed format, the driver will silently switch to low
102*4882a593Smuzhiyun	 compression.
103*4882a593Smuzhiyun     1 = low compression.
104*4882a593Smuzhiyun     2 = medium compression.
105*4882a593Smuzhiyun     3 = high compression.
106*4882a593Smuzhiyun
107*4882a593Smuzhiyun   High compression takes less bandwidth of course, but it could also
108*4882a593Smuzhiyun   introduce some unwanted artefacts. The default is 2, medium compression.
109*4882a593Smuzhiyun   See the FAQ on the website for an overview of which modes require
110*4882a593Smuzhiyun   compression.
111*4882a593Smuzhiyun
112*4882a593Smuzhiyun   The compression parameter does not apply to the 645 and 646 cameras
113*4882a593Smuzhiyun   and OEM models derived from those (only a few). Most cams honour this
114*4882a593Smuzhiyun   parameter.
115*4882a593Smuzhiyun
116*4882a593Smuzhiyunleds
117*4882a593Smuzhiyun   This settings takes 2 integers, that define the on/off time for the LED
118*4882a593Smuzhiyun   (in milliseconds). One of the interesting things that you can do with
119*4882a593Smuzhiyun   this is let the LED blink while the camera is in use. This::
120*4882a593Smuzhiyun
121*4882a593Smuzhiyun     leds=500,500
122*4882a593Smuzhiyun
123*4882a593Smuzhiyun   will blink the LED once every second. But with::
124*4882a593Smuzhiyun
125*4882a593Smuzhiyun     leds=0,0
126*4882a593Smuzhiyun
127*4882a593Smuzhiyun   the LED never goes on, making it suitable for silent surveillance.
128*4882a593Smuzhiyun
129*4882a593Smuzhiyun   By default the camera's LED is on solid while in use, and turned off
130*4882a593Smuzhiyun   when the camera is not used anymore.
131*4882a593Smuzhiyun
132*4882a593Smuzhiyun   This parameter works only with the ToUCam range of cameras (720, 730, 740,
133*4882a593Smuzhiyun   750) and OEMs. For other cameras this command is silently ignored, and
134*4882a593Smuzhiyun   the LED cannot be controlled.
135*4882a593Smuzhiyun
136*4882a593Smuzhiyun   Finally: this parameters does not take effect UNTIL the first time you
137*4882a593Smuzhiyun   open the camera device. Until then, the LED remains on.
138*4882a593Smuzhiyun
139*4882a593Smuzhiyundev_hint
140*4882a593Smuzhiyun   A long standing problem with USB devices is their dynamic nature: you
141*4882a593Smuzhiyun   never know what device a camera gets assigned; it depends on module load
142*4882a593Smuzhiyun   order, the hub configuration, the order in which devices are plugged in,
143*4882a593Smuzhiyun   and the phase of the moon (i.e. it can be random). With this option you
144*4882a593Smuzhiyun   can give the driver a hint as to what video device node (/dev/videoX) it
145*4882a593Smuzhiyun   should use with a specific camera. This is also handy if you have two
146*4882a593Smuzhiyun   cameras of the same model.
147*4882a593Smuzhiyun
148*4882a593Smuzhiyun   A camera is specified by its type (the number from the camera model,
149*4882a593Smuzhiyun   like PCA645, PCVC750VC, etc) and optionally the serial number (visible
150*4882a593Smuzhiyun   in /sys/kernel/debug/usb/devices). A hint consists of a string with the
151*4882a593Smuzhiyun   following format::
152*4882a593Smuzhiyun
153*4882a593Smuzhiyun      [type[.serialnumber]:]node
154*4882a593Smuzhiyun
155*4882a593Smuzhiyun   The square brackets mean that both the type and the serialnumber are
156*4882a593Smuzhiyun   optional, but a serialnumber cannot be specified without a type (which
157*4882a593Smuzhiyun   would be rather pointless). The serialnumber is separated from the type
158*4882a593Smuzhiyun   by a '.'; the node number by a ':'.
159*4882a593Smuzhiyun
160*4882a593Smuzhiyun   This somewhat cryptic syntax is best explained by a few examples::
161*4882a593Smuzhiyun
162*4882a593Smuzhiyun     dev_hint=3,5              The first detected cam gets assigned
163*4882a593Smuzhiyun			       /dev/video3, the second /dev/video5. Any
164*4882a593Smuzhiyun			       other cameras will get the first free
165*4882a593Smuzhiyun			       available slot (see below).
166*4882a593Smuzhiyun
167*4882a593Smuzhiyun     dev_hint=645:1,680:2      The PCA645 camera will get /dev/video1,
168*4882a593Smuzhiyun			       and a PCVC680 /dev/video2.
169*4882a593Smuzhiyun
170*4882a593Smuzhiyun     dev_hint=645.0123:3,645.4567:0	The PCA645 camera with serialnumber
171*4882a593Smuzhiyun					0123 goes to /dev/video3, the same
172*4882a593Smuzhiyun					camera model with the 4567 serial
173*4882a593Smuzhiyun					gets /dev/video0.
174*4882a593Smuzhiyun
175*4882a593Smuzhiyun     dev_hint=750:1,4,5,6       The PCVC750 camera will get /dev/video1, the
176*4882a593Smuzhiyun				next 3 Philips cams will use /dev/video4
177*4882a593Smuzhiyun				through /dev/video6.
178*4882a593Smuzhiyun
179*4882a593Smuzhiyun   Some points worth knowing:
180*4882a593Smuzhiyun
181*4882a593Smuzhiyun   - Serialnumbers are case sensitive and must be written full, including
182*4882a593Smuzhiyun     leading zeroes (it's treated as a string).
183*4882a593Smuzhiyun   - If a device node is already occupied, registration will fail and
184*4882a593Smuzhiyun     the webcam is not available.
185*4882a593Smuzhiyun   - You can have up to 64 video devices; be sure to make enough device
186*4882a593Smuzhiyun     nodes in /dev if you want to spread the numbers.
187*4882a593Smuzhiyun     After /dev/video9 comes /dev/video10 (not /dev/videoA).
188*4882a593Smuzhiyun   - If a camera does not match any dev_hint, it will simply get assigned
189*4882a593Smuzhiyun     the first available device node, just as it used to be.
190*4882a593Smuzhiyun
191*4882a593Smuzhiyuntrace
192*4882a593Smuzhiyun   In order to better detect problems, it is now possible to turn on a
193*4882a593Smuzhiyun   'trace' of some of the calls the module makes; it logs all items in your
194*4882a593Smuzhiyun   kernel log at debug level.
195*4882a593Smuzhiyun
196*4882a593Smuzhiyun   The trace variable is a bitmask; each bit represents a certain feature.
197*4882a593Smuzhiyun   If you want to trace something, look up the bit value(s) in the table
198*4882a593Smuzhiyun   below, add the values together and supply that to the trace variable.
199*4882a593Smuzhiyun
200*4882a593Smuzhiyun   ====== ======= ================================================ =======
201*4882a593Smuzhiyun   Value  Value   Description					   Default
202*4882a593Smuzhiyun   (dec)  (hex)
203*4882a593Smuzhiyun   ====== ======= ================================================ =======
204*4882a593Smuzhiyun       1    0x1   Module initialization; this will log messages       On
205*4882a593Smuzhiyun		  while loading and unloading the module
206*4882a593Smuzhiyun
207*4882a593Smuzhiyun       2    0x2   probe() and disconnect() traces                     On
208*4882a593Smuzhiyun
209*4882a593Smuzhiyun       4    0x4   Trace open() and close() calls                      Off
210*4882a593Smuzhiyun
211*4882a593Smuzhiyun       8    0x8   read(), mmap() and associated ioctl() calls         Off
212*4882a593Smuzhiyun
213*4882a593Smuzhiyun      16   0x10   Memory allocation of buffers, etc.                  Off
214*4882a593Smuzhiyun
215*4882a593Smuzhiyun      32   0x20   Showing underflow, overflow and Dumping frame       On
216*4882a593Smuzhiyun		  messages
217*4882a593Smuzhiyun
218*4882a593Smuzhiyun      64   0x40   Show viewport and image sizes                       Off
219*4882a593Smuzhiyun
220*4882a593Smuzhiyun     128   0x80   PWCX debugging                                      Off
221*4882a593Smuzhiyun   ====== ======= ================================================ =======
222*4882a593Smuzhiyun
223*4882a593Smuzhiyun   For example, to trace the open() & read() functions, sum 8 + 4 = 12,
224*4882a593Smuzhiyun   so you would supply trace=12 during insmod or modprobe. If
225*4882a593Smuzhiyun   you want to turn the initialization and probing tracing off, set trace=0.
226*4882a593Smuzhiyun   The default value for trace is 35 (0x23).
227*4882a593Smuzhiyun
228*4882a593Smuzhiyun
229*4882a593Smuzhiyun
230*4882a593SmuzhiyunExample::
231*4882a593Smuzhiyun
232*4882a593Smuzhiyun     # modprobe pwc size=cif fps=15 power_save=1
233*4882a593Smuzhiyun
234*4882a593SmuzhiyunThe fbufs, mbufs and trace parameters are global and apply to all connected
235*4882a593Smuzhiyuncameras. Each camera has its own set of buffers.
236*4882a593Smuzhiyun
237*4882a593Smuzhiyunsize and fps only specify defaults when you open() the device; this is to
238*4882a593Smuzhiyunaccommodate some tools that don't set the size. You can change these
239*4882a593Smuzhiyunsettings after open() with the Video4Linux ioctl() calls. The default of
240*4882a593Smuzhiyundefaults is QCIF size at 10 fps.
241*4882a593Smuzhiyun
242*4882a593SmuzhiyunThe compression parameter is semiglobal; it sets the initial compression
243*4882a593Smuzhiyunpreference for all camera's, but this parameter can be set per camera with
244*4882a593Smuzhiyunthe VIDIOCPWCSCQUAL ioctl() call.
245*4882a593Smuzhiyun
246*4882a593SmuzhiyunAll parameters are optional.
247*4882a593Smuzhiyun
248