162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci 362306a36Sopenharmony_ciPhilips webcams (pwc driver) 462306a36Sopenharmony_ci============================ 562306a36Sopenharmony_ci 662306a36Sopenharmony_ciThis file contains some additional information for the Philips and OEM webcams. 762306a36Sopenharmony_ciE-mail: webcam@smcc.demon.nl Last updated: 2004-01-19 862306a36Sopenharmony_ciSite: http://www.smcc.demon.nl/webcam/ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ciAs of this moment, the following cameras are supported: 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci * Philips PCA645 1362306a36Sopenharmony_ci * Philips PCA646 1462306a36Sopenharmony_ci * Philips PCVC675 1562306a36Sopenharmony_ci * Philips PCVC680 1662306a36Sopenharmony_ci * Philips PCVC690 1762306a36Sopenharmony_ci * Philips PCVC720/40 1862306a36Sopenharmony_ci * Philips PCVC730 1962306a36Sopenharmony_ci * Philips PCVC740 2062306a36Sopenharmony_ci * Philips PCVC750 2162306a36Sopenharmony_ci * Askey VC010 2262306a36Sopenharmony_ci * Creative Labs Webcam 5 2362306a36Sopenharmony_ci * Creative Labs Webcam Pro Ex 2462306a36Sopenharmony_ci * Logitech QuickCam 3000 Pro 2562306a36Sopenharmony_ci * Logitech QuickCam 4000 Pro 2662306a36Sopenharmony_ci * Logitech QuickCam Notebook Pro 2762306a36Sopenharmony_ci * Logitech QuickCam Zoom 2862306a36Sopenharmony_ci * Logitech QuickCam Orbit 2962306a36Sopenharmony_ci * Logitech QuickCam Sphere 3062306a36Sopenharmony_ci * Samsung MPC-C10 3162306a36Sopenharmony_ci * Samsung MPC-C30 3262306a36Sopenharmony_ci * Sotec Afina Eye 3362306a36Sopenharmony_ci * AME CU-001 3462306a36Sopenharmony_ci * Visionite VCS-UM100 3562306a36Sopenharmony_ci * Visionite VCS-UC300 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ciThe main webpage for the Philips driver is at the address above. It contains 3862306a36Sopenharmony_cia lot of extra information, a FAQ, and the binary plugin 'PWCX'. This plugin 3962306a36Sopenharmony_cicontains decompression routines that allow you to use higher image sizes and 4062306a36Sopenharmony_ciframerates; in addition the webcam uses less bandwidth on the USB bus (handy 4162306a36Sopenharmony_ciif you want to run more than 1 camera simultaneously). These routines fall 4262306a36Sopenharmony_ciunder a NDA, and may therefore not be distributed as source; however, its use 4362306a36Sopenharmony_ciis completely optional. 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ciYou can build this code either into your kernel, or as a module. I recommend 4662306a36Sopenharmony_cithe latter, since it makes troubleshooting a lot easier. The built-in 4762306a36Sopenharmony_cimicrophone is supported through the USB Audio class. 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ciWhen you load the module you can set some default settings for the 5062306a36Sopenharmony_cicamera; some programs depend on a particular image-size or -format and 5162306a36Sopenharmony_cidon't know how to set it properly in the driver. The options are: 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_cisize 5462306a36Sopenharmony_ci Can be one of 'sqcif', 'qsif', 'qcif', 'sif', 'cif' or 5562306a36Sopenharmony_ci 'vga', for an image size of resp. 128x96, 160x120, 176x144, 5662306a36Sopenharmony_ci 320x240, 352x288 and 640x480 (of course, only for those cameras that 5762306a36Sopenharmony_ci support these resolutions). 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_cifps 6062306a36Sopenharmony_ci Specifies the desired framerate. Is an integer in the range of 4-30. 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_cifbufs 6362306a36Sopenharmony_ci This parameter specifies the number of internal buffers to use for storing 6462306a36Sopenharmony_ci frames from the cam. This will help if the process that reads images from 6562306a36Sopenharmony_ci the cam is a bit slow or momentarily busy. However, on slow machines it 6662306a36Sopenharmony_ci only introduces lag, so choose carefully. The default is 3, which is 6762306a36Sopenharmony_ci reasonable. You can set it between 2 and 5. 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_cimbufs 7062306a36Sopenharmony_ci This is an integer between 1 and 10. It will tell the module the number of 7162306a36Sopenharmony_ci buffers to reserve for mmap(), VIDIOCCGMBUF, VIDIOCMCAPTURE and friends. 7262306a36Sopenharmony_ci The default is 2, which is adequate for most applications (double 7362306a36Sopenharmony_ci buffering). 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ci Should you experience a lot of 'Dumping frame...' messages during 7662306a36Sopenharmony_ci grabbing with a tool that uses mmap(), you might want to increase if. 7762306a36Sopenharmony_ci However, it doesn't really buffer images, it just gives you a bit more 7862306a36Sopenharmony_ci slack when your program is behind. But you need a multi-threaded or 7962306a36Sopenharmony_ci forked program to really take advantage of these buffers. 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ci The absolute maximum is 10, but don't set it too high! Every buffer takes 8262306a36Sopenharmony_ci up 460 KB of RAM, so unless you have a lot of memory setting this to 8362306a36Sopenharmony_ci something more than 4 is an absolute waste. This memory is only 8462306a36Sopenharmony_ci allocated during open(), so nothing is wasted when the camera is not in 8562306a36Sopenharmony_ci use. 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_cipower_save 8862306a36Sopenharmony_ci When power_save is enabled (set to 1), the module will try to shut down 8962306a36Sopenharmony_ci the cam on close() and re-activate on open(). This will save power and 9062306a36Sopenharmony_ci turn off the LED. Not all cameras support this though (the 645 and 646 9162306a36Sopenharmony_ci don't have power saving at all), and some models don't work either (they 9262306a36Sopenharmony_ci will shut down, but never wake up). Consider this experimental. By 9362306a36Sopenharmony_ci default this option is disabled. 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_cicompression (only useful with the plugin) 9662306a36Sopenharmony_ci With this option you can control the compression factor that the camera 9762306a36Sopenharmony_ci uses to squeeze the image through the USB bus. You can set the 9862306a36Sopenharmony_ci parameter between 0 and 3:: 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci 0 = prefer uncompressed images; if the requested mode is not available 10162306a36Sopenharmony_ci in an uncompressed format, the driver will silently switch to low 10262306a36Sopenharmony_ci compression. 10362306a36Sopenharmony_ci 1 = low compression. 10462306a36Sopenharmony_ci 2 = medium compression. 10562306a36Sopenharmony_ci 3 = high compression. 10662306a36Sopenharmony_ci 10762306a36Sopenharmony_ci High compression takes less bandwidth of course, but it could also 10862306a36Sopenharmony_ci introduce some unwanted artefacts. The default is 2, medium compression. 10962306a36Sopenharmony_ci See the FAQ on the website for an overview of which modes require 11062306a36Sopenharmony_ci compression. 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ci The compression parameter does not apply to the 645 and 646 cameras 11362306a36Sopenharmony_ci and OEM models derived from those (only a few). Most cams honour this 11462306a36Sopenharmony_ci parameter. 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_cileds 11762306a36Sopenharmony_ci This settings takes 2 integers, that define the on/off time for the LED 11862306a36Sopenharmony_ci (in milliseconds). One of the interesting things that you can do with 11962306a36Sopenharmony_ci this is let the LED blink while the camera is in use. This:: 12062306a36Sopenharmony_ci 12162306a36Sopenharmony_ci leds=500,500 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ci will blink the LED once every second. But with:: 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_ci leds=0,0 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ci the LED never goes on, making it suitable for silent surveillance. 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ci By default the camera's LED is on solid while in use, and turned off 13062306a36Sopenharmony_ci when the camera is not used anymore. 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci This parameter works only with the ToUCam range of cameras (720, 730, 740, 13362306a36Sopenharmony_ci 750) and OEMs. For other cameras this command is silently ignored, and 13462306a36Sopenharmony_ci the LED cannot be controlled. 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_ci Finally: this parameters does not take effect UNTIL the first time you 13762306a36Sopenharmony_ci open the camera device. Until then, the LED remains on. 13862306a36Sopenharmony_ci 13962306a36Sopenharmony_cidev_hint 14062306a36Sopenharmony_ci A long standing problem with USB devices is their dynamic nature: you 14162306a36Sopenharmony_ci never know what device a camera gets assigned; it depends on module load 14262306a36Sopenharmony_ci order, the hub configuration, the order in which devices are plugged in, 14362306a36Sopenharmony_ci and the phase of the moon (i.e. it can be random). With this option you 14462306a36Sopenharmony_ci can give the driver a hint as to what video device node (/dev/videoX) it 14562306a36Sopenharmony_ci should use with a specific camera. This is also handy if you have two 14662306a36Sopenharmony_ci cameras of the same model. 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_ci A camera is specified by its type (the number from the camera model, 14962306a36Sopenharmony_ci like PCA645, PCVC750VC, etc) and optionally the serial number (visible 15062306a36Sopenharmony_ci in /sys/kernel/debug/usb/devices). A hint consists of a string with the 15162306a36Sopenharmony_ci following format:: 15262306a36Sopenharmony_ci 15362306a36Sopenharmony_ci [type[.serialnumber]:]node 15462306a36Sopenharmony_ci 15562306a36Sopenharmony_ci The square brackets mean that both the type and the serialnumber are 15662306a36Sopenharmony_ci optional, but a serialnumber cannot be specified without a type (which 15762306a36Sopenharmony_ci would be rather pointless). The serialnumber is separated from the type 15862306a36Sopenharmony_ci by a '.'; the node number by a ':'. 15962306a36Sopenharmony_ci 16062306a36Sopenharmony_ci This somewhat cryptic syntax is best explained by a few examples:: 16162306a36Sopenharmony_ci 16262306a36Sopenharmony_ci dev_hint=3,5 The first detected cam gets assigned 16362306a36Sopenharmony_ci /dev/video3, the second /dev/video5. Any 16462306a36Sopenharmony_ci other cameras will get the first free 16562306a36Sopenharmony_ci available slot (see below). 16662306a36Sopenharmony_ci 16762306a36Sopenharmony_ci dev_hint=645:1,680:2 The PCA645 camera will get /dev/video1, 16862306a36Sopenharmony_ci and a PCVC680 /dev/video2. 16962306a36Sopenharmony_ci 17062306a36Sopenharmony_ci dev_hint=645.0123:3,645.4567:0 The PCA645 camera with serialnumber 17162306a36Sopenharmony_ci 0123 goes to /dev/video3, the same 17262306a36Sopenharmony_ci camera model with the 4567 serial 17362306a36Sopenharmony_ci gets /dev/video0. 17462306a36Sopenharmony_ci 17562306a36Sopenharmony_ci dev_hint=750:1,4,5,6 The PCVC750 camera will get /dev/video1, the 17662306a36Sopenharmony_ci next 3 Philips cams will use /dev/video4 17762306a36Sopenharmony_ci through /dev/video6. 17862306a36Sopenharmony_ci 17962306a36Sopenharmony_ci Some points worth knowing: 18062306a36Sopenharmony_ci 18162306a36Sopenharmony_ci - Serialnumbers are case sensitive and must be written full, including 18262306a36Sopenharmony_ci leading zeroes (it's treated as a string). 18362306a36Sopenharmony_ci - If a device node is already occupied, registration will fail and 18462306a36Sopenharmony_ci the webcam is not available. 18562306a36Sopenharmony_ci - You can have up to 64 video devices; be sure to make enough device 18662306a36Sopenharmony_ci nodes in /dev if you want to spread the numbers. 18762306a36Sopenharmony_ci After /dev/video9 comes /dev/video10 (not /dev/videoA). 18862306a36Sopenharmony_ci - If a camera does not match any dev_hint, it will simply get assigned 18962306a36Sopenharmony_ci the first available device node, just as it used to be. 19062306a36Sopenharmony_ci 19162306a36Sopenharmony_citrace 19262306a36Sopenharmony_ci In order to better detect problems, it is now possible to turn on a 19362306a36Sopenharmony_ci 'trace' of some of the calls the module makes; it logs all items in your 19462306a36Sopenharmony_ci kernel log at debug level. 19562306a36Sopenharmony_ci 19662306a36Sopenharmony_ci The trace variable is a bitmask; each bit represents a certain feature. 19762306a36Sopenharmony_ci If you want to trace something, look up the bit value(s) in the table 19862306a36Sopenharmony_ci below, add the values together and supply that to the trace variable. 19962306a36Sopenharmony_ci 20062306a36Sopenharmony_ci ====== ======= ================================================ ======= 20162306a36Sopenharmony_ci Value Value Description Default 20262306a36Sopenharmony_ci (dec) (hex) 20362306a36Sopenharmony_ci ====== ======= ================================================ ======= 20462306a36Sopenharmony_ci 1 0x1 Module initialization; this will log messages On 20562306a36Sopenharmony_ci while loading and unloading the module 20662306a36Sopenharmony_ci 20762306a36Sopenharmony_ci 2 0x2 probe() and disconnect() traces On 20862306a36Sopenharmony_ci 20962306a36Sopenharmony_ci 4 0x4 Trace open() and close() calls Off 21062306a36Sopenharmony_ci 21162306a36Sopenharmony_ci 8 0x8 read(), mmap() and associated ioctl() calls Off 21262306a36Sopenharmony_ci 21362306a36Sopenharmony_ci 16 0x10 Memory allocation of buffers, etc. Off 21462306a36Sopenharmony_ci 21562306a36Sopenharmony_ci 32 0x20 Showing underflow, overflow and Dumping frame On 21662306a36Sopenharmony_ci messages 21762306a36Sopenharmony_ci 21862306a36Sopenharmony_ci 64 0x40 Show viewport and image sizes Off 21962306a36Sopenharmony_ci 22062306a36Sopenharmony_ci 128 0x80 PWCX debugging Off 22162306a36Sopenharmony_ci ====== ======= ================================================ ======= 22262306a36Sopenharmony_ci 22362306a36Sopenharmony_ci For example, to trace the open() & read() functions, sum 8 + 4 = 12, 22462306a36Sopenharmony_ci so you would supply trace=12 during insmod or modprobe. If 22562306a36Sopenharmony_ci you want to turn the initialization and probing tracing off, set trace=0. 22662306a36Sopenharmony_ci The default value for trace is 35 (0x23). 22762306a36Sopenharmony_ci 22862306a36Sopenharmony_ci 22962306a36Sopenharmony_ci 23062306a36Sopenharmony_ciExample:: 23162306a36Sopenharmony_ci 23262306a36Sopenharmony_ci # modprobe pwc size=cif fps=15 power_save=1 23362306a36Sopenharmony_ci 23462306a36Sopenharmony_ciThe fbufs, mbufs and trace parameters are global and apply to all connected 23562306a36Sopenharmony_cicameras. Each camera has its own set of buffers. 23662306a36Sopenharmony_ci 23762306a36Sopenharmony_cisize and fps only specify defaults when you open() the device; this is to 23862306a36Sopenharmony_ciaccommodate some tools that don't set the size. You can change these 23962306a36Sopenharmony_cisettings after open() with the Video4Linux ioctl() calls. The default of 24062306a36Sopenharmony_cidefaults is QCIF size at 10 fps. 24162306a36Sopenharmony_ci 24262306a36Sopenharmony_ciThe compression parameter is semiglobal; it sets the initial compression 24362306a36Sopenharmony_cipreference for all camera's, but this parameter can be set per camera with 24462306a36Sopenharmony_cithe VIDIOCPWCSCQUAL ioctl() call. 24562306a36Sopenharmony_ci 24662306a36Sopenharmony_ciAll parameters are optional. 24762306a36Sopenharmony_ci 248