Re: [ADVICE WANTED] by new cpia driver maintainer...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 18-Nov-2002 Mark McClelland wrote:
> Duncan Haldane wrote:
> 
>  >If two cameras are registered, one on /dev/video0 and one on /dev/video1,
>  >and I use e.g. xawtv or gqcam to monitor them, I cannot open /dev/video1
>  >when /dev/video0 is open and vice-versa.  This happens for two cpia
>  >devices and one cpia + one ov511 device.
> 
> That's because both cameras are trying to use nearly all of the USB's
> bandwidth. Or, more precisely, each is trying to schedule an ISO packet

Yes, this seems correct: I have now traced the problem to disruption of
communication of commands to/from the cpia cam (ReadPacket() in cpia_usb.c/
cpia_usb_transferCmd()).  This eventually causes de/re-registration of
the camera, leaving a frozen viewer window that needs a reboot to clear
it.... (incomplete cleanup ?) -- nasty.

Is there any kind of locking that cpia_usb_transferCmd could use to 
temporarily grab the full usb bandwidth for camera control (so this takes
precedence over data transfer by other devices?)  At the very least I would
hope to prevent hanging that requires a reboot!.

static int ReadPacket(struct usb_device *udev, u8 *packet, u8 *buf, size_t size)
{
        if (!packet || size <= 0)
                return -EINVAL;

        return usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
                         packet[1] + (packet[0] << 8),
                         USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
                         packet[2] + (packet[3] << 8),
                         packet[4] + (packet[5] << 8), buf, size, HZ);
}

static int cpia_usb_transferCmd(void *privdata, u8 *command, u8 *data)
{
        int err = 0;
<snip>
        struct usb_device *udev = ucpia->dev;
        u8 buffer[8];
<snip>
                err = ReadPacket(udev, command, buffer, 8);
                if (err < 0)
                        return err;
<snip>
}


<snip> 
> Check the descriptors. As long as there's an alternate setting where
> MxPS <= 1023 / 2 then you should be in business. You can either have the
> packet size or alternate number be a module param, or you can do a
> "cams" thing like ov511. Or, you can allow the frame rate to be set
> somewhere, and have the driver automatically choose the minimum possible
> packet size that can still sustain that frame rate.

Mark, I attach a bzipped copy of cpia_usb.c, could you cast your experienced
eye over it to see where a setting like this could be controlled, and point
me at it?  I gather that your ov511 code originally derived somewhat from
cpia driver code, maybe you can recognize something?


Duncan



----------------------------------
E-Mail: Duncan Haldane <f.duncan.m.haldane@xxxxxxxxxxxxxxxx>
Date: 18-Nov-2002
Time: 11:20:10

This message was sent by XFMail
----------------------------------

Attachment: cpia_usb.c.bz2
Description: Binary data


[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux