4 /* (C) 2001-2004 Nemosoft Unv.
5 (C) 2004 Luc Saillard (luc@saillard.org)
7 NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx
8 driver and thus may have bugs that are not present in the original version.
9 Please send bug reports and support requests to <luc@saillard.org>.
10 The decompression routines have been implemented by reverse-engineering the
11 Nemosoft binary pwcx module. Caveat emptor.
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 /* This is pwc-ioctl.h belonging to PWC 8.12.1
29 It contains structures and defines to communicate from user space
30 directly to the driver.
35 2001/08/03 Alvarado Added ioctl constants to access methods for
36 changing white balance and red/blue gains
37 2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE
38 2003/12/13 Nemosft Unv. Some modifications to make interfacing to
42 /* These are private ioctl() commands, specific for the Philips webcams.
43 They contain functions not found in other webcams, and settings not
44 specified in the Video4Linux API.
46 The #define names are built up like follows:
47 VIDIOC VIDeo IOCtl prefix
55 /* Enumeration of image sizes */
56 #define PSZ_SQCIF 0x00
65 /* The frame rate is encoded in the video_window.flags parameter using
66 the upper 16 bits, since some flags are defined nowadays. The following
67 defines provide a mask and shift to filter out this value.
69 In 'Snapshot' mode the camera freezes its automatic exposure and colour
72 #define PWC_FPS_SHIFT 16
73 #define PWC_FPS_MASK 0x00FF0000
74 #define PWC_FPS_FRMASK 0x003F0000
75 #define PWC_FPS_SNAPSHOT 0x00400000
78 /* structure for transferring x & y coordinates */
81 int x
, y
; /* guess what */
82 int size
; /* size, or offset */
86 /* Used with VIDIOCPWCPROBE */
95 char serial
[30]; /* String with serial number. Contains terminating 0 */
98 /* pwc_whitebalance.mode values */
99 #define PWC_WB_INDOOR 0
100 #define PWC_WB_OUTDOOR 1
102 #define PWC_WB_MANUAL 3
103 #define PWC_WB_AUTO 4
105 /* Used with VIDIOCPWC[SG]AWB (Auto White Balance).
106 Set mode to one of the PWC_WB_* values above.
107 *red and *blue are the respective gains of these colour components inside
108 the camera; range 0..65535
109 When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read;
111 'read_red' and 'read_blue' are read-only.
113 struct pwc_whitebalance
116 int manual_red
, manual_blue
; /* R/W */
117 int read_red
, read_blue
; /* R/O */
121 'control_speed' and 'control_delay' are used in automatic whitebalance mode,
122 and tell the camera how fast it should react to changes in lighting, and
123 with how much delay. Valid values are 0..65535.
132 /* Used with VIDIOCPWC[SG]LED */
135 int led_on
; /* Led on-time; range = 0..25000 */
136 int led_off
; /* Led off-time; range = 0..25000 */
139 /* Image size (used with GREALSIZE) */
146 /* Defines and structures for Motorized Pan & Tilt */
147 #define PWC_MPT_PAN 0x01
148 #define PWC_MPT_TILT 0x02
149 #define PWC_MPT_TIMEOUT 0x04 /* for status */
151 /* Set angles; when absolute != 0, the angle is absolute and the
152 driver calculates the relative offset for you. This can only
153 be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns
156 struct pwc_mpt_angles
158 int absolute
; /* write-only */
159 int pan
; /* degrees * 100 */
160 int tilt
; /* degress * 100 */
163 /* Range of angles of the camera, both horizontally and vertically.
167 int pan_min
, pan_max
; /* degrees * 100 */
168 int tilt_min
, tilt_max
;
171 struct pwc_mpt_status
179 /* This is used for out-of-kernel decompression. With it, you can get
180 all the necessary information to initialize and use the decompressor
181 routines in standalone applications.
183 struct pwc_video_command
185 int type
; /* camera type (645, 675, 730, etc.) */
186 int release
; /* release number */
188 int size
; /* one of PSZ_* */
190 int command_len
; /* length of USB video command */
191 unsigned char command_buf
[13]; /* Actual USB video command */
192 int bandlength
; /* >0 = compressed */
193 int frame_size
; /* Size of one (un)compressed frame */
196 /* Flags for PWCX subroutines. Not all modules honour all flags. */
197 #define PWCX_FLAG_PLANAR 0x0001
198 #define PWCX_FLAG_BAYER 0x0008
201 /* IOCTL definitions */
203 /* Restore user settings */
204 #define VIDIOCPWCRUSER _IO('v', 192)
205 /* Save user settings */
206 #define VIDIOCPWCSUSER _IO('v', 193)
207 /* Restore factory settings */
208 #define VIDIOCPWCFACTORY _IO('v', 194)
210 /* You can manipulate the compression factor. A compression preference of 0
211 means use uncompressed modes when available; 1 is low compression, 2 is
212 medium and 3 is high compression preferred. Of course, the higher the
213 compression, the lower the bandwidth used but more chance of artefacts
214 in the image. The driver automatically chooses a higher compression when
215 the preferred mode is not available.
217 /* Set preferred compression quality (0 = uncompressed, 3 = highest compression) */
218 #define VIDIOCPWCSCQUAL _IOW('v', 195, int)
219 /* Get preferred compression quality */
220 #define VIDIOCPWCGCQUAL _IOR('v', 195, int)
223 /* Retrieve serial number of camera */
224 #define VIDIOCPWCGSERIAL _IOR('v', 198, struct pwc_serial)
226 /* This is a probe function; since so many devices are supported, it
227 becomes difficult to include all the names in programs that want to
228 check for the enhanced Philips stuff. So in stead, try this PROBE;
229 it returns a structure with the original name, and the corresponding
231 To use, fill the structure with zeroes, call PROBE and if that succeeds,
232 compare the name with that returned from VIDIOCGCAP; they should be the
233 same. If so, you can be assured it is a Philips (OEM) cam and the type
236 #define VIDIOCPWCPROBE _IOR('v', 199, struct pwc_probe)
238 /* Set AGC (Automatic Gain Control); int < 0 = auto, 0..65535 = fixed */
239 #define VIDIOCPWCSAGC _IOW('v', 200, int)
240 /* Get AGC; int < 0 = auto; >= 0 = fixed, range 0..65535 */
241 #define VIDIOCPWCGAGC _IOR('v', 200, int)
242 /* Set shutter speed; int < 0 = auto; >= 0 = fixed, range 0..65535 */
243 #define VIDIOCPWCSSHUTTER _IOW('v', 201, int)
245 /* Color compensation (Auto White Balance) */
246 #define VIDIOCPWCSAWB _IOW('v', 202, struct pwc_whitebalance)
247 #define VIDIOCPWCGAWB _IOR('v', 202, struct pwc_whitebalance)
250 #define VIDIOCPWCSAWBSPEED _IOW('v', 203, struct pwc_wb_speed)
251 #define VIDIOCPWCGAWBSPEED _IOR('v', 203, struct pwc_wb_speed)
253 /* LEDs on/off/blink; int range 0..65535 */
254 #define VIDIOCPWCSLED _IOW('v', 205, struct pwc_leds)
255 #define VIDIOCPWCGLED _IOR('v', 205, struct pwc_leds)
257 /* Contour (sharpness); int < 0 = auto, 0..65536 = fixed */
258 #define VIDIOCPWCSCONTOUR _IOW('v', 206, int)
259 #define VIDIOCPWCGCONTOUR _IOR('v', 206, int)
261 /* Backlight compensation; 0 = off, otherwise on */
262 #define VIDIOCPWCSBACKLIGHT _IOW('v', 207, int)
263 #define VIDIOCPWCGBACKLIGHT _IOR('v', 207, int)
265 /* Flickerless mode; = 0 off, otherwise on */
266 #define VIDIOCPWCSFLICKER _IOW('v', 208, int)
267 #define VIDIOCPWCGFLICKER _IOR('v', 208, int)
269 /* Dynamic noise reduction; 0 off, 3 = high noise reduction */
270 #define VIDIOCPWCSDYNNOISE _IOW('v', 209, int)
271 #define VIDIOCPWCGDYNNOISE _IOR('v', 209, int)
273 /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */
274 #define VIDIOCPWCGREALSIZE _IOR('v', 210, struct pwc_imagesize)
276 /* Motorized pan & tilt functions */
277 #define VIDIOCPWCMPTRESET _IOW('v', 211, int)
278 #define VIDIOCPWCMPTGRANGE _IOR('v', 211, struct pwc_mpt_range)
279 #define VIDIOCPWCMPTSANGLE _IOW('v', 212, struct pwc_mpt_angles)
280 #define VIDIOCPWCMPTGANGLE _IOR('v', 212, struct pwc_mpt_angles)
281 #define VIDIOCPWCMPTSTATUS _IOR('v', 213, struct pwc_mpt_status)
283 /* Get the USB set-video command; needed for initializing libpwcx */
284 #define VIDIOCPWCGVIDCMD _IOR('v', 215, struct pwc_video_command)
285 struct pwc_table_init_buffer
{
290 #define VIDIOCPWCGVIDTABLE _IOR('v', 216, struct pwc_table_init_buffer)