![]() |
ubuntu.com - launchpad.net - ubuntu help
|
|
|||||||
|
Tutorials & Tips The place to find Ubuntu related Tips & Tricks. |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
First Cup of Ubuntu
![]() Join Date: Aug 2006
Beans: 7
Ubuntu 6.06
|
Spca5xx
The spca5xx driver included in the Dapper Drake (6.06) Ubuntu kernel works out of the box for most people, as it has been the case for myself until recently when I tried using my Webcam on an my other computers. Unfortunately for some, trying to use their camera with the spca5xx driver when other USB devices are present on the same host controller bus as the camera, the following error appear: No space left on device can't open /dev/video0: No space left on device. I have a Logitech QuickCam Communicate STX and an hp USB Multimedia Cordless Kit with a wireless keyboard and wireless mouse connected to the same host controller as my camera which. I also had the same error message as a result of this configuration. The spca5xx driver supports a variety of cameras. For a full list of supported cameras, take a look at http://mxhaard.free.fr/spca5xx.html Problem When other USB devices are present on the same host controller bus as the camera, the bandwidth requirements of the spca5xx driver are not being met, with some hardware configurations. The spca5xx driver is asking for more bandwidth than is available which results in the following error messages: No space left on device can't open /dev/video0: No space left on device. There is a very good howto for the Spca5xx driver at https://help.ubuntu.com/community/Spca5xx if you haven't encountered the “No space left on device” error message. Solutions There are multiple solutions which will work depending on your hardware configuration. Please be advised that it is best to connect the camera directly to the motherboard and not use a USB HUB. The only solution which worked in my particular situation, was to dig into the spca5xx source code (spca5xx-20060501) and modify it by adding a fix, due to the fact that no matter which USB port I used, my camera always appeared on the same host controller bus as my USB keyboard and mouse. If you've already unsuccessfully shuffled your USB devices from port to port, you might want to skip ahead to Solution 2 and compile and install the modified spca5xx source code.
Solution 1 - Put the camera on a separate USB host controller bus Try to put the camera on a separate USB host controller bus with no other devices on it. (Assuming you don't have a USB keyboard and USB mouse. If you do skip to the next section)
Solution 1 - Put the camera on a separate USB host controller bus (USB keyboard and USB mouse) Try to put the camera on a separate USB host controller bus with no other devices on it. (If you can find a set PS/2 keyboard and mouse, try the above solution if not continue)
Solution 2 - Compile the modified spca5xx source code. The fix works by gradually lowering the bandwidth requirements of the driver (spca5xx-20060501) and works even when other USB devices are present on the same host controller bus as the camera. Then same method can also be used to resolve the same issue on the qc-usb QuickCam Express Driver. The new driver will be installed at this location (kernel 2.6 +): /lib/modules/`uname -r`/kernel/drivers/media/video/spca5xx/ The new driver will be installed at this location (kernel 2.4): /lib/modules/`uname -r`/kernel/drivers/usb/ Please use one of the following 3 options:
Automated Installation Script
Code:
#!/bin/sh
#spca5xxvodunvibeFix
#
# This Script to automatically installs spca5xxvodunvibeFix
#
## Exit if any command does not complete successfully.
#set -o errexit
#trap 'echo "The previous command did not complete successfully. "' ERR
echo "This script will extract and install spca5xx-20060501vodunvibeFix.tar.gz"
echo -e "\nThe following will also be downloaded and installed:"
echo "linux-headers-`uname -r` linux-restricted-modules-`uname -r` build-essential gcc"
echo "This script has been tested on Ubuntu Breezy Badger (5.10) and Dapper Drake (6.06)."
echo -e "\nPress enter to continue. CTRL-C to abort"
read
if grep -q "5.10" /etc/issue ; then
sudo apt-get install linux-headers-`uname -r` linux-restricted-modules-`uname -r` build-essential gcc-3.4
export CC=gcc-3.4
else
sudo apt-get install linux-headers-`uname -r` linux-restricted-modules-`uname -r` build-essential gcc
fi
KERNEL_VERSION=`uname -r`
MODULE_INSTALLDIR=/lib/modules/$KERNEL_VERSION/kernel/drivers/media/video/spca5xx
if [ -d /lib/modules/`uname -r`/build ]
then
echo "The link Exists"
else
echo "Creating link"
ln -s /usr/src/linux-headers-`uname -r` /lib/modules/`uname -r`/build
fi
#Move the modified spca5xx source code from your home directory to /usr/src
cd /usr/src
sudo mv ~/Desktop/spca5xx-20060501vodunvibeFix.tar.gz .
#Extract it from the archive:
sudo tar xfvz spca5xx-20060501vodunvibeFix.tar.gz
cd spca5xx-20060501vodunvibeFix
#Compile the spca5xx source code
sudo make clean
sudo make
#Remove the old driver from memory
sudo modprobe -r spca5xx
echo -e "\nBacking up current spca5xx.ko kernel module\n"
#Backup the current spca5xx.ko kernel module
sudo cp -p $MODULE_INSTALLDIR/spca5xx.ko $MODULE_INSTALLDIR/spca5xx.ko.`date -Iseconds`
#Install the new driver at this location /lib/modules/`uname -r`/kernel/drivers/media/video/spca5xx/
sudo make install
#Load the new driver
sudo modprobe spca5xx
#Check dmesg and the system logs for errors
dmesg
echo spca5xxvodunvibeFix Finished!
read
Manual Installation
Patch The more experienced users can use the following patch and perform a manual installation. To apply the patch from your current working directory, with a subdirectory called spca5xx-20060501 use: Code:
patch -p0 < spca5xx-20060501-vodunvibe-Nospaceleftondevice.patch Code:
patch -p1 < spca5xx-20060501-vodunvibe-Nospaceleftondevice.patch Code:
diff -urN spca5xx-20060501.orig/drivers/usb/spca5xx.c spca5xx-20060501/drivers/usb/spca5xx.c
--- spca5xx-20060501.orig/drivers/usb/spca5xx.c 2006-04-29 11:38:07.000000000 -0400
+++ spca5xx-20060501/drivers/usb/spca5xx.c 2006-09-05 13:19:04.000000000 -0400
@@ -1574,6 +1574,66 @@
spca50x->funct.stopN(spca50x);
}
+
+/**********************************************************************
+* spcaReducePacketSize
+* Function Fixes the bandwidth problem that occurs
+* when other USB devices are on the same host controller bus as the
+* camera by gradually lowering the bandwidth requirements of the driver.
+* It works even when other USB devices are present on the same
+* host controller bus as the camera.
+*
+* Problem
+* When other USB devices are present on the same host controller
+* bus as the camera, the bandwidth requirements of the spca5xx driver
+* are not being met. The spca5xx driver is asking for more bandwidth
+* than is available which results in the following error messages:
+*
+* No space left on device
+* can't open /dev/video0: No space left on device.
+* usb_submit_urb(0) ret -28
+*
+*
+* Many thanks to all the wonderful people contributing to this project.
+*
+* Great work!
+* vodunvibe [AT] NO@SPAM.PLEASE yahoo DOT com
+* 2006-08-27
+*
+***********************************************************************/
+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)
{
@@ -1649,7 +1709,15 @@
#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;
+ }
}
}
Last edited by vodunvibe; September 5th, 2006 at 04:29 PM.. Reason: I added a patch which can be used against the spca5xx-20060501 source |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|