From b6eb7082c34bee66d410c505ecfea168dc541ce5 Mon Sep 17 00:00:00 2001 From: Chuck Short Date: Mon, 7 Jan 2002 17:37:20 -0500 Subject: [PATCH] =?utf-8?q?[UBUNTU:_spca5xx]_Resolves_"No_space_left_on_device=E2=80=9D_usb=5Fsubmit=5Furb(0)_ret_-28?= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Makes spca5xx work again. Closes: #38906, 34543, 42312, 38906. Signed-off-by: Chuck Short --- drivers/usb/media/spca5xx/spca5xx-main.c | 43 +++++++++++++++++++++++++++++- 1 files changed, 42 insertions(+), 1 deletions(-) diff --git a/drivers/usb/media/spca5xx/spca5xx-main.c b/drivers/usb/media/spca5xx/spca5xx-main.c index 45782ed..eb3ab70 100644 --- a/drivers/usb/media/spca5xx/spca5xx-main.c +++ b/drivers/usb/media/spca5xx/spca5xx-main.c @@ -1947,6 +1947,38 @@ spcaCameraStop (struct usb_spca50x *spca } } +static int spcaReducePacketSize(struct usb_spca50x *spca50x, int n, int err) +{ + int size=896, fx, i; + err("spcaReducePacketSize: vodunvibe - The usb_submit_urb(%d) transfer request submission failed - You probably have another device sharing the same USB Host Controller Bus as your camera. Try using another USB port, on a different host controller bus.", n); + while (err == -ENOSPC && size >= 0) { + err("spcaReducePacketSize: vodunvibe - Lowering the bandwidth requirements - New packet size (%d) ", size); + spca50x_set_packet_size(spca50x, size); + spca50x->sbuf[n].urb->transfer_buffer_length = spca50x->packet_size * FRAMES_PER_DESC; + for (fx = 0; fx < FRAMES_PER_DESC; fx++) { + spca50x->sbuf[n].urb->iso_frame_desc[fx].offset = spca50x->packet_size * fx; + spca50x->sbuf[n].urb->iso_frame_desc[fx].length = spca50x->packet_size; + } + size-=128; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41) + err = usb_submit_urb(spca50x->sbuf[n].urb, GFP_KERNEL); +#else + err = usb_submit_urb(spca50x->sbuf[n].urb); +#endif + } + + if (!err) { + for (i = 0; i < SPCA50X_NUMSBUF; i++) { + spca50x->sbuf[i].urb->transfer_buffer_length = spca50x->packet_size * FRAMES_PER_DESC; + for (fx = 0; fx < FRAMES_PER_DESC; fx++) { + spca50x->sbuf[i].urb->iso_frame_desc[fx].offset = spca50x->packet_size * fx; + spca50x->sbuf[i].urb->iso_frame_desc[fx].length = spca50x->packet_size; + } + } + } + return err; +} + static int spca50x_init_isoc (struct usb_spca50x *spca50x) { @@ -2024,8 +2056,17 @@ spca50x_init_isoc (struct usb_spca50x *s #endif if (err){ err ("init isoc: usb_submit_urb(%d) ret %d", n, err); - return err; + if (err == -ENOSPC) { + err = spcaReducePacketSize(spca50x, n, err); + if (err) { + err("init isoc: After spcaReducePacketSize - usb_submit_urb(%d) ret %d", n, err); + return err; + } + } else { + return err; } + } + } } for (n = 0; n < SPCA50X_NUMFRAMES; n++) -- 1.4.3.3