pwc-ioctl.h
00001 #ifndef PWC_IOCTL_H 00002 #define PWC_IOCTL_H 00003 00004 /* Copyright (C) 2001-2004 Nemosoft Unv. 00005 Copyright (C) 2004 Luc Saillard (luc@saillard.org) 00006 00007 NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx 00008 driver and thus may have bugs that are not present in the original version. 00009 Please send bug reports and support requests to <luc@saillard.org>. 00010 The decompression routines have been implemented by reverse-engineering the 00011 Nemosoft binary pwcx module. Caveat emptor. 00012 00013 This program is free software; you can redistribute it and/or modify 00014 it under the terms of the GNU General Public License as published by 00015 the Free Software Foundation; either version 2 of the License, or 00016 (at your option) any later version. 00017 00018 This program is distributed in the hope that it will be useful, 00019 but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 GNU General Public License for more details. 00022 00023 You should have received a copy of the GNU General Public License 00024 along with this program; if not, write to the Free Software 00025 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00026 */ 00027 00028 /* This is pwc-ioctl.h belonging to PWC 8.12.1 00029 It contains structures and defines to communicate from user space 00030 directly to the driver. 00031 */ 00032 00033 /* 00034 Changes 00035 2001/08/03 Alvarado Added ioctl constants to access methods for 00036 changing white balance and red/blue gains 00037 2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE 00038 2003/12/13 Nemosft Unv. Some modifications to make interfacing to 00039 PWCX easier 00040 */ 00041 00042 /* These are private ioctl() commands, specific for the Philips webcams. 00043 They contain functions not found in other webcams, and settings not 00044 specified in the Video4Linux API. 00045 00046 The #define names are built up like follows: 00047 VIDIOC VIDeo IOCtl prefix 00048 PWC Philps WebCam 00049 G optional: Get 00050 S optional: Set 00051 ... the function 00052 */ 00053 00054 00055 /* Enumeration of image sizes */ 00056 #define PSZ_SQCIF 0x00 00057 #define PSZ_QSIF 0x01 00058 #define PSZ_QCIF 0x02 00059 #define PSZ_SIF 0x03 00060 #define PSZ_CIF 0x04 00061 #define PSZ_VGA 0x05 00062 #define PSZ_MAX 6 00063 00064 00065 /* The frame rate is encoded in the video_window.flags parameter using 00066 the upper 16 bits, since some flags are defined nowadays. The following 00067 defines provide a mask and shift to filter out this value. 00068 00069 In 'Snapshot' mode the camera freezes its automatic exposure and colour 00070 balance controls. 00071 */ 00072 #define PWC_FPS_SHIFT 16 00073 #define PWC_FPS_MASK 0x00FF0000 00074 #define PWC_FPS_FRMASK 0x003F0000 00075 #define PWC_FPS_SNAPSHOT 0x00400000 00076 00077 00078 /* structure for transfering x & y coordinates */ 00079 struct pwc_coord 00080 { 00081 int x, y; /* guess what */ 00082 int size; /* size, or offset */ 00083 }; 00084 00085 00086 /* Used with VIDIOCPWCPROBE */ 00087 struct pwc_probe 00088 { 00089 char name[32]; 00090 int type; 00091 }; 00092 00093 struct pwc_serial 00094 { 00095 char serial[30]; /* String with serial number. Contains terminating 0 */ 00096 }; 00097 00098 /* pwc_whitebalance.mode values */ 00099 #define PWC_WB_INDOOR 0 00100 #define PWC_WB_OUTDOOR 1 00101 #define PWC_WB_FL 2 00102 #define PWC_WB_MANUAL 3 00103 #define PWC_WB_AUTO 4 00104 00105 /* Used with VIDIOCPWC[SG]AWB (Auto White Balance). 00106 Set mode to one of the PWC_WB_* values above. 00107 *red and *blue are the respective gains of these colour components inside 00108 the camera; range 0..65535 00109 When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read; 00110 otherwise undefined. 00111 'read_red' and 'read_blue' are read-only. 00112 */ 00113 struct pwc_whitebalance 00114 { 00115 int mode; 00116 int manual_red, manual_blue; /* R/W */ 00117 int read_red, read_blue; /* R/O */ 00118 }; 00119 00120 /* 00121 'control_speed' and 'control_delay' are used in automatic whitebalance mode, 00122 and tell the camera how fast it should react to changes in lighting, and 00123 with how much delay. Valid values are 0..65535. 00124 */ 00125 struct pwc_wb_speed 00126 { 00127 int control_speed; 00128 int control_delay; 00129 00130 }; 00131 00132 /* Used with VIDIOCPWC[SG]LED */ 00133 struct pwc_leds 00134 { 00135 int led_on; /* Led on-time; range = 0..25000 */ 00136 int led_off; /* Led off-time; range = 0..25000 */ 00137 }; 00138 00139 /* Image size (used with GREALSIZE) */ 00140 struct pwc_imagesize 00141 { 00142 int width; 00143 int height; 00144 }; 00145 00146 /* Defines and structures for Motorized Pan & Tilt */ 00147 #define PWC_MPT_PAN 0x01 00148 #define PWC_MPT_TILT 0x02 00149 #define PWC_MPT_TIMEOUT 0x04 /* for status */ 00150 00151 /* Set angles; when absolute != 0, the angle is absolute and the 00152 driver calculates the relative offset for you. This can only 00153 be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns 00154 absolute angles. 00155 */ 00156 struct pwc_mpt_angles 00157 { 00158 int absolute; /* write-only */ 00159 int pan; /* degrees * 100 */ 00160 int tilt; /* degress * 100 */ 00161 }; 00162 00163 /* Range of angles of the camera, both horizontally and vertically. 00164 */ 00165 struct pwc_mpt_range 00166 { 00167 int pan_min, pan_max; /* degrees * 100 */ 00168 int tilt_min, tilt_max; 00169 }; 00170 00171 struct pwc_mpt_status 00172 { 00173 int status; 00174 int time_pan; 00175 int time_tilt; 00176 }; 00177 00178 00179 /* This is used for out-of-kernel decompression. With it, you can get 00180 all the necessary information to initialize and use the decompressor 00181 routines in standalone applications. 00182 */ 00183 struct pwc_video_command 00184 { 00185 int type; /* camera type (645, 675, 730, etc.) */ 00186 int release; /* release number */ 00187 00188 int size; /* one of PSZ_* */ 00189 int alternate; 00190 int command_len; /* length of USB video command */ 00191 unsigned char command_buf[13]; /* Actual USB video command */ 00192 int bandlength; /* >0 = compressed */ 00193 int frame_size; /* Size of one (un)compressed frame */ 00194 }; 00195 00196 /* Flags for PWCX subroutines. Not all modules honour all flags. */ 00197 #define PWCX_FLAG_PLANAR 0x0001 00198 #define PWCX_FLAG_BAYER 0x0008 00199 00200 00201 /* IOCTL definitions */ 00202 00203 /* Restore user settings */ 00204 #define VIDIOCPWCRUSER _IO('v', 192) 00205 /* Save user settings */ 00206 #define VIDIOCPWCSUSER _IO('v', 193) 00207 /* Restore factory settings */ 00208 #define VIDIOCPWCFACTORY _IO('v', 194) 00209 00210 /* You can manipulate the compression factor. A compression preference of 0 00211 means use uncompressed modes when available; 1 is low compression, 2 is 00212 medium and 3 is high compression preferred. Of course, the higher the 00213 compression, the lower the bandwidth used but more chance of artefacts 00214 in the image. The driver automatically chooses a higher compression when 00215 the preferred mode is not available. 00216 */ 00217 /* Set preferred compression quality (0 = uncompressed, 3 = highest compression) */ 00218 #define VIDIOCPWCSCQUAL _IOW('v', 195, int) 00219 /* Get preferred compression quality */ 00220 #define VIDIOCPWCGCQUAL _IOR('v', 195, int) 00221 00222 00223 /* Retrieve serial number of camera */ 00224 #define VIDIOCPWCGSERIAL _IOR('v', 198, struct pwc_serial) 00225 00226 /* This is a probe function; since so many devices are supported, it 00227 becomes difficult to include all the names in programs that want to 00228 check for the enhanced Philips stuff. So in stead, try this PROBE; 00229 it returns a structure with the original name, and the corresponding 00230 Philips type. 00231 To use, fill the structure with zeroes, call PROBE and if that succeeds, 00232 compare the name with that returned from VIDIOCGCAP; they should be the 00233 same. If so, you can be assured it is a Philips (OEM) cam and the type 00234 is valid. 00235 */ 00236 #define VIDIOCPWCPROBE _IOR('v', 199, struct pwc_probe) 00237 00238 /* Set AGC (Automatic Gain Control); int < 0 = auto, 0..65535 = fixed */ 00239 #define VIDIOCPWCSAGC _IOW('v', 200, int) 00240 /* Get AGC; int < 0 = auto; >= 0 = fixed, range 0..65535 */ 00241 #define VIDIOCPWCGAGC _IOR('v', 200, int) 00242 /* Set shutter speed; int < 0 = auto; >= 0 = fixed, range 0..65535 */ 00243 #define VIDIOCPWCSSHUTTER _IOW('v', 201, int) 00244 00245 /* Color compensation (Auto White Balance) */ 00246 #define VIDIOCPWCSAWB _IOW('v', 202, struct pwc_whitebalance) 00247 #define VIDIOCPWCGAWB _IOR('v', 202, struct pwc_whitebalance) 00248 00249 /* Auto WB speed */ 00250 #define VIDIOCPWCSAWBSPEED _IOW('v', 203, struct pwc_wb_speed) 00251 #define VIDIOCPWCGAWBSPEED _IOR('v', 203, struct pwc_wb_speed) 00252 00253 /* LEDs on/off/blink; int range 0..65535 */ 00254 #define VIDIOCPWCSLED _IOW('v', 205, struct pwc_leds) 00255 #define VIDIOCPWCGLED _IOR('v', 205, struct pwc_leds) 00256 00257 /* Contour (sharpness); int < 0 = auto, 0..65536 = fixed */ 00258 #define VIDIOCPWCSCONTOUR _IOW('v', 206, int) 00259 #define VIDIOCPWCGCONTOUR _IOR('v', 206, int) 00260 00261 /* Backlight compensation; 0 = off, otherwise on */ 00262 #define VIDIOCPWCSBACKLIGHT _IOW('v', 207, int) 00263 #define VIDIOCPWCGBACKLIGHT _IOR('v', 207, int) 00264 00265 /* Flickerless mode; = 0 off, otherwise on */ 00266 #define VIDIOCPWCSFLICKER _IOW('v', 208, int) 00267 #define VIDIOCPWCGFLICKER _IOR('v', 208, int) 00268 00269 /* Dynamic noise reduction; 0 off, 3 = high noise reduction */ 00270 #define VIDIOCPWCSDYNNOISE _IOW('v', 209, int) 00271 #define VIDIOCPWCGDYNNOISE _IOR('v', 209, int) 00272 00273 /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */ 00274 #define VIDIOCPWCGREALSIZE _IOR('v', 210, struct pwc_imagesize) 00275 00276 /* Motorized pan & tilt functions */ 00277 #define VIDIOCPWCMPTRESET _IOW('v', 211, int) 00278 #define VIDIOCPWCMPTGRANGE _IOR('v', 211, struct pwc_mpt_range) 00279 #define VIDIOCPWCMPTSANGLE _IOW('v', 212, struct pwc_mpt_angles) 00280 #define VIDIOCPWCMPTGANGLE _IOR('v', 212, struct pwc_mpt_angles) 00281 #define VIDIOCPWCMPTSTATUS _IOR('v', 213, struct pwc_mpt_status) 00282 00283 /* Get the USB set-video command; needed for initializing libpwcx */ 00284 #define VIDIOCPWCGVIDCMD _IOR('v', 215, struct pwc_video_command) 00285 struct pwc_table_init_buffer { 00286 int len; 00287 char *buffer; 00288 00289 }; 00290 #define VIDIOCPWCGVIDTABLE _IOR('v', 216, struct pwc_table_init_buffer) 00291 00292 #endif