diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2007-08-27 07:55:05 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2007-08-27 07:55:05 -0300 |
commit | 57be11d238dbbb48e94a010c01eef6282832e752 (patch) | |
tree | 04da53c2fc4d563381f55bc749306d0a503e0a3b /linux | |
parent | 9fb9cbfe163852df2750bb8df95a6d93638aeb29 (diff) | |
download | mediapointer-dvb-s2-57be11d238dbbb48e94a010c01eef6282832e752.tar.gz mediapointer-dvb-s2-57be11d238dbbb48e94a010c01eef6282832e752.tar.bz2 |
tm6000: check for errors on usb->status
From: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drivers/staging/tm6000/tm6000-video.c | 87 |
1 files changed, 52 insertions, 35 deletions
diff --git a/linux/drivers/staging/tm6000/tm6000-video.c b/linux/drivers/staging/tm6000/tm6000-video.c index b777fe9ea..e651f80e7 100644 --- a/linux/drivers/staging/tm6000/tm6000-video.c +++ b/linux/drivers/staging/tm6000/tm6000-video.c @@ -168,7 +168,7 @@ static void inline buffer_filled (struct tm6000_core *dev, struct tm6000_buffer *buf) { /* Advice that buffer was filled */ - dprintk(dev, V4L2_DEBUG_QUEUE, "[%p/%d] wakeup\n",buf,buf->vb.i); + dprintk(dev, V4L2_DEBUG_ISOC, "[%p/%d] wakeup\n",buf,buf->vb.i); buf->vb.state = STATE_DONE; buf->vb.field_count++; do_gettimeofday(&buf->vb.ts); @@ -275,7 +275,7 @@ static int copy_streams(u8 *data, u8 *out_p, unsigned long len, /* Announces that a new buffer were filled */ buffer_filled (dev, *buf); - dprintk(dev, V4L2_DEBUG_QUEUE, "new buffer filled\n"); + dprintk(dev, V4L2_DEBUG_ISOC, "new buffer filled\n"); rc=get_next_buf (dma_q, buf); if (rc<0) @@ -351,7 +351,7 @@ static int copy_multiplexed(u8 *ptr, u8 *out_p, unsigned long len, pos=0; /* Announces that a new buffer were filled */ buffer_filled (dev, *buf); - dprintk(dev, V4L2_DEBUG_QUEUE, "new buffer filled\n"); + dprintk(dev, V4L2_DEBUG_ISOC, "new buffer filled\n"); rc=get_next_buf (dma_q, buf); if (rc<=0) { @@ -366,6 +366,47 @@ static int copy_multiplexed(u8 *ptr, u8 *out_p, unsigned long len, return rc; } +static void inline print_err_status (struct tm6000_core *dev, + int packet, int status) +{ + char *errmsg = "Unknown"; + + switch(status) { + case -ENOENT: + errmsg = "unlinked synchronuously"; + break; + case -ECONNRESET: + errmsg = "unlinked asynchronuously"; + break; + case -ENOSR: + errmsg = "Buffer error (overrun)"; + break; + case -EPIPE: + errmsg = "Stalled (device not responding)"; + break; + case -EOVERFLOW: + errmsg = "Babble (bad cable?)"; + break; + case -EPROTO: + errmsg = "Bit-stuff error (bad cable?)"; + break; + case -EILSEQ: + errmsg = "CRC/Timeout (could be anything)"; + break; + case -ETIME: + errmsg = "Device does not respond"; + break; + } + if (packet<0) { + dprintk(dev, V4L2_DEBUG_QUEUE, "URB status %d [%s].\n", + status, errmsg); + } else { + dprintk(dev, V4L2_DEBUG_QUEUE, "URB packet %d, status %d [%s].\n", + packet, status, errmsg); + } +} + + /* * Controls the isoc copy of each urb packet */ @@ -381,42 +422,18 @@ static inline int tm6000_isoc_copy(struct urb *urb, struct tm6000_buffer **buf) copied=0; + if (urb->status<0) { + print_err_status (dev,-1,urb->status); + return 0; + } for (i = 0; i < urb->number_of_packets; i++) { int status = urb->iso_frame_desc[i].status; - char *errmsg = "Unknown"; - - switch(status) { - case -ENOENT: - errmsg = "unlinked synchronuously"; - break; - case -ECONNRESET: - errmsg = "unlinked asynchronuously"; - break; - case -ENOSR: - errmsg = "Buffer error (overrun)"; - break; - case -EPIPE: - errmsg = "Stalled (device not responding)"; - break; - case -EOVERFLOW: - errmsg = "Babble (bad cable?)"; - break; - case -EPROTO: - errmsg = "Bit-stuff error (bad cable?)"; - break; - case -EILSEQ: - errmsg = "CRC/Timeout (could be anything)"; - break; - case -ETIME: - errmsg = "Device does not respond"; - break; - } - dprintk(dev, V4L2_DEBUG_QUEUE, "URB status %d [%s].\n", - status, errmsg); - if (status<0) + if (status<0) { + print_err_status (dev,i,status); continue; + } len=urb->iso_frame_desc[i].actual_length; @@ -439,7 +456,7 @@ static inline int tm6000_isoc_copy(struct urb *urb, struct tm6000_buffer **buf) if (((*buf)->fmt->fourcc)!=V4L2_PIX_FMT_TM6000) { buffer_filled (dev, *buf); - dprintk(dev, V4L2_DEBUG_QUEUE, "new buffer filled\n"); + dprintk(dev, V4L2_DEBUG_ISOC, "new buffer filled\n"); } return rc; |