Am Freitag, 21. September 2001 00:09 schrieb kevin:
> I am trying to write a loadable driver for a usb STV0680 based camera
> (pencam). I already have a command line program which will allow the
> user to download images from the camera, but I am writing the driver to
> make use of the camera's video function. I have run into the same
> problem using several different starting codes (ibmcam, ultracam); the
> most recent is based on the usb-skeleton.c code. I put in the
> Vendor/Product IDs, everything seems OK (the driver finds the camera).
You should start from a driver that supports a video input device. The
usefullness of your driver is extremely diminished if it doesn't comply to
the v4l interface definition. Thus copying from a driver that does is wise.
> Now I have to send a series of about a dozen vendor specific commands
> to the camera to initialize it for video mode (or to download still
> pictures). These codes were obtained from the Windows sniff usb program,
> and work in the command line program, which uses libusb. When I try to
> send these codes to the device using usb_control_msg(dev, pipe, reqest,
> req-type, ...), the driver crashes:
>
> invalid operand: 0000
> CPU : 0
> and register dumps.
And a stack trace which would be the important part.
"invalid operand" is one of the rarer errors. Perhaps you are overflowing a
buffer on the stack ? It's hard to tell without seeing the code.
> (One example of command values is req-type=0xc1, request=0x8a, value=0,
> index=0, lenght=9).
>
> I put these vendor-specific commands in a function called at the end of
> the pencam_probe function, after everything else has been initialized
> and set up. In my function, I first call the usb_set_interface and
> _configuration, which themselves call usb_control_msg, and they return
> with value 0, indicating they work. Then I try my commands with
> usb_control_msg and I get the crash (even 1 call will do it). As near as
> I can tell, I am using the correct values for usb_device and
> usb(snd)rcvpipe(..) (same references that work with the
> usb_set_configuration and _interface).
>
> Is there some extra command or setup procedure that has to be called
> before calling usb_control_msg? Or is there another function (other than
> the _probe) where I should be sending the camera initialization commands
> from? From a comment in the _ioctl function, it looks as if I might be
You could just as well do it the first time open() is called.
> able to do it there, but can I use the _control_msg, or do I need to put
> all the commands in a buffer? Thanks,
You cannot use usb_control_msg() in an interrupt handler.
Except for that it should be safe.
HTH
Oliver
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel