VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / drivers / usb / media / pwc-ioctl.h
1 #ifndef PWC_IOCTL_H
2 #define PWC_IOCTL_H
3
4 /* (C) 2001-2004 Nemosoft Unv.    webcam@smcc.demon.nl
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21 /* This is pwc-ioctl.h belonging to PWC 8.12.1
22    It contains structures and defines to communicate from user space
23    directly to the driver.
24  */
25
26 /*
27    Changes
28    2001/08/03  Alvarado   Added ioctl constants to access methods for
29                           changing white balance and red/blue gains
30    2002/12/15  G. H. Fernandez-Toribio   VIDIOCGREALSIZE
31    2003/12/13  Nemosft Unv. Some modifications to make interfacing to
32                PWCX easier
33  */
34
35 /* These are private ioctl() commands, specific for the Philips webcams.
36    They contain functions not found in other webcams, and settings not
37    specified in the Video4Linux API.
38
39    The #define names are built up like follows:
40    VIDIOC               VIDeo IOCtl prefix
41          PWC            Philps WebCam
42             G           optional: Get
43             S           optional: Set
44              ...        the function
45  */
46
47
48  /* Enumeration of image sizes */
49 #define PSZ_SQCIF       0x00
50 #define PSZ_QSIF        0x01
51 #define PSZ_QCIF        0x02
52 #define PSZ_SIF         0x03
53 #define PSZ_CIF         0x04
54 #define PSZ_VGA         0x05
55 #define PSZ_MAX         6
56
57
58 /* The frame rate is encoded in the video_window.flags parameter using
59    the upper 16 bits, since some flags are defined nowadays. The following
60    defines provide a mask and shift to filter out this value.
61
62    In 'Snapshot' mode the camera freezes its automatic exposure and colour
63    balance controls.
64  */
65 #define PWC_FPS_SHIFT           16
66 #define PWC_FPS_MASK            0x00FF0000
67 #define PWC_FPS_FRMASK          0x003F0000
68 #define PWC_FPS_SNAPSHOT        0x00400000
69
70
71 /* structure for transfering x & y coordinates */
72 struct pwc_coord
73 {
74         int x, y;               /* guess what */
75         int size;               /* size, or offset */
76 };
77
78
79 /* Used with VIDIOCPWCPROBE */
80 struct pwc_probe
81 {
82         char name[32];
83         int type;
84 };
85
86 struct pwc_serial
87 {
88         char serial[30];        /* String with serial number. Contains terminating 0 */
89 };
90         
91 /* pwc_whitebalance.mode values */
92 #define PWC_WB_INDOOR           0
93 #define PWC_WB_OUTDOOR          1
94 #define PWC_WB_FL               2
95 #define PWC_WB_MANUAL           3
96 #define PWC_WB_AUTO             4
97
98 /* Used with VIDIOCPWC[SG]AWB (Auto White Balance). 
99    Set mode to one of the PWC_WB_* values above.
100    *red and *blue are the respective gains of these colour components inside 
101    the camera; range 0..65535
102    When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read; 
103    otherwise undefined.
104    'read_red' and 'read_blue' are read-only.
105 */   
106 struct pwc_whitebalance
107 {
108         int mode;
109         int manual_red, manual_blue;    /* R/W */
110         int read_red, read_blue;        /* R/O */
111 };
112
113 /* 
114    'control_speed' and 'control_delay' are used in automatic whitebalance mode,
115    and tell the camera how fast it should react to changes in lighting, and 
116    with how much delay. Valid values are 0..65535.
117 */
118 struct pwc_wb_speed
119 {
120         int control_speed;
121         int control_delay;
122
123 };
124
125 /* Used with VIDIOCPWC[SG]LED */
126 struct pwc_leds
127 {
128         int led_on;                     /* Led on-time; range = 0..25000 */
129         int led_off;                    /* Led off-time; range = 0..25000  */
130 };
131
132 /* Image size (used with GREALSIZE) */
133 struct pwc_imagesize
134 {
135         int width;
136         int height;
137 };
138
139 /* Defines and structures for Motorized Pan & Tilt */
140 #define PWC_MPT_PAN             0x01
141 #define PWC_MPT_TILT            0x02
142 #define PWC_MPT_TIMEOUT         0x04 /* for status */
143
144 /* Set angles; when absolute != 0, the angle is absolute and the 
145    driver calculates the relative offset for you. This can only
146    be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns
147    absolute angles.
148  */   
149 struct pwc_mpt_angles
150 {
151         int absolute;           /* write-only */
152         int pan;                /* degrees * 100 */
153         int tilt;               /* degress * 100 */
154 };
155
156 /* Range of angles of the camera, both horizontally and vertically.
157  */
158 struct pwc_mpt_range
159 {
160         int pan_min, pan_max;           /* degrees * 100 */
161         int tilt_min, tilt_max;
162 };
163
164 struct pwc_mpt_status
165 {
166         int status;
167         int time_pan;
168         int time_tilt;
169 };
170
171
172 /* This is used for out-of-kernel decompression. With it, you can get
173    all the necessary information to initialize and use the decompressor
174    routines in standalone applications.
175  */   
176 struct pwc_video_command
177 {
178         int type;               /* camera type (645, 675, 730, etc.) */
179         int release;            /* release number */
180
181         int size;               /* one of PSZ_* */
182         int alternate;
183         int command_len;        /* length of USB video command */
184         unsigned char command_buf[13];  /* Actual USB video command */
185         int bandlength;         /* >0 = compressed */
186         int frame_size;         /* Size of one (un)compressed frame */
187 };
188
189 /* Flags for PWCX subroutines. Not all modules honour all flags. */
190 #define PWCX_FLAG_PLANAR        0x0001
191 #define PWCX_FLAG_BAYER         0x0008
192
193
194 /* IOCTL definitions */
195
196  /* Restore user settings */
197 #define VIDIOCPWCRUSER          _IO('v', 192)
198  /* Save user settings */
199 #define VIDIOCPWCSUSER          _IO('v', 193)
200  /* Restore factory settings */
201 #define VIDIOCPWCFACTORY        _IO('v', 194)
202
203  /* You can manipulate the compression factor. A compression preference of 0
204     means use uncompressed modes when available; 1 is low compression, 2 is
205     medium and 3 is high compression preferred. Of course, the higher the
206     compression, the lower the bandwidth used but more chance of artefacts
207     in the image. The driver automatically chooses a higher compression when
208     the preferred mode is not available.
209   */
210  /* Set preferred compression quality (0 = uncompressed, 3 = highest compression) */
211 #define VIDIOCPWCSCQUAL         _IOW('v', 195, int)
212  /* Get preferred compression quality */
213 #define VIDIOCPWCGCQUAL         _IOR('v', 195, int)
214
215
216 /* Retrieve serial number of camera */
217 #define VIDIOCPWCGSERIAL        _IOR('v', 198, struct pwc_serial)
218
219  /* This is a probe function; since so many devices are supported, it
220     becomes difficult to include all the names in programs that want to
221     check for the enhanced Philips stuff. So in stead, try this PROBE;
222     it returns a structure with the original name, and the corresponding
223     Philips type.
224     To use, fill the structure with zeroes, call PROBE and if that succeeds,
225     compare the name with that returned from VIDIOCGCAP; they should be the
226     same. If so, you can be assured it is a Philips (OEM) cam and the type
227     is valid.
228  */
229 #define VIDIOCPWCPROBE          _IOR('v', 199, struct pwc_probe)
230
231  /* Set AGC (Automatic Gain Control); int < 0 = auto, 0..65535 = fixed */
232 #define VIDIOCPWCSAGC           _IOW('v', 200, int)
233  /* Get AGC; int < 0 = auto; >= 0 = fixed, range 0..65535 */
234 #define VIDIOCPWCGAGC           _IOR('v', 200, int)
235  /* Set shutter speed; int < 0 = auto; >= 0 = fixed, range 0..65535 */
236 #define VIDIOCPWCSSHUTTER       _IOW('v', 201, int)
237
238  /* Color compensation (Auto White Balance) */
239 #define VIDIOCPWCSAWB           _IOW('v', 202, struct pwc_whitebalance)
240 #define VIDIOCPWCGAWB           _IOR('v', 202, struct pwc_whitebalance)
241
242  /* Auto WB speed */
243 #define VIDIOCPWCSAWBSPEED      _IOW('v', 203, struct pwc_wb_speed)
244 #define VIDIOCPWCGAWBSPEED      _IOR('v', 203, struct pwc_wb_speed)
245
246  /* LEDs on/off/blink; int range 0..65535 */
247 #define VIDIOCPWCSLED           _IOW('v', 205, struct pwc_leds)
248 #define VIDIOCPWCGLED           _IOR('v', 205, struct pwc_leds)
249
250   /* Contour (sharpness); int < 0 = auto, 0..65536 = fixed */
251 #define VIDIOCPWCSCONTOUR       _IOW('v', 206, int)
252 #define VIDIOCPWCGCONTOUR       _IOR('v', 206, int)
253
254   /* Backlight compensation; 0 = off, otherwise on */
255 #define VIDIOCPWCSBACKLIGHT     _IOW('v', 207, int)
256 #define VIDIOCPWCGBACKLIGHT     _IOR('v', 207, int)
257
258   /* Flickerless mode; = 0 off, otherwise on */
259 #define VIDIOCPWCSFLICKER       _IOW('v', 208, int)
260 #define VIDIOCPWCGFLICKER       _IOR('v', 208, int)  
261
262   /* Dynamic noise reduction; 0 off, 3 = high noise reduction */
263 #define VIDIOCPWCSDYNNOISE      _IOW('v', 209, int)
264 #define VIDIOCPWCGDYNNOISE      _IOR('v', 209, int)
265
266  /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */
267 #define VIDIOCPWCGREALSIZE      _IOR('v', 210, struct pwc_imagesize)
268
269  /* Motorized pan & tilt functions */ 
270 #define VIDIOCPWCMPTRESET       _IOW('v', 211, int)
271 #define VIDIOCPWCMPTGRANGE      _IOR('v', 211, struct pwc_mpt_range)
272 #define VIDIOCPWCMPTSANGLE      _IOW('v', 212, struct pwc_mpt_angles)
273 #define VIDIOCPWCMPTGANGLE      _IOR('v', 212, struct pwc_mpt_angles)
274 #define VIDIOCPWCMPTSTATUS      _IOR('v', 213, struct pwc_mpt_status)
275
276  /* Get the USB set-video command; needed for initializing libpwcx */
277 #define VIDIOCPWCGVIDCMD        _IOR('v', 215, struct pwc_video_command)
278
279 #endif