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