diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/gspca/sonixb.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c index 80879bf3188f..a512772664a3 100644 --- a/drivers/media/video/gspca/sonixb.c +++ b/drivers/media/video/gspca/sonixb.c | |||
@@ -1033,6 +1033,15 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
1033 | int i; | 1033 | int i; |
1034 | struct sd *sd = (struct sd *) gspca_dev; | 1034 | struct sd *sd = (struct sd *) gspca_dev; |
1035 | 1035 | ||
1036 | /* frames start with: | ||
1037 | * ff ff 00 c4 c4 96 synchro | ||
1038 | * 00 (unknown) | ||
1039 | * xx (frame sequence / size / compression) | ||
1040 | * (xx) (idem - extra byte for sn9c103) | ||
1041 | * ll mm brightness sum inside auto exposure | ||
1042 | * ll mm brightness sum outside auto exposure | ||
1043 | * (xx xx xx xx xx) audio values for snc103 | ||
1044 | */ | ||
1036 | if (len > 6 && len < 24) { | 1045 | if (len > 6 && len < 24) { |
1037 | for (i = 0; i < len - 6; i++) { | 1046 | for (i = 0; i < len - 6; i++) { |
1038 | if (data[0 + i] == 0xff | 1047 | if (data[0 + i] == 0xff |
@@ -1043,15 +1052,18 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
1043 | && data[5 + i] == 0x96) { /* start of frame */ | 1052 | && data[5 + i] == 0x96) { /* start of frame */ |
1044 | frame = gspca_frame_add(gspca_dev, LAST_PACKET, | 1053 | frame = gspca_frame_add(gspca_dev, LAST_PACKET, |
1045 | frame, data, 0); | 1054 | frame, data, 0); |
1046 | if (i < (len - 10)) { | 1055 | if (len - i < sd->fr_h_sz) { |
1047 | atomic_set(&sd->avg_lum, data[i + 8] + | 1056 | atomic_set(&sd->avg_lum, -1); |
1057 | PDEBUG(D_STREAM, "packet too short to" | ||
1058 | " get avg brightness"); | ||
1059 | } else if (sd->fr_h_sz == 12) { | ||
1060 | atomic_set(&sd->avg_lum, | ||
1061 | data[i + 8] + | ||
1048 | (data[i + 9] << 8)); | 1062 | (data[i + 9] << 8)); |
1049 | } else { | 1063 | } else { |
1050 | atomic_set(&sd->avg_lum, -1); | 1064 | atomic_set(&sd->avg_lum, |
1051 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 1065 | data[i + 9] + |
1052 | PDEBUG(D_STREAM, "packet too short to " | 1066 | (data[i + 10] << 8)); |
1053 | "get avg brightness"); | ||
1054 | #endif | ||
1055 | } | 1067 | } |
1056 | data += i + sd->fr_h_sz; | 1068 | data += i + sd->fr_h_sz; |
1057 | len -= i + sd->fr_h_sz; | 1069 | len -= i + sd->fr_h_sz; |