pwc
[Top] [All Lists]

Re: [pwc] Logitech QuickCam Pro support?

To: Philips Webcam Linux Driver <>
Subject: Re: [pwc] Logitech QuickCam Pro support?
From: "John Stoffel" <>
Date: Sun, 17 Jul 2005 18:19:46 -0400
So I've been hacking the pwc-if.c code to see if I can understand why
the pwc_isoc_init() routine keeps bombing out.  Here's the function
I'm using now, and I'm printing out the various endpoint values, which
are shown here:

  Jul 17 18:15:13 jfsnew kernel: pwc set_video_mode(176x144 @ 10, palette 15).
  Jul 17 18:15:13 jfsnew kernel: pwc decode_size = 1.
  Jul 17 18:15:13 jfsnew kernel: pwc Using alternate setting 1.
  Jul 17 18:15:13 jfsnew kernel: pwc frame_size=18900, vframes=10, vsize=1, 
vsnapshot=0, vbandlength=630
  Jul 17 18:15:13 jfsnew kernel: pwc Endpoint 0, pdev->vendpoint: 
5,bEndpointAddress: 129
  Jul 17 18:15:13 jfsnew kernel: pwc Endpoint 1, pdev->vendpoint: 
5,bEndpointAddress: 130
  Jul 17 18:15:13 jfsnew kernel: pwc Endpoint 2, pdev->vendpoint: 
5,bEndpointAddress: 131
  Jul 17 18:15:13 jfsnew kernel: pwc Failed to find packet size for video 
endpoint in current alternate setting, got -1.


And my slightly hacked function.  I'm running this all on kernel
2.6.12.1, since that's what I have up and running right now and I'm
loathe to upgrade to the 2.6.13-rc? series since they seem a bit more
unstable.

Now to see if I can just turn off the pwc_isoc_init() stuff completely
and see what happens.  Maybe compression doesn't work on this camera?  

Thanks,
John


static int pwc_isoc_init(struct pwc_device *pdev)
{
        struct usb_device *udev;
        struct urb *urb;
        int i, j, ret;

        struct usb_interface *intf;
        struct usb_host_interface *idesc = NULL;

        if (pdev == NULL)
                return -EFAULT;
        if (pdev->iso_init)
                return 0;
        pdev->vsync = 0;
        udev = pdev->udev;

        /* Get the current alternate interface, adjust packet size */
        if (!udev->actconfig)
                return -EFAULT;
        intf = usb_ifnum_to_if(udev, 0);
        if (intf)
                idesc = usb_altnum_to_altsetting(intf, pdev->valternate);
                
        if (!idesc)
                return -EFAULT;

        /* Search video endpoint */
        pdev->vmax_packet_size = -1;
        for (i = 0; i < idesc->desc.bNumEndpoints; i++) {
          Err("Endpoint %d, pdev->vendpoint: %d,bEndpointAddress: 
%d\n",i,pdev->vendpoint,idesc->endpoint[i].desc.bEndpointAddress );
                if ((idesc->endpoint[i].desc.bEndpointAddress & 0xF) == 
pdev->vendpoint) {
                  Err("wMaxPacketSize: %d\n", 
idesc->endpoint[i].desc.wMaxPacketSize);
                        pdev->vmax_packet_size = 
le16_to_cpu(idesc->endpoint[i].desc.wMaxPacketSize);
                        break;
                }
        }
        
        if (pdev->vmax_packet_size < 0 || pdev->vmax_packet_size > 
ISO_MAX_FRAME_SIZE) {
                Err("Failed to find packet size for video endpoint in current 
alternate setting, got %d.\n",pdev->vmax_packet_size);
                return -EADDRNOTAVAIL; /* Odd error, that should be noticable */
        }

        /* Set alternate interface */
        ret = 0;
        Trace(TRACE_OPEN, "Setting alternate interface %d\n", pdev->valternate);
        ret = usb_set_interface(pdev->udev, 0, pdev->valternate);
        if (ret < 0)
                return ret;

        for (i = 0; i < MAX_ISO_BUFS; i++) {
                urb = usb_alloc_urb(ISO_FRAMES_PER_DESC, GFP_KERNEL);
                if (urb == NULL) {
                        Err("Failed to allocate urb %d\n", i);
                        ret = -ENOMEM;
                        break;
                }
                pdev->sbuf[i].urb = urb;
                Trace(TRACE_MEMORY, "Allocated URB at 0x%p\n", urb);
        }
        if (ret) {
                /* De-allocate in reverse order */
                while (i >= 0) {
                        if (pdev->sbuf[i].urb != NULL)
                                usb_free_urb(pdev->sbuf[i].urb);
                        pdev->sbuf[i].urb = NULL;
                        i--;
                }
                return ret;
        }

        /* init URB structure */        
        for (i = 0; i < MAX_ISO_BUFS; i++) {
                urb = pdev->sbuf[i].urb;

                urb->interval = 1; // devik
                urb->dev = udev;
                urb->pipe = usb_rcvisocpipe(udev, pdev->vendpoint);
                urb->transfer_flags = URB_ISO_ASAP;
                urb->transfer_buffer = pdev->sbuf[i].data;
                urb->transfer_buffer_length = ISO_BUFFER_SIZE;
                urb->complete = pwc_isoc_handler;
                urb->context = pdev;
                urb->start_frame = 0;
                urb->number_of_packets = ISO_FRAMES_PER_DESC;
                for (j = 0; j < ISO_FRAMES_PER_DESC; j++) {
                        urb->iso_frame_desc[j].offset = j * ISO_MAX_FRAME_SIZE;
                        urb->iso_frame_desc[j].length = pdev->vmax_packet_size;
                }
        }

        /* link */
        for (i = 0; i < MAX_ISO_BUFS; i++) {
                ret = usb_submit_urb(pdev->sbuf[i].urb, GFP_KERNEL);
                if (ret)
                        Err("isoc_init() submit_urb %d failed with error %d\n", 
i, ret);
                else
                        Trace(TRACE_MEMORY, "URB 0x%p submitted.\n", 
pdev->sbuf[i].urb);
        }

        /* All is done... */
        pdev->iso_init = 1;
        Trace(TRACE_OPEN, "<< pwc_isoc_init()\n");
        return 0;
}
_______________________________________________
pwc mailing list

http://lists.saillard.org/mailman/listinfo/pwc

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU