Wednesday, July 16, 2008

two usb webcams same hub, ubuntu 7.04

Well, I know how I got two cameras working on the same hub in Ubuntu 7.04, but apparently it doesn't work in 7.10. If I can get it working again, I'll provide better instructions. The key step is to download the source code for gspca for linux. Then open up gspca_core.c and search for he section where the author says he doesn't know how to set the bandwidth budget so he allows the maximum. Here is the section:


/**
* Endpoint management we assume one isoc endpoint per device
* that is not true some Zoran 0x0572:0x0001 have two
* assume ep adresse is static know
* FIXME as I don't know how to set the bandwith budget
* we allow the maximum
**/
static struct usb_host_endpoint *
gspca_set_isoc_ep(struct usb_spca50x *spca50x, int nbalt)
{
int i, j;
struct usb_interface *intf;
struct usb_host_endpoint *ep;
struct usb_device *dev = spca50x->dev;
struct usb_host_interface *altsetting = NULL;
int error = 0;
PDEBUG(3, "enter get iso ep ");
intf = usb_ifnum_to_if(dev, spca50x->iface);
/* bandwith budget can be set here */
for (i = 4; i; i--) {//changed nbalt to 4
altsetting = &intf->altsetting[i];
for (j = 0; j < altsetting->desc.bNumEndpoints; ++j) {
ep = &altsetting->endpoint[j];
PDEBUG(3, "test ISO EndPoint %d",ep->desc.bEndpointAddress);
if ((ep->desc.bEndpointAddress ==
(spca50x->epadr | USB_DIR_IN))
&&
((ep->desc.
bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_ISOC)) {
PDEBUG(0, "ISO EndPoint found 0x%02X AlternateSet %d",
ep->desc.bEndpointAddress,i);
if ((error =
usb_set_interface(dev, spca50x->iface,
i)) < 0) {
PDEBUG(0, "Set interface err %d",
error);
return NULL;
}
spca50x->alt = i;
return ep;
}
}
}
PDEBUG(0, "FATAL ISO EndPoint not found ");
return NULL;
}

Well as you can see the outer for loop was i = nbalt. I changed that to 4 since it seemed like a nice number. It was really arbitrary. Then do make and make install, and you should be good, then download some program like spcaview and have at it.

No comments: