Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 153906
b: refs/heads/master
c: 92918a5
h: refs/heads/master
v: v3
  • Loading branch information
Hans de Goede authored and Mauro Carvalho Chehab committed Jun 23, 2009
1 parent 1e3fe6e commit 9289e1f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 124cc9c0c8acc77ac2f1114ee7eea961334020ba
refs/heads/master: 92918a53ee74bb326430aaa958caa0cf111b54b1
29 changes: 23 additions & 6 deletions trunk/drivers/media/video/gspca/ov519.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ static int i2c_detect_tries = 10;
struct sd {
struct gspca_dev gspca_dev; /* !! must be the first item */

__u8 packet_nr;

char bridge;
#define BRIDGE_OV511 0
#define BRIDGE_OV511PLUS 1
Expand Down Expand Up @@ -2391,18 +2393,33 @@ static void ov518_pkt_scan(struct gspca_dev *gspca_dev,
__u8 *data, /* isoc packet */
int len) /* iso packet length */
{
PDEBUG(D_STREAM, "ov518_pkt_scan: %d bytes", len);

if (len & 7) {
len--;
PDEBUG(D_STREAM, "packet number: %d\n", (int)data[len]);
}
struct sd *sd = (struct sd *) gspca_dev;

/* A false positive here is likely, until OVT gives me
* the definitive SOF/EOF format */
if ((!(data[0] | data[1] | data[2] | data[3] | data[5])) && data[6]) {
gspca_frame_add(gspca_dev, LAST_PACKET, frame, data, 0);
gspca_frame_add(gspca_dev, FIRST_PACKET, frame, data, 0);
sd->packet_nr = 0;
}

if (gspca_dev->last_packet_type == DISCARD_PACKET)
return;

/* Does this device use packet numbers ? */
if (len & 7) {
len--;
if (sd->packet_nr == data[len])
sd->packet_nr++;
/* The last few packets of the frame (which are all 0's
except that they may contain part of the footer), are
numbered 0 */
else if (sd->packet_nr == 0 || data[len]) {
PDEBUG(D_ERR, "Invalid packet nr: %d (expect: %d)",
(int)data[len], (int)sd->packet_nr);
gspca_dev->last_packet_type = DISCARD_PACKET;
return;
}
}

/* intermediate packet */
Expand Down

0 comments on commit 9289e1f

Please sign in to comment.