diff options
Diffstat (limited to 'drivers/media/video/gspca/pac7302.c')
-rw-r--r-- | drivers/media/video/gspca/pac7302.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/drivers/media/video/gspca/pac7302.c b/drivers/media/video/gspca/pac7302.c index 2a68220d1ada..a66df07d7625 100644 --- a/drivers/media/video/gspca/pac7302.c +++ b/drivers/media/video/gspca/pac7302.c | |||
@@ -402,7 +402,7 @@ static void reg_w_buf(struct gspca_dev *gspca_dev, | |||
402 | memcpy(gspca_dev->usb_buf, buffer, len); | 402 | memcpy(gspca_dev->usb_buf, buffer, len); |
403 | ret = usb_control_msg(gspca_dev->dev, | 403 | ret = usb_control_msg(gspca_dev->dev, |
404 | usb_sndctrlpipe(gspca_dev->dev, 0), | 404 | usb_sndctrlpipe(gspca_dev->dev, 0), |
405 | 1, /* request */ | 405 | 0, /* request */ |
406 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 406 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
407 | 0, /* value */ | 407 | 0, /* value */ |
408 | index, gspca_dev->usb_buf, len, | 408 | index, gspca_dev->usb_buf, len, |
@@ -804,7 +804,6 @@ static const unsigned char pac_jpeg_header2[] = { | |||
804 | }; | 804 | }; |
805 | 805 | ||
806 | static void pac_start_frame(struct gspca_dev *gspca_dev, | 806 | static void pac_start_frame(struct gspca_dev *gspca_dev, |
807 | struct gspca_frame *frame, | ||
808 | __u16 lines, __u16 samples_per_line) | 807 | __u16 lines, __u16 samples_per_line) |
809 | { | 808 | { |
810 | unsigned char tmpbuf[4]; | 809 | unsigned char tmpbuf[4]; |
@@ -829,19 +828,13 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
829 | int len) /* iso packet length */ | 828 | int len) /* iso packet length */ |
830 | { | 829 | { |
831 | struct sd *sd = (struct sd *) gspca_dev; | 830 | struct sd *sd = (struct sd *) gspca_dev; |
832 | struct gspca_frame *frame; | 831 | u8 *image; |
833 | unsigned char *sof; | 832 | unsigned char *sof; |
834 | 833 | ||
835 | sof = pac_find_sof(&sd->sof_read, data, len); | 834 | sof = pac_find_sof(&sd->sof_read, data, len); |
836 | if (sof) { | 835 | if (sof) { |
837 | int n, lum_offset, footer_length; | 836 | int n, lum_offset, footer_length; |
838 | 837 | ||
839 | frame = gspca_get_i_frame(gspca_dev); | ||
840 | if (frame == NULL) { | ||
841 | gspca_dev->last_packet_type = DISCARD_PACKET; | ||
842 | return; | ||
843 | } | ||
844 | |||
845 | /* 6 bytes after the FF D9 EOF marker a number of lumination | 838 | /* 6 bytes after the FF D9 EOF marker a number of lumination |
846 | bytes are send corresponding to different parts of the | 839 | bytes are send corresponding to different parts of the |
847 | image, the 14th and 15th byte after the EOF seem to | 840 | image, the 14th and 15th byte after the EOF seem to |
@@ -852,16 +845,17 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
852 | /* Finish decoding current frame */ | 845 | /* Finish decoding current frame */ |
853 | n = (sof - data) - (footer_length + sizeof pac_sof_marker); | 846 | n = (sof - data) - (footer_length + sizeof pac_sof_marker); |
854 | if (n < 0) { | 847 | if (n < 0) { |
855 | frame->data_end += n; | 848 | gspca_dev->image_len += n; |
856 | n = 0; | 849 | n = 0; |
850 | } else { | ||
851 | gspca_frame_add(gspca_dev, INTER_PACKET, data, n); | ||
857 | } | 852 | } |
858 | gspca_frame_add(gspca_dev, INTER_PACKET, | 853 | |
859 | data, n); | 854 | image = gspca_dev->image; |
860 | if (gspca_dev->last_packet_type != DISCARD_PACKET && | 855 | if (image != NULL |
861 | frame->data_end[-2] == 0xff && | 856 | && image[gspca_dev->image_len - 2] == 0xff |
862 | frame->data_end[-1] == 0xd9) | 857 | && image[gspca_dev->image_len - 1] == 0xd9) |
863 | gspca_frame_add(gspca_dev, LAST_PACKET, | 858 | gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0); |
864 | NULL, 0); | ||
865 | 859 | ||
866 | n = sof - data; | 860 | n = sof - data; |
867 | len -= n; | 861 | len -= n; |
@@ -877,7 +871,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
877 | 871 | ||
878 | /* Start the new frame with the jpeg header */ | 872 | /* Start the new frame with the jpeg header */ |
879 | /* The PAC7302 has the image rotated 90 degrees */ | 873 | /* The PAC7302 has the image rotated 90 degrees */ |
880 | pac_start_frame(gspca_dev, frame, | 874 | pac_start_frame(gspca_dev, |
881 | gspca_dev->width, gspca_dev->height); | 875 | gspca_dev->width, gspca_dev->height); |
882 | } | 876 | } |
883 | gspca_frame_add(gspca_dev, INTER_PACKET, data, len); | 877 | gspca_frame_add(gspca_dev, INTER_PACKET, data, len); |
@@ -1200,6 +1194,7 @@ static const struct usb_device_id device_table[] __devinitconst = { | |||
1200 | {USB_DEVICE(0x093a, 0x2621)}, | 1194 | {USB_DEVICE(0x093a, 0x2621)}, |
1201 | {USB_DEVICE(0x093a, 0x2622), .driver_info = FL_VFLIP}, | 1195 | {USB_DEVICE(0x093a, 0x2622), .driver_info = FL_VFLIP}, |
1202 | {USB_DEVICE(0x093a, 0x2624), .driver_info = FL_VFLIP}, | 1196 | {USB_DEVICE(0x093a, 0x2624), .driver_info = FL_VFLIP}, |
1197 | {USB_DEVICE(0x093a, 0x2625)}, | ||
1203 | {USB_DEVICE(0x093a, 0x2626)}, | 1198 | {USB_DEVICE(0x093a, 0x2626)}, |
1204 | {USB_DEVICE(0x093a, 0x2628)}, | 1199 | {USB_DEVICE(0x093a, 0x2628)}, |
1205 | {USB_DEVICE(0x093a, 0x2629), .driver_info = FL_VFLIP}, | 1200 | {USB_DEVICE(0x093a, 0x2629), .driver_info = FL_VFLIP}, |