diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2008-06-12 09:58:58 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 06:14:45 -0400 |
commit | d43fa32fec442571f10f5d0c3b553413288728de (patch) | |
tree | 6bbf2a57d5b9a94bca4246518094f32758eecb1e /drivers/media/video/gspca/stk014.c | |
parent | 4aa0d037a6c8e6b37ecfd986a444f83190c32a21 (diff) |
V4L/DVB (8156): Many bug fixes, zc3xx added.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/gspca/stk014.c')
-rw-r--r-- | drivers/media/video/gspca/stk014.c | 55 |
1 files changed, 11 insertions, 44 deletions
diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c index 2e4cf64442ac..d8c203e99cd3 100644 --- a/drivers/media/video/gspca/stk014.c +++ b/drivers/media/video/gspca/stk014.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Syntek DV4000 (STK014) subdriver | 2 | * Syntek DV4000 (STK014) subdriver |
3 | * | 3 | * |
4 | * Copyright (C) Jean-Francois Moine (http://moinejf.free.fr) | 4 | * Copyright (C) 2008 Jean-Francois Moine (http://moinejf.free.fr) |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 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 | 7 | * it under the terms of the GNU General Public License as published by |
@@ -16,7 +16,6 @@ | |||
16 | * You should have received a copy of the GNU General Public License | 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 | 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 | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | * | ||
20 | */ | 19 | */ |
21 | 20 | ||
22 | #define MODULE_NAME "stk014" | 21 | #define MODULE_NAME "stk014" |
@@ -24,8 +23,8 @@ | |||
24 | #include "gspca.h" | 23 | #include "gspca.h" |
25 | #include "jpeg.h" | 24 | #include "jpeg.h" |
26 | 25 | ||
27 | #define DRIVER_VERSION_NUMBER KERNEL_VERSION(0, 1, 0) | 26 | #define DRIVER_VERSION_NUMBER KERNEL_VERSION(0, 2, 7) |
28 | static const char version[] = "0.1.0"; | 27 | static const char version[] = "0.2.7"; |
29 | 28 | ||
30 | MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); | 29 | MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); |
31 | MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver"); | 30 | MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver"); |
@@ -389,64 +388,32 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
389 | unsigned char *data, /* isoc packet */ | 388 | unsigned char *data, /* isoc packet */ |
390 | int len) /* iso packet length */ | 389 | int len) /* iso packet length */ |
391 | { | 390 | { |
392 | int l; | ||
393 | static unsigned char ffd9[] = {0xff, 0xd9}; | 391 | static unsigned char ffd9[] = {0xff, 0xd9}; |
394 | 392 | ||
395 | /* a frame starts with: | 393 | /* a frame starts with: |
396 | * - 0xff 0xfe | 394 | * - 0xff 0xfe |
397 | * - 0x08 0x00 // length (little endian ?!) | 395 | * - 0x08 0x00 - length (little endian ?!) |
398 | * - 4 bytes = size of whole frame (big endian - including header) | 396 | * - 4 bytes = size of whole frame (BE - including header) |
399 | * - 0x00 0x0c | 397 | * - 0x00 0x0c |
400 | * - 0xff 0xd8 | 398 | * - 0xff 0xd8 |
401 | * - .. JPEG image with escape sequences (ff 00) | 399 | * - .. JPEG image with escape sequences (ff 00) |
400 | * (without ending - ff d9) | ||
402 | */ | 401 | */ |
403 | if (data[0] == 0xff && data[1] == 0xfe) { | 402 | if (data[0] == 0xff && data[1] == 0xfe) { |
404 | if (gspca_dev->last_packet_type == INTER_PACKET) { | 403 | frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, |
405 | PDEBUG(D_ERR|D_FRAM, "sof actual l: %d init l: %d", | 404 | ffd9, 2); |
406 | frame->data_end - frame->data, | ||
407 | frame->v4l2_buf.bytesused); | ||
408 | } | ||
409 | 405 | ||
410 | /* put the JPEG headaer */ | 406 | /* put the JPEG 411 header */ |
411 | jpeg_put_header(gspca_dev, frame, sd_quant, 0x22); | 407 | jpeg_put_header(gspca_dev, frame, sd_quant, 0x22); |
412 | 408 | ||
413 | /* beginning of the frame */ | 409 | /* beginning of the frame */ |
414 | #define STKHDRSZ 12 | 410 | #define STKHDRSZ 12 |
415 | l = (data[4] << 24) /* frame size */ | ||
416 | + (data[5] << 16) | ||
417 | + (data[6] << 8) | ||
418 | + data[7] | ||
419 | - STKHDRSZ | ||
420 | + (frame->data_end - frame->data) | ||
421 | + 2; /* EOF (ff d9) */ | ||
422 | gspca_frame_add(gspca_dev, INTER_PACKET, frame, | 411 | gspca_frame_add(gspca_dev, INTER_PACKET, frame, |
423 | data + STKHDRSZ, len - STKHDRSZ); | 412 | data + STKHDRSZ, len - STKHDRSZ); |
424 | #undef STKHDRSZ | 413 | #undef STKHDRSZ |
425 | frame->v4l2_buf.bytesused = l; | ||
426 | return; | ||
427 | } | ||
428 | if (gspca_dev->last_packet_type != INTER_PACKET) { | ||
429 | if (gspca_dev->last_packet_type == LAST_PACKET) { | ||
430 | PDEBUG(D_ERR|D_PACK, "mof actual l: %d init l: %d", | ||
431 | frame->data_end - frame->data, | ||
432 | frame->v4l2_buf.bytesused); | ||
433 | } | ||
434 | return; | ||
435 | } | ||
436 | |||
437 | /* intermediate packet */ | ||
438 | l = frame->data_end - frame->data; | ||
439 | if (len < frame->v4l2_buf.bytesused - 2 - l) { | ||
440 | gspca_frame_add(gspca_dev, INTER_PACKET, frame, | ||
441 | data, len); | ||
442 | return; | 414 | return; |
443 | } | 415 | } |
444 | |||
445 | /* last packet */ | ||
446 | if (len > frame->v4l2_buf.bytesused - 2 - l) | ||
447 | len = frame->v4l2_buf.bytesused - 2 - l; | ||
448 | gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len); | 416 | gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len); |
449 | gspca_frame_add(gspca_dev, LAST_PACKET, frame, ffd9, 2); | ||
450 | } | 417 | } |
451 | 418 | ||
452 | static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) | 419 | static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) |
@@ -529,8 +496,8 @@ MODULE_DEVICE_TABLE(usb, device_table); | |||
529 | static int sd_probe(struct usb_interface *intf, | 496 | static int sd_probe(struct usb_interface *intf, |
530 | const struct usb_device_id *id) | 497 | const struct usb_device_id *id) |
531 | { | 498 | { |
532 | PDEBUG(D_PROBE, "camera probe"); | 499 | return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), |
533 | return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd)); | 500 | THIS_MODULE); |
534 | } | 501 | } |
535 | 502 | ||
536 | static struct usb_driver sd_driver = { | 503 | static struct usb_driver sd_driver = { |