]> git.pld-linux.org Git - packages/kernel.git/blame - 2.6.7-pwcx.patch
- obsolete
[packages/kernel.git] / 2.6.7-pwcx.patch
CommitLineData
d6076f02 1diff -Nur linux-2.6.7-rc3.org/drivers/usb/media/Kconfig linux-2.6.7-rc3/drivers/usb/media/Kconfig
2--- linux-2.6.7-rc3.org/drivers/usb/media/Kconfig 2004-06-09 09:31:57.000000000 +0200
3+++ linux-2.6.7-rc3/drivers/usb/media/Kconfig 2004-06-09 09:38:59.000000000 +0200
4@@ -146,6 +146,10 @@
5 To compile this driver as a module, choose M here: the
6 module will be called pwc.
7
8+config USB_PWCX
9+ tristate "PWCX decompressor module"
10+ depends on USB_PWC
11+
12 config USB_SE401
13 tristate "USB SE401 Camera support"
14 depends on USB && VIDEO_DEV
15diff -Nur linux-2.6.7-rc3.org/drivers/usb/media/Makefile linux-2.6.7-rc3/drivers/usb/media/Makefile
16--- linux-2.6.7-rc3.org/drivers/usb/media/Makefile 2004-06-07 21:13:34.000000000 +0200
17+++ linux-2.6.7-rc3/drivers/usb/media/Makefile 2004-06-09 09:38:59.000000000 +0200
18@@ -3,6 +3,7 @@
19 #
20
21 pwc-objs := pwc-if.o pwc-misc.o pwc-ctrl.o pwc-uncompress.o
22+pwcx-objs := pwcx-glue.o libpwcx.a
23
24 obj-$(CONFIG_USB_DABUSB) += dabusb.o
25 obj-$(CONFIG_USB_DSBR) += dsbr100.o
26@@ -10,6 +11,7 @@
27 obj-$(CONFIG_USB_KONICAWC) += konicawc.o usbvideo.o
28 obj-$(CONFIG_USB_OV511) += ov511.o
29 obj-$(CONFIG_USB_PWC) += pwc.o
30+obj-$(CONFIG_USB_PWCX) += pwcx.o
31 obj-$(CONFIG_USB_SE401) += se401.o
32 obj-$(CONFIG_USB_STV680) += stv680.o
33 obj-$(CONFIG_USB_VICAM) += vicam.o usbvideo.o
34diff -Nur linux-2.6.7-rc3.org/drivers/usb/media/pwc-ctrl.c linux-2.6.7-rc3/drivers/usb/media/pwc-ctrl.c
35--- linux-2.6.7-rc3.org/drivers/usb/media/pwc-ctrl.c 2004-06-07 21:15:11.000000000 +0200
36+++ linux-2.6.7-rc3/drivers/usb/media/pwc-ctrl.c 2004-05-07 00:52:23.000000000 +0200
37@@ -30,6 +30,7 @@
38 #include <asm/uaccess.h>
39 #endif
40 #include <asm/errno.h>
41+#include <linux/version.h>
42
43 #include "pwc.h"
44 #include "pwc-ioctl.h"
45@@ -267,9 +268,12 @@
46 Debug("Failed to send video command... %d\n", ret);
47 return ret;
48 }
49- if (pEntry->compressed && pdev->decompressor != NULL)
50- pdev->decompressor->init(pdev->release, buf, pdev->decompress_data);
51-
52+ if (pEntry->compressed && pdev->decompressor != 0 && pdev->vpalette != VIDEO_PALETTE_RAW)
53+ pdev->decompressor->init(pdev->type, pdev->release, buf, pdev->decompress_data);
54+
55+ pdev->cmd_len = 3;
56+ memcpy(pdev->cmd_buf, buf, 3);
57+
58 /* Set various parameters */
59 pdev->vframes = frames;
60 pdev->vsize = size;
61@@ -332,9 +336,12 @@
62 if (ret < 0)
63 return ret;
64
65- if (pChoose->bandlength > 0)
66- pdev->decompressor->init(pdev->release, buf, pdev->decompress_data);
67-
68+ if (pChoose->bandlength > 0 && pdev->decompressor != 0 && pdev->vpalette != VIDEO_PALETTE_RAW)
69+ pdev->decompressor->init(pdev->type, pdev->release, buf, pdev->decompress_data);
70+
71+ pdev->cmd_len = 13;
72+ memcpy(pdev->cmd_buf, buf, 13);
73+
74 /* Set various parameters */
75 pdev->vframes = frames;
76 pdev->vsize = size;
77@@ -352,33 +359,54 @@
78
79 static inline int set_video_mode_Kiara(struct pwc_device *pdev, int size, int frames, int compression, int snapshot)
80 {
81- struct Kiara_table_entry *pChoose;
82+ struct Kiara_table_entry *pChoose = 0;
83 int fps, ret;
84 unsigned char buf[12];
85-
86+ struct Kiara_table_entry RawEntry = {6, 773, 1272, {0xAD, 0xF4, 0x10, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x03, 0x80}};
87+
88 if (size >= PSZ_MAX || frames < 5 || frames > 30 || compression < 0 || compression > 3)
89 return -EINVAL;
90 if (size == PSZ_VGA && frames > 15)
91 return -EINVAL;
92 fps = (frames / 5) - 1;
93-
94- /* Find a supported framerate with progressively higher compression ratios
95- if the preferred ratio is not available.
96- */
97- pChoose = NULL;
98- if (pdev->decompressor == NULL) {
99-#if PWC_DEBUG
100- Debug("Trying to find uncompressed mode.\n");
101-#endif
102- pChoose = &Kiara_table[size][fps][0];
103+
104+ /* special case: VGA @ 5 fps and snapshot is raw bayer mode */
105+ if (size == PSZ_VGA && frames == 5 && snapshot)
106+ {
107+ /* Only available in case the raw palette is selected or
108+ we have the decompressor available. This mode is
109+ only available in compressed form
110+ */
111+ if (pdev->vpalette == VIDEO_PALETTE_RAW || pdev->decompressor != NULL)
112+ {
113+ Info("Choosing VGA/5 BAYER mode (%d).\n", pdev->vpalette);
114+ pChoose = &RawEntry;
115+ }
116+ else
117+ {
118+ Info("VGA/5 BAYER mode _must_ have a decompressor available, or use RAW palette.\n");
119+ }
120 }
121- else {
122- while (compression <= 3) {
123- pChoose = &Kiara_table[size][fps][compression];
124- if (pChoose->alternate != 0)
125- break;
126- compression++;
127+ else
128+ {
129+ /* Find a supported framerate with progressively higher compression ratios
130+ if the preferred ratio is not available.
131+ Skip this step when using RAW modes.
132+ */
133+ if (pdev->decompressor == NULL && pdev->vpalette != VIDEO_PALETTE_RAW) {
134+#if PWC_DEBUG
135+ Debug("Trying to find uncompressed mode.\n");
136+#endif
137+ pChoose = &Kiara_table[size][fps][0];
138 }
139+ else {
140+ while (compression <= 3) {
141+ pChoose = &Kiara_table[size][fps][compression];
142+ if (pChoose->alternate != 0)
143+ break;
144+ compression++;
145+ }
146+ }
147 }
148 if (pChoose == NULL || pChoose->alternate == 0)
149 return -ENOENT; /* Not supported. */
150@@ -393,9 +421,11 @@
151 if (ret < 0)
152 return ret;
153
154- if (pChoose->bandlength > 0)
155- pdev->decompressor->init(pdev->release, buf, pdev->decompress_data);
156-
157+ if (pChoose->bandlength > 0 && pdev->decompressor != 0 && pdev->vpalette != VIDEO_PALETTE_RAW)
158+ pdev->decompressor->init(pdev->type, pdev->release, buf, pdev->decompress_data);
159+
160+ pdev->cmd_len = 12;
161+ memcpy(pdev->cmd_buf, buf, 12);
162 /* All set and go */
163 pdev->vframes = frames;
164 pdev->vsize = size;
165@@ -403,15 +433,15 @@
166 pdev->valternate = pChoose->alternate;
167 pdev->image = pwc_image_sizes[size];
168 pdev->vbandlength = pChoose->bandlength;
169- if (pChoose->bandlength > 0)
170- pdev->frame_size = (pChoose->bandlength * pdev->image.y) / 4;
171- else
172+ if (pdev->vbandlength > 0)
173+ pdev->frame_size = (pdev->vbandlength * pdev->image.y) / 4;
174+ else
175 pdev->frame_size = (pdev->image.x * pdev->image.y * 12) / 8;
176- pdev->frame_size += (pdev->frame_header_size + pdev->frame_trailer_size);
177 return 0;
178 }
179
180
181+
182 /**
183 @pdev: device structure
184 @width: viewport width
185@@ -422,14 +452,18 @@
186 */
187 int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frames, int compression, int snapshot)
188 {
189- int ret, size;
190-
191+
192+ int ret, size;
193+
194+ Trace(TRACE_FLOW, "set_video_mode(%dx%d @ %d, palette %d).\n", width, height, frames, pdev->vpalette);
195 size = pwc_decode_size(pdev, width, height);
196 if (size < 0) {
197 Debug("Could not find suitable size.\n");
198 return -ERANGE;
199 }
200- ret = -EINVAL;
201+ Debug("decode_size = %d.\n", size);
202+
203+ ret = -EINVAL;
204 switch(pdev->type) {
205 case 645:
206 case 646:
207@@ -459,6 +493,7 @@
208 }
209 pdev->view.x = width;
210 pdev->view.y = height;
211+ pdev->frame_total_size = pdev->frame_size + pdev->frame_header_size + pdev->frame_trailer_size;
212 pwc_set_image_buffer_size(pdev);
213 Trace(TRACE_SIZE, "Set viewport to %dx%d, image size is %dx%d.\n", width, height, pwc_image_sizes[size].x, pwc_image_sizes[size].y);
214 return 0;
215@@ -467,23 +502,33 @@
216
217 void pwc_set_image_buffer_size(struct pwc_device *pdev)
218 {
219- int factor, i, filler = 0;
220+ int i, factor = 0, filler = 0;
221
222- factor = 6;
223- filler = 128;
224+ /* for PALETTE_YUV420P */
225+ switch(pdev->vpalette)
226+ {
227+ case VIDEO_PALETTE_YUV420P:
228+ factor = 6;
229+ filler = 128;
230+ break;
231+ case VIDEO_PALETTE_RAW:
232+ factor = 6; /* can be uncompressed YUV420P */
233+ filler = 0;
234+ break;
235+ }
236
237 /* Set sizes in bytes */
238 pdev->image.size = pdev->image.x * pdev->image.y * factor / 4;
239 pdev->view.size = pdev->view.x * pdev->view.y * factor / 4;
240
241 /* Align offset, or you'll get some very weird results in
242- YUV420 mode... x must be multiple of 4 (to get the Y's in
243+ YUV420 mode... x must be multiple of 4 (to get the Y's in
244 place), and y even (or you'll mixup U & V). This is less of a
245 problem for YUV420P.
246 */
247 pdev->offset.x = ((pdev->view.x - pdev->image.x) / 2) & 0xFFFC;
248 pdev->offset.y = ((pdev->view.y - pdev->image.y) / 2) & 0xFFFE;
249-
250+
251 /* Fill buffers with gray or black */
252 for (i = 0; i < MAX_IMAGES; i++) {
253 if (pdev->image_ptr[i] != NULL)
254@@ -1670,19 +1594,34 @@
255
256 case VIDIOCPWCMPTSTATUS:
257 {
258- struct pwc_mpt_status *status = arg;
259-
260 if (pdev->features & FEATURE_MOTOR_PANTILT)
261 {
262- ret = pwc_mpt_get_status(pdev, status);
263+ ARG_DEF(struct pwc_mpt_status, status)
264+
265+ ret = pwc_mpt_get_status(pdev, ARGA(status));
266+ ARG_OUT(status)
267 }
268 else
269 {
270 ret = -ENXIO;
271 }
272- break;
273- }
274-
275+ break;
276+ }
277+
278+ case VIDIOCPWCGVIDCMD:
279+ {
280+ ARG_DEF(struct pwc_video_command, cmd);
281+
282+ ARGR(cmd).type = pdev->type;
283+ ARGR(cmd).release = pdev->release;
284+ ARGR(cmd).command_len = pdev->cmd_len;
285+ memcpy(&ARGR(cmd).command_buf, pdev->cmd_buf, pdev->cmd_len);
286+ ARGR(cmd).bandlength = pdev->vbandlength;
287+ ARGR(cmd).frame_size = pdev->frame_size;
288+ ARG_OUT(cmd)
289+ break;
290+ }
291+
292 default:
293 ret = -ENOIOCTLCMD;
294 break;
295diff -Nur linux-2.6.7-rc3.org/drivers/usb/media/pwc-if.c linux-2.6.7-rc3/drivers/usb/media/pwc-if.c
296--- linux-2.6.7-rc3.org/drivers/usb/media/pwc-if.c 2004-06-09 09:31:57.000000000 +0200
297+++ linux-2.6.7-rc3/drivers/usb/media/pwc-if.c 2004-05-07 00:52:23.000000000 +0200
298@@ -90,6 +90,7 @@
299 { USB_DEVICE(0x041E, 0x400C) }, /* Creative Webcam 5 */
300 { USB_DEVICE(0x041E, 0x4011) }, /* Creative Webcam Pro Ex */
301 { USB_DEVICE(0x04CC, 0x8116) }, /* Afina Eye */
302+ { USB_DEVICE(0x06BE, 0x8116) }, /* new Afina Eye */
303 { USB_DEVICE(0x0d81, 0x1910) }, /* Visionite */
304 { USB_DEVICE(0x0d81, 0x1900) },
305 { }
306@@ -129,6 +130,7 @@
307
308 static int pwc_video_open(struct inode *inode, struct file *file);
309 static int pwc_video_close(struct inode *inode, struct file *file);
310+static void pwc_video_release(struct video_device *);
311 static ssize_t pwc_video_read(struct file *file, char *buf,
312 size_t count, loff_t *ppos);
313 static unsigned int pwc_video_poll(struct file *file, poll_table *wait);
314@@ -662,8 +664,8 @@
315 pdev->vsync = 2;
316
317 /* ...copy data to frame buffer, if possible */
318- if (flen + fbuf->filled > pdev->frame_size) {
319- Trace(TRACE_FLOW, "Frame buffer overflow (flen = %d, frame_size = %d).\n", flen, pdev->frame_size);
320+ if (flen + fbuf->filled > pdev->frame_total_size) {
321+ Trace(TRACE_FLOW, "Frame buffer overflow (flen = %d, frame_total_size = %d).\n", flen, pdev->frame_total_size);
322 pdev->vsync = 0; /* Hmm, let's wait for an EOF (end-of-frame) */
323 pdev->vframes_error++;
324 }
325@@ -728,7 +730,7 @@
326 pdev->drop_frames--;
327 else {
328 /* Check for underflow first */
329- if (fbuf->filled < pdev->frame_size) {
330+ if (fbuf->filled < pdev->frame_total_size) {
331 Trace(TRACE_FLOW, "Frame buffer underflow (%d bytes); discarded.\n", fbuf->filled);
332 pdev->vframes_error++;
333 }
334@@ -788,8 +790,7 @@
335 struct urb *urb;
336 int i, j, ret;
337
338- struct usb_interface *intf;
339- struct usb_host_interface *idesc = NULL;
340+ struct usb_host_interface *idesc;
341
342 if (pdev == NULL)
343 return -EFAULT;
344@@ -801,9 +802,7 @@
345 /* Get the current alternate interface, adjust packet size */
346 if (!udev->actconfig)
347 return -EFAULT;
348- intf = usb_ifnum_to_if(udev, 0);
349- if (intf)
350- idesc = usb_altnum_to_altsetting(intf, pdev->valternate);
351+ idesc = &udev->actconfig->interface[0]->altsetting[pdev->valternate];
352 if (!idesc)
353 return -EFAULT;
354
355@@ -874,7 +873,7 @@
356 if (ret)
357 Err("isoc_init() submit_urb %d failed with error %d\n", i, ret);
358 else
359- Trace(TRACE_OPEN, "URB 0x%p submitted.\n", pdev->sbuf[i].urb);
360+ Trace(TRACE_MEMORY, "URB 0x%p submitted.\n", pdev->sbuf[i].urb);
361 }
362
363 /* All is done... */
364@@ -972,24 +971,28 @@
365 Trace(TRACE_OPEN, "Doing first time initialization.\n");
366 pdev->usb_init = 1;
367
368- if (pwc_trace & TRACE_OPEN) {
369+ if (pwc_trace & TRACE_OPEN)
370+ {
371 /* Query sensor type */
372 const char *sensor_type = NULL;
373+ int ret;
374
375- i = pwc_get_cmos_sensor(pdev);
376- switch(i) {
377- case -1: /* Unknown, show nothing */; break;
378- case 0x00: sensor_type = "Hyundai CMOS sensor"; break;
379- case 0x20: sensor_type = "Sony CCD sensor + TDA8787"; break;
380- case 0x2E: sensor_type = "Sony CCD sensor + Exas 98L59"; break;
381- case 0x2F: sensor_type = "Sony CCD sensor + ADI 9804"; break;
382- case 0x30: sensor_type = "Sharp CCD sensor + TDA8787"; break;
383- case 0x3E: sensor_type = "Sharp CCD sensor + Exas 98L59"; break;
384- case 0x3F: sensor_type = "Sharp CCD sensor + ADI 9804"; break;
385- case 0x40: sensor_type = "UPA 1021 sensor"; break;
386- case 0x100: sensor_type = "VGA sensor"; break;
387- case 0x101: sensor_type = "PAL MR sensor"; break;
388- default: sensor_type = "unknown type of sensor"; break;
389+ ret = pwc_get_cmos_sensor(pdev, &i);
390+ if (ret >= 0)
391+ {
392+ switch(i) {
393+ case 0x00: sensor_type = "Hyundai CMOS sensor"; break;
394+ case 0x20: sensor_type = "Sony CCD sensor + TDA8787"; break;
395+ case 0x2E: sensor_type = "Sony CCD sensor + Exas 98L59"; break;
396+ case 0x2F: sensor_type = "Sony CCD sensor + ADI 9804"; break;
397+ case 0x30: sensor_type = "Sharp CCD sensor + TDA8787"; break;
398+ case 0x3E: sensor_type = "Sharp CCD sensor + Exas 98L59"; break;
399+ case 0x3F: sensor_type = "Sharp CCD sensor + ADI 9804"; break;
400+ case 0x40: sensor_type = "UPA 1021 sensor"; break;
401+ case 0x100: sensor_type = "VGA sensor"; break;
402+ case 0x101: sensor_type = "PAL MR sensor"; break;
403+ default: sensor_type = "unknown type of sensor"; break;
404+ }
405 }
406 if (sensor_type != NULL)
407 Info("This %s camera is equipped with a %s (%d).\n", pdev->vdev.name, sensor_type, i);
408@@ -1120,6 +1124,12 @@
409 return 0;
410 }
411
412+static void pwc_video_release(struct video_device *vfd)
413+{
414+ Trace(TRACE_OPEN, "pwc_video_release() called. Nothing to do here. Honestly.\n");
415+}
416+
417+
418 /*
419 * FIXME: what about two parallel reads ????
420 * ANSWER: Not supported. You can't open the device more than once,
421@@ -1139,6 +1149,7 @@
422 struct pwc_device *pdev;
423 int noblock = file->f_flags & O_NONBLOCK;
424 DECLARE_WAITQUEUE(wait, current);
425+ int bytes_to_read;
426
427 Trace(TRACE_READ, "video_read(0x%p, %p, %d) called.\n", vdev, buf, count);
428 if (vdev == NULL)
429@@ -1175,20 +1186,25 @@
430 }
431 remove_wait_queue(&pdev->frameq, &wait);
432 set_current_state(TASK_RUNNING);
433-
434+
435 /* Decompress and release frame */
436 if (pwc_handle_frame(pdev))
437 return -EFAULT;
438 }
439
440 Trace(TRACE_READ, "Copying data to user space.\n");
441+ if (pdev->vpalette == VIDEO_PALETTE_RAW)
442+ bytes_to_read = pdev->frame_size;
443+ else
444+ bytes_to_read = pdev->view.size;
445+
446 /* copy bytes to user space; we allow for partial reads */
447- if (count + pdev->image_read_pos > pdev->view.size)
448- count = pdev->view.size - pdev->image_read_pos;
449+ if (count + pdev->image_read_pos > bytes_to_read)
450+ count = bytes_to_read - pdev->image_read_pos;
451 if (copy_to_user(buf, pdev->image_ptr[pdev->fill_image] + pdev->image_read_pos, count))
452 return -EFAULT;
453 pdev->image_read_pos += count;
454- if (pdev->image_read_pos >= pdev->view.size) { /* All data has been read */
455+ if (pdev->image_read_pos >= bytes_to_read) { /* All data has been read */
456 pdev->image_read_pos = 0;
457 pwc_next_image(pdev);
458 }
459@@ -1278,8 +1294,6 @@
460 struct video_picture *p = arg;
461 int val;
462
463- p->colour = 0x8000;
464- p->hue = 0x8000;
465 val = pwc_get_brightness(pdev);
466 if (val >= 0)
467 p->brightness = val;
468@@ -1302,11 +1316,11 @@
469 else
470 p->colour = 0xffff;
471 p->depth = 24;
472- p->palette = VIDEO_PALETTE_YUV420P;
473+ p->palette = pdev->vpalette;
474 p->hue = 0xFFFF; /* N/A */
475 break;
476 }
477-
478+
479 case VIDIOCSPICT:
480 {
481 struct video_picture *p = arg;
482@@ -1318,13 +1332,22 @@
483 is used exactly once in the uncompress
484 routine.
485 */
486- if (p->palette && p->palette != VIDEO_PALETTE_YUV420P) {
487- return -EINVAL;
488- }
489 pwc_set_brightness(pdev, p->brightness);
490 pwc_set_contrast(pdev, p->contrast);
491 pwc_set_gamma(pdev, p->whiteness);
492 pwc_set_saturation(pdev, p->colour);
493+ if (p->palette && p->palette != pdev->vpalette) {
494+ switch (p->palette) {
495+ case VIDEO_PALETTE_YUV420P:
496+ case VIDEO_PALETTE_RAW:
497+ pdev->vpalette = p->palette;
498+ return pwc_try_video_mode(pdev, pdev->image.x, pdev->image.y, pdev->vframes, pdev->vcompression, pdev->vsnapshot);
499+ break;
500+ default:
501+ return -EINVAL;
502+ break;
503+ }
504+ }
505 break;
506 }
507
508@@ -1398,13 +1421,23 @@
509 various palettes... The driver doesn't support
510 such small images, so I'm working around it.
511 */
512- if (vm->format && vm->format != VIDEO_PALETTE_YUV420P)
513- return -EINVAL;
514-
515+ if (vm->format)
516+ {
517+ switch (vm->format)
518+ {
519+ case VIDEO_PALETTE_YUV420P:
520+ case VIDEO_PALETTE_RAW:
521+ break;
522+ default:
523+ return -EINVAL;
524+ break;
525+ }
526+ }
527+
528 if ((vm->width != pdev->view.x || vm->height != pdev->view.y) &&
529 (vm->width >= pdev->view_min.x && vm->height >= pdev->view_min.y)) {
530 int ret;
531-
532+
533 Trace(TRACE_OPEN, "VIDIOCMCAPTURE: changing size to please xawtv :-(.\n");
534 ret = pwc_try_video_mode(pdev, vm->width, vm->height, pdev->vframes, pdev->vcompression, pdev->vsnapshot);
535 if (ret)
536@@ -1636,12 +1669,12 @@
537 type_id = 690;
538 break;
539 case 0x0310:
540- Info("Philips PCVC730K (ToUCam Fun) USB webcam detected.\n");
541+ Info("Philips PCVC730K (ToUCam Fun)/PCVC830 (ToUCam II) USB webcam detected.\n");
542 name = "Philips 730 webcam";
543 type_id = 730;
544 break;
545 case 0x0311:
546- Info("Philips PCVC740K (ToUCam Pro) USB webcam detected.\n");
547+ Info("Philips PCVC740K (ToUCam Pro)/PCVC840 (ToUCam II) USB webcam detected.\n");
548 name = "Philips 740 webcam";
549 type_id = 740;
550 break;
551@@ -1755,17 +1788,44 @@
552 break;
553 }
554 }
555- else if (vendor_id == 0x04cc) {
556+ else if (vendor_id == 0x04cc) {
557 switch(product_id) {
558 case 0x8116:
559 Info("Sotec Afina Eye USB webcam detected.\n");
560 name = "Sotec Afina Eye";
561 type_id = 730;
562- break;
563+ break;
564+ default:
565+ return -ENODEV;
566+ break;
567+ }
568+ }
569+ else if (vendor_id == 0x06be) {
570+ switch(product_id) {
571+ case 0x8116:
572+ /* Basicly the same as the Sotec Afina Eye */
573+ Info("AME CU-001 USB webcam detected.\n");
574+ name = "AME CU-001";
575+ type_id = 730;
576+ break;
577+ default:
578+ return -ENODEV;
579+ break;
580+ }
581+ }
582+ else if (vendor_id == 0x06be) {
583+ switch(product_id) {
584+ case 0x8116:
585+ /* This is essentially the same cam as the Sotec Afina Eye */
586+ Info("AME Co. Afina Eye USB webcam detected.\n");
587+ name = "AME Co. Afina Eye";
588+ type_id = 750;
589+ break;
590 default:
591 return -ENODEV;
592 break;
593 }
594+
595 }
596 else if (vendor_id == 0x0d81) {
597 switch(product_id) {
598@@ -1815,8 +1875,6 @@
599 pdev->angle_range.pan_max = 7000;
600 pdev->angle_range.tilt_min = -3000;
601 pdev->angle_range.tilt_max = 2500;
602- pdev->angle_range.zoom_min = -1;
603- pdev->angle_range.zoom_max = -1;
604 }
605
606 init_MUTEX(&pdev->modlock);
607@@ -1848,7 +1906,7 @@
608 }
609 }
610
611- pdev->vdev.release = video_device_release;
612+ pdev->vdev.release = pwc_video_release;
613 i = video_register_device(&pdev->vdev, VFL_TYPE_GRABBER, video_nr);
614 if (i < 0) {
615 Err("Failed to register as video device (%d).\n", i);
616@@ -1971,7 +2029,7 @@
617 MODULE_PARM_DESC(dev_hint, "Device node hints");
618
619 MODULE_DESCRIPTION("Philips & OEM USB webcam driver");
620-MODULE_AUTHOR("Nemosoft Unv. <nemosoft@smcc.demon.nl>");
621+MODULE_AUTHOR("Nemosoft Unv. <webcam@smcc.demon.nl>");
622 MODULE_LICENSE("GPL");
623
624 static int __init usb_pwc_init(void)
625@@ -1979,9 +2037,10 @@
626 int i, sz;
627 char *sizenames[PSZ_MAX] = { "sqcif", "qsif", "qcif", "sif", "cif", "vga" };
628
629- Info("Philips PCA645/646 + PCVC675/680/690 + PCVC730/740/750 webcam module version " PWC_VERSION " loaded.\n");
630- Info("Also supports the Askey VC010, various Logitech QuickCams, Samsung MPC-C10 and MPC-C30,\n");
631- Info("the Creative WebCam 5, SOTEC Afina Eye and Visionite VCS-UC300 and VCS-UM100.\n");
632+ Info("Philips webcam module version " PWC_VERSION " loaded.\n");
633+ Info("Supports Philips PCA645/646, PCVC675/680/690, PCVC720[40]/730/740/750 & PCVC830/840.\n");
634+ Info("Also supports the Askey VC010, various Logitech Quickcams, Samsung MPC-C10 and MPC-C30,\n");
635+ Info("the Creative WebCam 5 & Pro Ex, SOTEC Afina Eye and Visionite VCS-UC300 and VCS-UM100.\n");
636
637 if (fps) {
638 if (fps < 4 || fps > 30) {
639diff -Nur linux-2.6.7-rc3.org/drivers/usb/media/pwc-ioctl.h linux-2.6.7-rc3/drivers/usb/media/pwc-ioctl.h
640--- linux-2.6.7-rc3.org/drivers/usb/media/pwc-ioctl.h 2004-06-07 21:14:11.000000000 +0200
641+++ linux-2.6.7-rc3/drivers/usb/media/pwc-ioctl.h 2004-05-07 00:52:23.000000000 +0200
642@@ -18,19 +18,24 @@
643 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
644 */
645
646-/* This is pwc-ioctl.h belonging to PWC 8.10 */
647+/* This is pwc-ioctl.h belonging to PWC 8.12.1
648+ It contains structures and defines to communicate from user space
649+ directly to the driver.
650+ */
651
652-/*
653+/*
654 Changes
655- 2001/08/03 Alvarado Added ioctl constants to access methods for
656+ 2001/08/03 Alvarado Added ioctl constants to access methods for
657 changing white balance and red/blue gains
658 2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE
659+ 2003/12/13 Nemosft Unv. Some modifications to make interfacing to
660+ PWCX easier
661 */
662
663 /* These are private ioctl() commands, specific for the Philips webcams.
664 They contain functions not found in other webcams, and settings not
665- specified in the Video4Linux API.
666-
667+ specified in the Video4Linux API.
668+
669 The #define names are built up like follows:
670 VIDIOC VIDeo IOCtl prefix
671 PWC Philps WebCam
672@@ -40,13 +45,21 @@
673 */
674
675
676+ /* Enumeration of image sizes */
677+#define PSZ_SQCIF 0x00
678+#define PSZ_QSIF 0x01
679+#define PSZ_QCIF 0x02
680+#define PSZ_SIF 0x03
681+#define PSZ_CIF 0x04
682+#define PSZ_VGA 0x05
683+#define PSZ_MAX 6
684
685
686 /* The frame rate is encoded in the video_window.flags parameter using
687 the upper 16 bits, since some flags are defined nowadays. The following
688 defines provide a mask and shift to filter out this value.
689-
690- In 'Snapshot' mode the camera freezes its automatic exposure and colour
691+
692+ In 'Snapshot' mode the camera freezes its automatic exposure and colour
693 balance controls.
694 */
695 #define PWC_FPS_SHIFT 16
696@@ -55,7 +68,15 @@
697 #define PWC_FPS_SNAPSHOT 0x00400000
698
699
700+/* structure for transfering x & y coordinates */
701+struct pwc_coord
702+{
703+ int x, y; /* guess what */
704+ int size; /* size, or offset */
705+};
706+
707
708+/* Used with VIDIOCPWCPROBE */
709 struct pwc_probe
710 {
711 char name[32];
712@@ -78,7 +99,6 @@
713 otherwise undefined.
714 'read_red' and 'read_blue' are read-only.
715 */
716-
717 struct pwc_whitebalance
718 {
719 int mode;
720@@ -117,7 +137,7 @@
721 #define PWC_MPT_TILT 0x02
722 #define PWC_MPT_TIMEOUT 0x04 /* for status */
723
724-/* Set angles; when absolute = 1, the angle is absolute and the
725+/* Set angles; when absolute != 0, the angle is absolute and the
726 driver calculates the relative offset for you. This can only
727 be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns
728 absolute angles.
729@@ -127,18 +147,14 @@
730 int absolute; /* write-only */
731 int pan; /* degrees * 100 */
732 int tilt; /* degress * 100 */
733- int zoom; /* N/A, set to -1 */
734 };
735
736 /* Range of angles of the camera, both horizontally and vertically.
737- The zoom is not used, maybe in the future...
738-
739 */
740 struct pwc_mpt_range
741 {
742 int pan_min, pan_max; /* degrees * 100 */
743 int tilt_min, tilt_max;
744- int zoom_min, zoom_max; /* -1, -1 */
745 };
746
747 struct pwc_mpt_status
748@@ -149,6 +165,30 @@
749 };
750
751
752+/* This is used for out-of-kernel decompression. With it, you can get
753+ all the necessary information to initialize and use the decompressor
754+ routines in standalone applications.
755+ */
756+struct pwc_video_command
757+{
758+ int type; /* camera type (645, 675, 730, etc.) */
759+ int release; /* release number */
760+
761+ int size; /* one of PSZ_* */
762+ int alternate;
763+ int command_len; /* length of USB video command */
764+ unsigned char command_buf[13]; /* Actual USB video command */
765+ int bandlength; /* >0 = compressed */
766+ int frame_size; /* Size of one (un)compressed frame */
767+};
768+
769+/* Flags for PWCX subroutines. Not all modules honour all flags. */
770+#define PWCX_FLAG_PLANAR 0x0001
771+#define PWCX_FLAG_BAYER 0x0008
772+
773+
774+/* IOCTL definitions */
775+
776 /* Restore user settings */
777 #define VIDIOCPWCRUSER _IO('v', 192)
778 /* Save user settings */
779@@ -172,13 +212,13 @@
780 /* This is a probe function; since so many devices are supported, it
781 becomes difficult to include all the names in programs that want to
782 check for the enhanced Philips stuff. So in stead, try this PROBE;
783- it returns a structure with the original name, and the corresponding
784+ it returns a structure with the original name, and the corresponding
785 Philips type.
786 To use, fill the structure with zeroes, call PROBE and if that succeeds,
787 compare the name with that returned from VIDIOCGCAP; they should be the
788 same. If so, you can be assured it is a Philips (OEM) cam and the type
789 is valid.
790- */
791+ */
792 #define VIDIOCPWCPROBE _IOR('v', 199, struct pwc_probe)
793
794 /* Set AGC (Automatic Gain Control); int < 0 = auto, 0..65535 = fixed */
795@@ -225,5 +265,8 @@
796 #define VIDIOCPWCMPTSANGLE _IOW('v', 212, struct pwc_mpt_angles)
797 #define VIDIOCPWCMPTGANGLE _IOR('v', 212, struct pwc_mpt_angles)
798 #define VIDIOCPWCMPTSTATUS _IOR('v', 213, struct pwc_mpt_status)
799-
800+
801+ /* Get the USB set-video command; needed for initializing libpwcx */
802+#define VIDIOCPWCGVIDCMD _IOR('v', 215, struct pwc_video_command)
803+
804 #endif
805diff -Nur linux-2.6.7-rc3.org/drivers/usb/media/pwc-misc.c linux-2.6.7-rc3/drivers/usb/media/pwc-misc.c
806--- linux-2.6.7-rc3.org/drivers/usb/media/pwc-misc.c 2004-06-07 21:14:05.000000000 +0200
807+++ linux-2.6.7-rc3/drivers/usb/media/pwc-misc.c 2004-05-07 00:52:23.000000000 +0200
808@@ -36,11 +36,30 @@
809 {
810 int i, find;
811
812- /* Make sure we don't go beyond our max size */
813- if (width > pdev->view_max.x || height > pdev->view_max.y)
814- return -1;
815+ /* Make sure we don't go beyond our max size.
816+ NB: we have different limits for RAW and normal modes. In case
817+ you don't have the decompressor loaded or use RAW mode,
818+ the maximum viewable size is smaller.
819+ */
820+ if (pdev->vpalette == VIDEO_PALETTE_RAW)
821+ {
822+ if (width > pdev->abs_max.x || height > pdev->abs_max.y)
823+ {
824+ Debug("VIDEO_PALETTE_RAW: going beyond abs_max.\n");
825+ return -1;
826+ }
827+ }
828+ else
829+ {
830+ if (width > pdev->view_max.x || height > pdev->view_max.y)
831+ {
832+ Debug("VIDEO_PALETTE_ not RAW: going beyond view_max.\n");
833+ return -1;
834+ }
835+ }
836+
837 /* Find the largest size supported by the camera that fits into the
838- requested size.
839+ requested size.
840 */
841 find = -1;
842 for (i = 0; i < PSZ_MAX; i++) {
843@@ -62,6 +81,8 @@
844 pdev->view_min.y = 96;
845 pdev->view_max.x = 352;
846 pdev->view_max.y = 288;
847+ pdev->abs_max.x = 352;
848+ pdev->abs_max.y = 288;
849 pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QCIF | 1 << PSZ_CIF;
850 pdev->vcinterface = 2;
851 pdev->vendpoint = 4;
852@@ -77,13 +98,14 @@
853 if (pdev->decompressor != NULL) {
854 pdev->view_max.x = 640;
855 pdev->view_max.y = 480;
856- pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QSIF | 1 << PSZ_QCIF | 1 << PSZ_SIF | 1 << PSZ_CIF | 1 << PSZ_VGA;
857 }
858 else {
859 pdev->view_max.x = 352;
860 pdev->view_max.y = 288;
861- pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QSIF | 1 << PSZ_QCIF | 1 << PSZ_SIF | 1 << PSZ_CIF;
862 }
863+ pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QSIF | 1 << PSZ_QCIF | 1 << PSZ_SIF | 1 << PSZ_CIF | 1 << PSZ_VGA;
864+ pdev->abs_max.x = 640;
865+ pdev->abs_max.y = 480;
866 pdev->vcinterface = 3;
867 pdev->vendpoint = 4;
868 pdev->frame_header_size = 0;
869@@ -99,24 +121,26 @@
870 if (pdev->decompressor != NULL) {
871 pdev->view_max.x = 640;
872 pdev->view_max.y = 480;
873- pdev->image_mask = 1 << PSZ_QSIF | 1 << PSZ_SIF | 1 << PSZ_VGA;
874 }
875 else {
876- /* Tell CIF, even though SIF really is the maximum, but some tools really need CIF */
877+ /* We use CIF, not SIF since some tools really need CIF. So we cheat a bit. */
878 pdev->view_max.x = 352;
879 pdev->view_max.y = 288;
880- pdev->image_mask = 1 << PSZ_QSIF | 1 << PSZ_SIF;
881 }
882+ pdev->image_mask = 1 << PSZ_QSIF | 1 << PSZ_SIF | 1 << PSZ_VGA;
883+ pdev->abs_max.x = 640;
884+ pdev->abs_max.y = 480;
885 pdev->vcinterface = 3;
886 pdev->vendpoint = 5;
887 pdev->frame_header_size = TOUCAM_HEADER_SIZE;
888 pdev->frame_trailer_size = TOUCAM_TRAILER_SIZE;
889 break;
890 }
891+ pdev->vpalette = VIDEO_PALETTE_YUV420P; /* default */
892 pdev->view_min.size = pdev->view_min.x * pdev->view_min.y;
893 pdev->view_max.size = pdev->view_max.x * pdev->view_max.y;
894- /* length of image, in YUV format */
895- pdev->len_per_image = (pdev->view_max.size * 3) / 2;
896+ /* length of image, in YUV format; always allocate enough memory. */
897+ pdev->len_per_image = (pdev->abs_max.x * pdev->abs_max.y * 3) / 2;
898 }
899
900
901diff -Nur linux-2.6.7-rc3.org/drivers/usb/media/pwc-uncompress.c linux-2.6.7-rc3/drivers/usb/media/pwc-uncompress.c
902--- linux-2.6.7-rc3.org/drivers/usb/media/pwc-uncompress.c 2004-06-07 21:14:25.000000000 +0200
903+++ linux-2.6.7-rc3/drivers/usb/media/pwc-uncompress.c 2004-05-07 00:52:23.000000000 +0200
904@@ -21,7 +21,9 @@
905 themselves. It also has a decompressor wrapper function.
906 */
907
908+#include <asm/current.h>
909 #include <asm/types.h>
910+// #include <linux/sched.h>
911
912 #include "pwc.h"
913 #include "pwc-uncompress.h"
914@@ -97,16 +98,24 @@
915 image = pdev->image_ptr[pdev->fill_image];
916 if (!image)
917 return -EFAULT;
918-
919+
920 yuv = fbuf->data + pdev->frame_header_size; /* Skip header */
921- if (pdev->vbandlength == 0) {
922+
923+ /* Raw format; that's easy... */
924+ if (pdev->vpalette == VIDEO_PALETTE_RAW)
925+ {
926+ memcpy(image, yuv, pdev->frame_size);
927+ return 0;
928+ }
929+
930+ if (pdev->vbandlength == 0) {
931 /* Uncompressed mode. We copy the data into the output buffer,
932 using the viewport size (which may be larger than the image
933 size). Unfortunately we have to do a bit of byte stuffing
934 to get the desired output format/size.
935 */
936- /*
937- * We do some byte shuffling here to go from the
938+ /*
939+ * We do some byte shuffling here to go from the
940 * native format to YUV420P.
941 */
942 src = (u16 *)yuv;
943@@ -140,15 +149,21 @@
944 dstu += (stride >> 1);
945 }
946 }
947- else {
948- /* Compressed; the decompressor routines will write the data
949+ else {
950+ /* Compressed; the decompressor routines will write the data
951 in planar format immediately.
952 */
953+ int flags;
954+
955+ flags = PWCX_FLAG_PLANAR;
956+ if (pdev->vsize == PSZ_VGA && pdev->vframes == 5 && pdev->vsnapshot)
957+ flags |= PWCX_FLAG_BAYER;
958+
959 if (pdev->decompressor)
960 pdev->decompressor->decompress(
961 &pdev->image, &pdev->view, &pdev->offset,
962 yuv, image,
963- 1,
964+ flags,
965 pdev->decompress_data, pdev->vbandlength);
966 else
967 return -ENXIO; /* No such device or address: missing decompressor */
968diff -Nur linux-2.6.7-rc3.org/drivers/usb/media/pwc-uncompress.h linux-2.6.7-rc3/drivers/usb/media/pwc-uncompress.h
969--- linux-2.6.7-rc3.org/drivers/usb/media/pwc-uncompress.h 2004-06-07 21:14:03.000000000 +0200
970+++ linux-2.6.7-rc3/drivers/usb/media/pwc-uncompress.h 2004-05-07 00:52:23.000000000 +0200
971@@ -24,10 +24,16 @@
972 #define PWC_UNCOMPRESS_H
973
974 #include <linux/config.h>
975+#include <linux/linkage.h>
976 #include <linux/list.h>
977
978 #include "pwc.h"
979
980+/* from pwc-dec.h */
981+#define PWCX_FLAG_PLANAR 0x0001
982+/* */
983+
984+
985 #ifdef __cplusplus
986 extern "C" {
987 #endif
988@@ -42,10 +48,10 @@
989 int type; /* type of camera (645, 680, etc) */
990 int table_size; /* memory needed */
991
992- void (* init)(int release, void *buffer, void *table); /* Initialization routine; should be called after each set_video_mode */
993- void (* exit)(void); /* Cleanup routine */
994- void (* decompress)(struct pwc_coord *image, struct pwc_coord *view, struct pwc_coord *offset,
995- void *src, void *dst, int planar,
996+ asmlinkage void (* init)(int type, int release, void *buffer, void *table); /* Initialization routine; should be called after each set_video_mode */
997+ asmlinkage void (* exit)(void); /* Cleanup routine */
998+ asmlinkage void (* decompress)(struct pwc_coord *image, struct pwc_coord *view, struct pwc_coord *offset,
999+ void *src, void *dst, int flags,
1000 void *table, int bandlength);
1001 void (* lock)(void); /* make sure module cannot be unloaded */
1002 void (* unlock)(void); /* release lock on module */
1003diff -Nur linux-2.6.7-rc3.org/drivers/usb/media/pwc.h linux-2.6.7-rc3/drivers/usb/media/pwc.h
1004--- linux-2.6.7-rc3.org/drivers/usb/media/pwc.h 2004-06-07 21:14:34.000000000 +0200
1005+++ linux-2.6.7-rc3/drivers/usb/media/pwc.h 2004-05-07 00:52:23.000000000 +0200
1006@@ -22,12 +22,11 @@
1007
1008 #include <linux/config.h>
1009 #include <linux/module.h>
1010-#include <linux/smp_lock.h>
1011-#include <linux/spinlock.h>
1012 #include <linux/usb.h>
1013+#include <linux/spinlock.h>
1014 #include <linux/videodev.h>
1015 #include <linux/wait.h>
1016-
1017+#include <linux/smp_lock.h>
1018 #include <asm/semaphore.h>
1019 #include <asm/errno.h>
1020
1021@@ -65,9 +64,9 @@
1022 #define FEATURE_MOTOR_PANTILT 0x0001
1023
1024 /* Version block */
1025-#define PWC_MAJOR 8
1026-#define PWC_MINOR 12
1027-#define PWC_VERSION "8.12"
1028+#define PWC_MAJOR 9
1029+#define PWC_MINOR 0
1030+#define PWC_VERSION "9.0-BETA-2"
1031 #define PWC_NAME "pwc"
1032
1033 /* Turn certain features on/off */
1034@@ -90,12 +89,6 @@
1035 /* Absolute maximum number of buffers available for mmap() */
1036 #define MAX_IMAGES 10
1037
1038-struct pwc_coord
1039-{
1040- int x, y; /* guess what */
1041- int size; /* size, or offset */
1042-};
1043-
1044 /* The following structures were based on cpia.h. Why reinvent the wheel? :-) */
1045 struct pwc_iso_buf
1046 {
1047@@ -137,6 +130,7 @@
1048 int vcinterface; /* video control interface */
1049 int valternate; /* alternate interface needed */
1050 int vframes, vsize; /* frames-per-second & size (see PSZ_*) */
1051+ int vpalette; /* palette: 420P, RAW or RGBBAYER */
1052 int vframe_count; /* received frames */
1053 int vframes_dumped; /* counter for dumped frames */
1054 int vframes_error; /* frames received in error */
1055@@ -148,6 +142,9 @@
1056 char vsnapshot; /* snapshot mode */
1057 char vsync; /* used by isoc handler */
1058 char vmirror; /* for ToUCaM series */
1059+
1060+ int cmd_len;
1061+ unsigned char cmd_buf[13];
1062
1063 /* The image acquisition requires 3 to 4 steps:
1064 1. data is gathered in short packets from the USB controller
1065@@ -169,8 +166,9 @@
1066 struct pwc_frame_buf *full_frames, *full_frames_tail; /* all filled frames */
1067 struct pwc_frame_buf *fill_frame; /* frame currently being filled */
1068 struct pwc_frame_buf *read_frame; /* frame currently read by user process */
1069- int frame_size;
1070 int frame_header_size, frame_trailer_size;
1071+ int frame_size;
1072+ int frame_total_size; /* including header & trailer */
1073 int drop_frames;
1074 #if PWC_DEBUG
1075 int sequence; /* Debugging aid */
1076@@ -187,7 +185,8 @@
1077 a gray or black border. view_min <= image <= view <= view_max;
1078 */
1079 int image_mask; /* bitmask of supported sizes */
1080- struct pwc_coord view_min, view_max; /* minimum and maximum sizes */
1081+ struct pwc_coord view_min, view_max; /* minimum and maximum viewable sizes */
1082+ struct pwc_coord abs_max; /* maximum supported size with compression */
1083 struct pwc_coord image, view; /* image and viewport size */
1084 struct pwc_coord offset; /* offset within the viewport */
1085
1086@@ -213,16 +212,6 @@
1087 #endif
1088 };
1089
1090-/* Enumeration of image sizes */
1091-#define PSZ_SQCIF 0x00
1092-#define PSZ_QSIF 0x01
1093-#define PSZ_QCIF 0x02
1094-#define PSZ_SIF 0x03
1095-#define PSZ_CIF 0x04
1096-#define PSZ_VGA 0x05
1097-#define PSZ_MAX 6
1098-
1099-
1100
1101 #ifdef __cplusplus
1102 extern "C" {
1103@@ -259,7 +248,7 @@
1104 extern int pwc_set_saturation(struct pwc_device *pdev, int value);
1105 extern int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value);
1106 extern int pwc_get_leds(struct pwc_device *pdev, int *on_value, int *off_value);
1107-extern int pwc_get_cmos_sensor(struct pwc_device *pdev);
1108+extern int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor);
1109
1110 /* Power down or up the camera; not supported by all models */
1111 extern int pwc_camera_power(struct pwc_device *pdev, int power);
This page took 0.234007 seconds and 4 git commands to generate.