diff options
Diffstat (limited to 'drivers/media/video/gspca/sonixb.c')
-rw-r--r-- | drivers/media/video/gspca/sonixb.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c index cf3af8de6e97..a9f061063b49 100644 --- a/drivers/media/video/gspca/sonixb.c +++ b/drivers/media/video/gspca/sonixb.c | |||
@@ -995,8 +995,7 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
995 | } | 995 | } |
996 | 996 | ||
997 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 997 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
998 | struct gspca_frame *frame, /* target */ | 998 | u8 *data, /* isoc packet */ |
999 | unsigned char *data, /* isoc packet */ | ||
1000 | int len) /* iso packet length */ | 999 | int len) /* iso packet length */ |
1001 | { | 1000 | { |
1002 | int i; | 1001 | int i; |
@@ -1054,12 +1053,12 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
1054 | pkt_type = DISCARD_PACKET; | 1053 | pkt_type = DISCARD_PACKET; |
1055 | } | 1054 | } |
1056 | 1055 | ||
1057 | frame = gspca_frame_add(gspca_dev, pkt_type, | 1056 | gspca_frame_add(gspca_dev, pkt_type, |
1058 | frame, data, 0); | 1057 | NULL, 0); |
1059 | data += i + fr_h_sz; | 1058 | data += i + fr_h_sz; |
1060 | len -= i + fr_h_sz; | 1059 | len -= i + fr_h_sz; |
1061 | gspca_frame_add(gspca_dev, FIRST_PACKET, | 1060 | gspca_frame_add(gspca_dev, FIRST_PACKET, |
1062 | frame, data, len); | 1061 | data, len); |
1063 | return; | 1062 | return; |
1064 | } | 1063 | } |
1065 | } | 1064 | } |
@@ -1068,15 +1067,21 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
1068 | if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_RAW) { | 1067 | if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_RAW) { |
1069 | /* In raw mode we sometimes get some garbage after the frame | 1068 | /* In raw mode we sometimes get some garbage after the frame |
1070 | ignore this */ | 1069 | ignore this */ |
1071 | int used = frame->data_end - frame->data; | 1070 | struct gspca_frame *frame; |
1071 | int used; | ||
1072 | int size = cam->cam_mode[gspca_dev->curr_mode].sizeimage; | 1072 | int size = cam->cam_mode[gspca_dev->curr_mode].sizeimage; |
1073 | 1073 | ||
1074 | frame = gspca_get_i_frame(gspca_dev); | ||
1075 | if (frame == NULL) { | ||
1076 | gspca_dev->last_packet_type = DISCARD_PACKET; | ||
1077 | return; | ||
1078 | } | ||
1079 | used = frame->data_end - frame->data; | ||
1074 | if (used + len > size) | 1080 | if (used + len > size) |
1075 | len = size - used; | 1081 | len = size - used; |
1076 | } | 1082 | } |
1077 | 1083 | ||
1078 | gspca_frame_add(gspca_dev, INTER_PACKET, | 1084 | gspca_frame_add(gspca_dev, INTER_PACKET, data, len); |
1079 | frame, data, len); | ||
1080 | } | 1085 | } |
1081 | 1086 | ||
1082 | static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) | 1087 | static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) |