Lines 1574-1579
Link Here
|
1574 |
spca50x->funct.stopN(spca50x); |
1574 |
spca50x->funct.stopN(spca50x); |
1575 |
} |
1575 |
} |
1576 |
|
1576 |
|
|
|
1577 |
|
1578 |
/********************************************************************** |
1579 |
* spcaReducePacketSize |
1580 |
* Function Fixes the bandwidth problem that occurs |
1581 |
* when other USB devices are on the same host controller bus as the |
1582 |
* camera by gradually lowering the bandwidth requirements of the driver. |
1583 |
* It works even when other USB devices are present on the same |
1584 |
* host controller bus as the camera. |
1585 |
* |
1586 |
* Problem |
1587 |
* When other USB devices are present on the same host controller |
1588 |
* bus as the camera, the bandwidth requirements of the spca5xx driver |
1589 |
* are not being met. The spca5xx driver is asking for more bandwidth |
1590 |
* than is available which results in the following error messages: |
1591 |
* |
1592 |
* No space left on device |
1593 |
* can't open /dev/video0: No space left on device. |
1594 |
* usb_submit_urb(0) ret -28 |
1595 |
* |
1596 |
* |
1597 |
* Many thanks to all the wonderful people contributing to this project. |
1598 |
* |
1599 |
* Great work! |
1600 |
* vodunvibe [AT] NO@SPAM.PLEASE yahoo DOT com |
1601 |
* 2006-08-27 |
1602 |
* |
1603 |
***********************************************************************/ |
1604 |
static int spcaReducePacketSize(struct usb_spca50x *spca50x, int n, int err) |
1605 |
{ |
1606 |
int size=896, fx, i; |
1607 |
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); |
1608 |
while (err == -ENOSPC && size >= 0) { |
1609 |
err("spcaReducePacketSize: vodunvibe - Lowering the bandwidth requirements - New packet size (%d) ", size); |
1610 |
spca50x_set_packet_size(spca50x, size); |
1611 |
spca50x->sbuf[n].urb->transfer_buffer_length = spca50x->packet_size * FRAMES_PER_DESC; |
1612 |
for (fx = 0; fx < FRAMES_PER_DESC; fx++) { |
1613 |
spca50x->sbuf[n].urb->iso_frame_desc[fx].offset = spca50x->packet_size * fx; |
1614 |
spca50x->sbuf[n].urb->iso_frame_desc[fx].length = spca50x->packet_size; |
1615 |
} |
1616 |
size-=128; |
1617 |
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41) |
1618 |
err = usb_submit_urb(spca50x->sbuf[n].urb, GFP_KERNEL); |
1619 |
#else |
1620 |
err = usb_submit_urb(spca50x->sbuf[n].urb); |
1621 |
#endif |
1622 |
} |
1623 |
|
1624 |
if (!err) { |
1625 |
for (i = 0; i < SPCA50X_NUMSBUF; i++) { |
1626 |
spca50x->sbuf[i].urb->transfer_buffer_length = spca50x->packet_size * FRAMES_PER_DESC; |
1627 |
for (fx = 0; fx < FRAMES_PER_DESC; fx++) { |
1628 |
spca50x->sbuf[i].urb->iso_frame_desc[fx].offset = spca50x->packet_size * fx; |
1629 |
spca50x->sbuf[i].urb->iso_frame_desc[fx].length = spca50x->packet_size; |
1630 |
} |
1631 |
} |
1632 |
} |
1633 |
return err; |
1634 |
} |
1635 |
|
1636 |
|
1577 |
static int spca50x_init_isoc(struct usb_spca50x *spca50x) |
1637 |
static int spca50x_init_isoc(struct usb_spca50x *spca50x) |
1578 |
{ |
1638 |
{ |
1579 |
|
1639 |
|
Lines 1649-1655
Link Here
|
1649 |
#endif |
1709 |
#endif |
1650 |
if (err) { |
1710 |
if (err) { |
1651 |
err("init isoc: usb_submit_urb(%d) ret %d", n, err); |
1711 |
err("init isoc: usb_submit_urb(%d) ret %d", n, err); |
1652 |
return err; |
1712 |
if (err == -ENOSPC) { |
|
|
1713 |
err = spcaReducePacketSize(spca50x, n, err); |
1714 |
if (err) { |
1715 |
err("init isoc: After spcaReducePacketSize - usb_submit_urb(%d) ret %d", n, err); |
1716 |
return err; |
1717 |
} |
1718 |
}else{ |
1719 |
return err; |
1720 |
} |
1653 |
} |
1721 |
} |
1654 |
} |
1722 |
} |
1655 |
|
1723 |
|